Windows Server 2012 R2: How to add the DHCP role using PowerShell?

The following is a sample chapter from the e-Book Windows Server 2012 R2: How to install and add roles? (Server Core). Enjoy reading!

This is what people need: an easy-to-deploy, easy-to-use tool.” Nat Friedman

What is Dynamic Host Configuration Protocol (DHCP)?

Basically, Dynamic Host Configuration Protocol (DHCP) is a computer network protocol that assigns IP addresses to computers on a network. The working principle of DHCP briefly is described through the acronym DORA which means Discovery, Offer, Request, and Acknowledgement. In a computer network, when you turn on your computer and the operating system boots up the DHCP Client service transmits the request for an IP address. In fact, this request is an attempt to identify whether or not a DHCP server is available on a LAN. If it is, the DHCP server accepts the DHCPDISCOVER message from the client, reserves an IP address for the client, and responds to the client’s request with a DHCPOFFER message that contains the IP address and associated elements such as subnet mask, default gateway, information about lease duration, and the IP address of the DHCP server. Upon receiving this offer, the client will respond back to the DHCP server with DHCPREQUEST message confirming the interest for the offered IP address. On the server side, as soon as the DHCPREQUEST message reaches the DHCP server, the acknowledgment is being initiated in order to respond back to the client with DHCPPACK message which contains the abovementioned elements requested by the client. This then concludes the assignment of an IP address to a DHCP client by the DHCP server.

How to add the DHCP role?

Like any other role in Windows Server 2012 R2 Server Core, including Dynamic Host Configuration Protocol (DHCP) can be added using PowerShell. To add the DHCP role in your server, complete the following steps:

  • login to your server by typing your Administrator’s password and pressing Enter
  • type PowerShell at command prompt and press Enter
  • type Install-WindowsFeature DHCP -IncludeManagementTools and press Enter

add-dhcp

  • type Get-WindowsFeature and press Enter
  • use PgUp or PgDn to scroll the list
  • you’ll notice that the DHCP role is added to the server

add-dhcp-2

In Conclusion

There is no doubt that the assignment of IP addresses manually on a complex computer networks is extremely tedious job to not say it’s impossible to realize. Thus, adding the role and authorizing the DHCP server on a computer network which is managed and administered by the Windows Server 2012 R2 facilitates extremely the assignment of IP addresses to computers on a network. In this way, in addition to showing respect for system administrators, Microsoft has raised to another level the computer network services administration and management through network operating systems making it even an easier job.

Hope you’ll find this post informative.