How does DHCP work?

Each and every device in the network must have an IP address in order to communicate with other devices in the network. There are two ways of assigning and configuring the IP address on the computer or any network device. They are:

  1. Manual configuration
  2. Dynamic configuration

If you do not know what is an IP address, then I recommend you to go through the postWhat is an IP address?

Manual Configuration: We can configure the IP address on a device manually. When we do this, we also need to configure some additional information as well, like subnet mask, default gateway, DNS servers etc. Below is how we configure IP address manually on a windows 10 PC.

Step 1: Go to control panel -> Network and Sharing center

Step 2:  Click on the name showing next to connections. A new window will open. If you are using a wired LAN connection, then it will show the name “Local Area Network”. If you are using a wireless network, then it will show the name as “Wi-Fi<SSID NAME>”.

Step 3: Click on “Properties”->Double click on  “Internet Protocol version 4 (TCP/IPv4)”. Please note that you need to have administrative permissions to edit the properties.

Step 4: Click the radio button next to “Use the following IP address:” Then all the fields on the page will be enabled. You need to enter the IP address, subnet mask and Default gateway.

Step 5: Click the radio button next to “Use the following DNS server addresses”. Put the IP address of the Preferred and alternate DNS server. 

Step 6: Click on OK and then, OK.

Below is a screenshot of the manual IP assignment in a Windows 10 PC. 

Manual IP address assignment

Now you can communicate to any device in the network if you have configured the above parameters properly. However, configuring these parameters manually is time consuming and error-prone. Imagine, if a medium sized company has 1000 PCs, and the network administrator has to configure the IP address manually on these 1000 PCs, then it will take him days to complete the job. So, manual assignment of IP address is suitable for only for small deployments (5 to 10 computers) or where the device does not support dynamic assignment of IP address.

Dynamic Configuration: IP addresses can be assigned to thousands of end devices dynamically using a protocol called DHCP (dynamic host configuration protocol). For this to work, we need to have a DHCP server in our network, whose role would be to assign the IP addresses dynamically when a computer/client requests for an IP address.

How many DHCP servers do we need in our network? 

I would recommend to keep two DHCP servers in the whole network, and both the servers should be in sync.So that whenever one DHCP server does down or unreachable, other server will assign the IP address to clients. If we keep only one DHCP server in the network, and the DHCP server goes unreachable due to some reason, then the clients will not get IP address. This will cause an outage in the network.

DHCP: When a computer or machine gets powered on, and you have set to receive an IP address automatically by using the option “Obtain an IP address automatically” (refer the above picture), the computer will broadcast a message to discover the DHCP server. There are 4 basic messages that the client(computer) and server (DHCP server) exchange for this to work. They are:

  1. Discover
  2. Offer
  3. Request
  4. Acknowledgement

Note:-DHCP uses UDP port 67 and 68. Please ensure that these ports are not blocked by an ACL/Firewall rule in between client and server.

To be Continued…..

Leave a Reply

Your email address will not be published.