Showing posts with label DHCP Server Automation. Show all posts
Showing posts with label DHCP Server Automation. Show all posts

Friday, February 14, 2014

Part – 5 :PowerShell and DHCP : Getting Information on leased IP Addresses

 

 

Part – 1 : PowerShell and DHCP : Installing DHCP Server Role on Server 2012

Part – 2 :PowerShell and DHCP : DHCP Post-Install Configuration

Part – 3 :PowerShell and DHCP :  Configuring the DHCP Scope

Part – 4 :PowerShell and DHCP :   Setting DHCP server’s “Server Options”

 

 

Information and Reporting on DHCP Server.

In my previous post we had configured DHCP server’s “Server Options”.

Now our basic DHCP server is fully functional and providing the IP address to the dhcp clients.

Our next step is gathering information of the DHCP clients and the IP addresses leased by the server.

 

Check DHCP server Statistics

To get the quick statistics of the DHCP server, we can use the                                                         Get-DhcpServerv4Statistics” cmdlet and it will show us the quick statistics of the server.  

In these statistics you can see the total number of used and free IP address available.

 

clip_image001[4]

 

IP Address leases

To check the leased IP address those are given to the DHCP clients by DHCP server, we can use the “Get-DhcpServerv4Lease” cmdlet.

To use this cmdlet we have to use –ScopeID parameter. In our case ,our scope id is “192.168.1.0”

Get-DhcpServerv4Lease -ScopeId 192.168.1.0  -AllLeases

clip_image003[4]

clip_image005[4]

 

 

Getting list of available free IP Addresses

 

To know about next available free IP Address we can use                                                   Get-DhcpServerv4FreeIPAddresscmdlet.

Just run the cmdlet with –scopeID parameter and if you want to know the list 10, or 50 next of available free IP then you can use the – NumAddress parameter.

By running the below command we can see the next 10 available free IP addresses for the scope id of 192.168.1.0

Get-DhcpServerv4FreeIPAddress -ScopeId 192.168.1.0 -NumAddress 10

clip_image006[4]

 

That’s all for now. See you in our next blog post.

Regards

Aman Dhally

clip_image017 clip_image018 clip_image019 clip_image020  clip_image021

Monday, February 10, 2014

Part-4 PowerShell and DHCP: Setting DHCP server’s “Server Options”

 

 

Part – 1 : PowerShell and DHCP : Installing DHCP Server Role on Server 2012

Part – 2 :PowerShell and DHCP : DHCP Post-Install Configuration

Part – 3 :PowerShell and DHCP :  Configuring the DHCP Scope

 

In my previous post on “DHCP” article series, we had configure the “DHCP Scope” for DHCP server. Now it is time to set the “Sever Options” for the DHCP server.  

We are going to set the below server options.

S.No

OptionID

Description

1

6

DNS Server

2

3

 Gateway Address

3

15

DNS Suffix

 

Setting Server Options

We have to use the “Set-DhcpServerv4OptionValue” cmdlet to set server options for the DHCP Server. In this cmdlet we have to use the “OptionID” and it’s “Value” parameters mainly.

Open DHCP manager from tools and you can see that there is no “Server Options” are configured yet.

clip_image002

 

Run, “ipconfig /all on client machine and you can see, there is NO entries for, Gateway, Connection specific DNS Suffix and DNS Server ..

clip_image004

 

Setting DNS Server

Let’s set the DNS Server option first, the OptionID for DNS server is 6 ,  I am setting , 202.56.215.55  as a DNS Server.

Set-DhcpServerv4OptionValue -OptionId 6 -Value 202.56.215.55

clip_image006

 

You can also set multiple DNS server by providing multiple comma separated values.

Set-DhcpServerv4OptionValue -OptionId 6 -Value 202.56.215.55 , 202.56.215.54 , 8.8.8.8

clip_image008

 

Setting Gateway

The option ID for gateway is 3, I am setting the value 192.168.1.99 as a gateway address.

Set-DhcpServerv4OptionValue -OptionId 3 -Value 192.168.1.66

clip_image009

 

Setting DNS Suffix

The OptionID for DNS Suffix is 15

I am setting my website domain name a DNS suffix.

clip_image010

 

DHCP Manager

Now open DHCP server manager and click on “Server Options” and you will see all of our entries which we configured and set by PowerShell are there.

clip_image012

 

Testing

It’s time to test the configuration, Now, do the following on your client machine

1.       Run “Ipconfig /release

2.       Run “Ipconfig /renew

3.       Run “Ipconfig /all

Here you go, you can see all of our configured setting there.

clip_image014

 

That’s all for now. See you in my next blog article.

 

Regards

Aman Dhally

clip_image017 clip_image018 clip_image019 clip_image020  clip_image021