DHCP or Dynamic Host Control Protocol is a service that provides an automatic IP assignment system. Besides the IP address, a DHCP server can/will assign network mask, gateway, DNS servers and others. We will discover all elements involved in this process. In today’s enterprises, clients are usually configured to obtain an IP address automatically. These settings are configured from the network interface properties:
When this option is enabled, the client will request its IP configuration from a DHCP server which is responsible for IP assignment. The IP negotiation process is made in four steps:
- The Client will send a DHCP Discover message throughout the network. This message is a broadcast message that it’s received by all devices. By default, routers will not forward broadcast messages, so make sure clients are able to reach the DHCP server.
- The DHCP server will respond with a DHCP Offer message. If the client has an IP reservation, it will receive it directly from the DHCP server through a unicast message. If the client has just been added to the network it will receive a unicast message containing all the network configuration needed to communicate within the subnet (IP, network mask, gateway, DNS servers, etc.). What information is sent by the DHCP server depends on the configurations made on the server.
- The client will send a DHCP Request message if the offer acceptable.
- The server will acknowledge the request and will send a DHCP Ack message. Once this message has been sent, the client will have full network connectivity.
In an older networking article, I’ve described how to configure the DHCP service on a Cisco router. The negotiation mechanism on a Windows Server works in the same way:
We will deploy a DHCP server on a Windows Server 2008 machine. I will try to explain all the elements involved in this process. Open the Server Manager console, navigate to the Roles section and press the Add Roles button:
Read the information written in the welcome screen and press Next. From the Server Roles section select the DHCP server and press Next:
A short description of the DHCP server will be shown, read the information written here and press Next.
In the Network Connection Bindings you’ll have to specify the interface through which clients will send and receive their IP configuration. If you are using a server connected to multiple subnets that uses multiple network interfaces, you can select which one will participate in the DHCP process. Using this method you can isolate networks in which the DHCP messages are sent. Because my virtual machine has one network interface, only this one will appear in this section:
Once you press Next, you will be redirected to the IPv4 DNS Settings section. In the Parent domain you’ll have to specify what domain will be used by clients for name resolution. Underneath this section, enter the IP address of the preferred and alternate DNS servers. Remember that the interface involved in the DHCP process must have a static IP allocated that is part of the same subnet as DHCP clients:
After you have entered all the information request here press Next. If your network is using WINS servers, check the WINS is required for applications on this network box and enter the IP address of the preferred and alternate WINS servers, else click Next:
Now we have to specify the DHCP scope that will be used by the server to assign IP addresses to network clients. A DHCP scope is a continuous pool of IP addresses from which clients will receive IP addresses. If your server is part of a multihomed network then you’ll have to add a DHCP scope for each subnet:
Click on the Add button and enter the following information:
Scope name – this label is used as an identification element for the scope on the DHCP server.
Starting and ending IP address – these two elements specify the IP pool from which clients will receive their IP address allocation
Subnet type – by default a wired network will have the lease duration set to 8 days and a wireless network will have it configured for 8 hours. Select the one that suits you best and check the Activate this scope box.
Subnet mask – specify the subnet mask used by the DHCP scope. Because all devices involved in the DHCP process are part of the same network, the subnet mask will be the same to all computers.
Default gateway – this element is optional and can be added later. The gateway is used to forward network packets outside the network
After the DHCP scope has been added, in the following window you’ll have to specify if the DHCPv6 stateless mode will be used or not. By default, Windows client will use stateless IPv6 configuration without using a DHCP server. The stateless addressing mode is used by default on IPv6 clients (this specifies that the IP allocation will be done by the client). If you disable the stateless mode, the DHCP server will be responsible for assigning IPv6 addresses and other parameters to all IPv6 clients that are set to use stateful addressing. To enable stateful addressing for computers running IPv6, open a command prompt and type in the following:
netsh int ipv6 set int [index] managedaddress=enabled
netsh int ipv6 set int [index] otherstateful=enabled
Clients using stateful addressing will be using the DHCPv6 protocol to request and receive their IP allocation.
If you leave the DHCPv6 stateless mode enabled, in the next page you’ll have to specify the IPv6 DNS servers that will be used by network clients:
I will disable the DHCPv6 stateless mode on the server and we will see later how to configure these settings from the DHCP console.
If the server will be part of an AD DS environment, the DHCP server must be authorized before allocating IP addresses to network computers. This is a security measurement which is highly recommended in an AD DS infrastructure because only authorized DHCP servers will be able to set IP addresses to DHCP clients. You can either use the current logged credentials or another username to authorize the DHCP server:
Click Next, check if everything is correct in the Confirmation section and then click Install. Wait for the installation to finish (an Installation Succeeded message will be shown) and then open the DHCP console:
That’s it for the installation of the DHCP service. If you’ve enjoyed this article share it to others. If there are things that are not so clear don’t hesitate to leave a comment and I will try to respond as soon as possible. Have a great day!