Dynamic Host Control Protocol or DHCP is a method of distributing IP address for hosts in the network. A host in the network will act as the DHCP server and will assign IP address for other hosts in the network who requests for IP address a.k.a the DHCP clients. Windows Server 2012 R2 can be configured as DHCP server. Just like any other roles, Installing DHCP Role in Windows Server 2012 R2 can be done using Server Manager or PowerShell.
Installing DHCP Role in Windows Server 2012 R2 using Server Manager
Using Server Manager is probably the easiest way to install any server role because of the wizard GUI that will help us understands the step by steps. To start installing DHCP Role in Windows Server 2012 R2 using the Server Manager, first you click on “Manage” and then select “Add Roles and Features”.
A window will appear as shown in the figure below. Click “Next” on this window.
Select “Role-based or feature-based installation” and click “Next” button again to continue.
Select the server where you want to install the role. In this example we’re installing it to the local server so we will just continue by clicking “Next” button again.
On the server roles selection, tick the box on “DHCP Server” and click “Next”.
Note that a pop-up window as shown below may appear when you tick the box on the “DHCP Server” option above. When it does, just ensure the “Include management tools” option is ticked an then click “Add Features”
On the feature selection window, just click “Next” button again to continue.
Click “Next” again on the notice window.
Confirm all the settings and watch as the installation is progressing.
The installation of DHCP role does not require server restart so we can continue with the next task. If you’re installing DHCP role on a standalone server then you can start configuring DHCP scope as soon as the wizard completes the installation progress. But, if the server that you’re using is joined to an Active Directory domain, then you need to authorize it first.
Authorizing DHCP Server in Active Directory using Server Manager
If you don’t authorize the server in Active Directory, then it will not be able to distribute IP address for domain computers. In this example, the server that we’re using is joined to a domain named mustbegeek.com, therefore the Server Manager will show a notification to complete DHCP configuration. Just click on the link under that notification as shown below.
Click “Next” on the Description screen.
On the Authorization screen, select either to use the current user credential or use another credential. It requires domain account with sufficient privilege to authorize the DHCP Server in Active Directory. In this example we’re choosing to use the current logged on user credential. Click on the “Commit” button to proceed the authorization.
When the authorization process is success, the “creating security groups” and “authorizing DHCP server” status are all shown as “Done” as in the figure below. Click “Close” to finish the step.
Lastly, restart the DHCP Server service through the services snap-in.
With this way you have successfully installed and authorized the DHCP Server in Active Directory.
Install and Authorize DHCP Server using PowerShell
As the alternative for wizard GUI, installing DHCP Server role in Windows Server 2012 R2 can also be done through PowerShell. Installation using PowerShell is much faster and requires less steps than using Server Manager.
The command to install DHCP Server role is:
Install-WindowsFeature -Name 'DHCP' -IncludeManagementTools
This one-liner command will be the only one you need to install a standalone DHCP server. Additionally, if the server is part of an Active Directory domain and you need to authorize it, you can also do it using PowerShell with the command below:
Add-DhcpServerInDC -DnsName [server_FQDN] -IPAddress [server_IP]
As for our example the command will be:
Add-DhcpServerInDC -DnsName as-app026.mustbegeek.com -IPAddress 192.168.0.26
Finally, if you also need to restart the DHCP Server service, you can also do it through PowerShell with the command:
And that’s all. With only three PowerShell command lines you already completed installing DHCP Server Role in Windows Server 2012 R2 as well as authorizing it in Active Directory.