After finishing DHCP server installation, the next thing to do is creating a new DHCP Scope. You need to create a DHCP scope for each subnet that you want to distribute in the network. In each scope you will define the IP address, netmask, gateway, and several other DHCP options. Administrator can choose to Configure DHCP scope in Windows Server 2012 R2 using Server Manager or PowerShell. Continue reading this article to learn the step by steps.
Configure DHCP Scope in Windows Server 2012 R2 using Server Manager
In Server Manager, you will be assisted by a wizard GUI in creating and configuring DHCP scope. Therefore, using Server Manager to configure DHCP scope in Windows Server 2012 R2 is a better option if this is your first time.
To start the configuration, go to Server Manager > Tools > DHCP
On the left side, expand the server name, right-click on IPv4, and select “New Scope”.
Click “Next” on the welcome screen that appears.
Give your scope a name and description as clear as you like then click “Next” to continue.
Now define the first and the last IP address you want in the distribution range as well as the subnet mask. You don’t have to always define all the usable IP in the subnet but it is recommended to do so. The reason is because you cannot expand the distribution range unless you re-creating the scope, but you can always limit the distribution range (using address exclusion — we’ll configure it in the next step). When you’re done, click “Next” to proceed to the next setting.
Here you can define the list of IP address that you want to exclude from distribution. Fill in the starting and ending IP address in the available field then click “Add” button (if you want to exclude a single IP address, just fill in the start address only). Configure all the necessary exclusions (if you don’t want to add any exclusions, just leave it empty) then click “Next” to continue.
In this step define the lease duration (default value is 8 days). DHCP will revoke any assigned IP address on the DHCP client if the client does not renew the lease after passing the duration. The suitable value for this may vary depending on the network behaviour, but it must not be too long or too short. It is important to find out the most optimal value for DHCP lease duration. Click “Next” button to proceed to the next step.
Now we’ll begin configuring DHCP options. The DHCP options that are configurable through the wizard are the basic ones and very recommended to be configured right away. Select “Yes, I want to configure these options now” and click “Next” button.
The first option is the router (default gateway) address. It is almost impossible to have a scope without gateway address. To add gateway address, type it in the available column and then click “Add”. Click the “Next” button afterwards.
Next option is the domain and DNS. If your DHCP server is domain-joined to Active Directory, the parent domain field is automatically filled with the domain name (but you still can change the value). Also, add the DNS server IP address in the available section with the same way as adding router address. Click “Next” button to proceed.
And the last available DHCP option in the wizard is WINS server. WINS is an old, Windows proprietary protocol that works in similar way as DNS. Almost nobody needs WINS anymore in the network these days since DNS can handle most of what WINS used to serve. However, if you still need WINS you can configure it in this section with the same way you configure router and DNS server address. Otherwise, just leave it blank. Click “Next” to continue.
You must activate the DHCP scope before it can start distributing IP address for DHCP clients in the scope. Select “Yes, I want to activate this scope now” to enable the scope. Then, click “Next” button to proceed.
And here we are at the confirmation screen. Click on “Finish” button and with this way, we have successfully configured DHCP scope in Windows Server 2012 R2 using Server Manager.
Configure DHCP Scope using PowerShell
Another way to configure DHCP scope in Windows Server 2012 R2 is using PowerShell cmdlets. Using PowerShell is much faster but only better if you already know what you want to do.
The command to create DHCP scope in PowerShell is:
Add-DhcpServerV4Scope -name [scope_name] -StartRange [first_ip_address] -EndRange [last_ip_address] -SubnetMask [subnet_mask] -LeaseDuration [duration]
Then there’s command below which you can use to define the exclusion address:
Set-DhcpServerV4ExclusionRange -ScopeId [network_address] -StartRange [first_ip_address] -EndRange [last_ip_address]
Lastly, there’s another important command that you can use to set some of the DHCP options, which are router (default gateway) and the DNS server IP address:
Set-DhcpServerV4OptionValue -ScopeId [network_address] -Router [gateway_ip] -DnsServer [dns_ip] -Force
All you have to do is just replacing the values in the commands above to match the environment. For example, here’s how we changed the values to set the same setting as configured in the wizard GUI previously:
Add-DhcpServerV4Scope -name "MBG Local Area Network" -StartRange 192.168.0.1 -EndRange 192.168.0.254 -SubnetMask 255.255.255.0 -LeaseDuration 8.00:00:00 Set-DhcpServerV4ExclusionRange -ScopeId 192.168.0.0 -StartRange 192.168.0.1 -EndRange 192.168.0.10 Set-DhcpServerV4OptionValue -ScopeId 192.168.0.0 -Router 192.168.0.1 -DnsServer 192.168.0.7 -Force
Of course there are other commands available, but the above lines are sufficient already to create a basic DHCP scope.
Now, whether using Server Manager or PowerShell, you have mastered both ways to configure DHCP scope in Windows Server 2012 R2.