Wednesday, 22 June 2016

What is DHCP and How Does It Work?

DHCP is the most important protocol for everyone who wishes to use the Internet.


Those who need to know more about IP addresses need to know a bit about DHCP. This is because it has a direct connection with millions of IP addresses that includes the one you use.
Let us learn more about what is DHCP and how does it work.



 What is DHCP?


DHCP stands for Dynamic Host Configuration Protocol. It helps control the network configuration of a host with a remote server. This functionality of DHCP is installed by default in most operating systems. It helps one overcome the tedious manual configuration of a network on any network device or host.



 Different Messages Used by DHCP?


Have you ever given it a thought, when you connect your computer to the Internet, all the information related to IP address, subnet mask, etc. are assigned automatically? Don’t you wondered how this happens? Well, this is all due to the in-built DHCP in your operating system.

DHCP functions on the client-server model. As it is a protocol itself, it works on its related messages that are exchanged between the client and the server.
Ad


These messages include:


 1. DHCPDISCOVER


It is a broadcast message that begins the interaction between a client and server. It uses 255.255.255.255 as its destination IP address. The source IP is 0.0.0.0.


2. DHCPOFFER


This is the message sent by the DHCP server to the DHCP client as a response to DHCPDISCOVER.

3. DHCPREQUEST


This message indicates that the client has accepted the network configuration in response to the DHCPOFFER message from the server.

4. DHCPACK


The DHCP Server sends this message when it receives the DHCPREQUEST message from the client. It is the end of the process and it just about acknowledgement of the DHCP server to authorize the DHCP client to use the network configuration.

5. DHCPNAK


This is the message the is the opposite of DHCPACK. The DHCP server sends it when it cannot complete the DHCPREQUEST by the client.

6. DHCPDECLINE

 

This is the message of the DHCP client to the server in case it gets an IP address assigned is already in use.

7. DHCPINFORM


This is the message that is sent when IP Address is statically configured on a client. With this message, only other network settings are requested to be filled dynamically by the DHCP servers.

8. DHCPRELEASE


It is a message for termination of the lease of network address provided by the DHCP server sent by the DHCP client.
Ad


How does DHCP Work?


  • A computer is connected it sends DHCPDISCOVER message from client to server.
  • The DHCP server receives the DHCPDISCOVER and it replies with DHCPOFFER message.
  • The client will now reply a DHCPREQUEST message to the DHCPOFFER sent by the DHCP server. This means the client wants to accept the configuration sent by the DHCP server.
  • After the server gets the DHCPREQUEST message from the client, it will send a DHCPPACK message to the client that indicates it can now use the IP address assigned to it.

DHCP Lease


It is important to know about the concept of lease by DHCP. When a server assigns an IP address to a client, it is given on lease. Once the lease expires, the same IP address can be assigned to another client. Suppose a PC works for 10 hours a day, it will be assigned an IP address. When the PC is shut down for the day, the IP address will be assigned to another client. Suppose the lease is about to expire, the DHCP client will try to renew the lease after half time. This process is done with the help of the DHCPREQUEST and DHCPACK messages.

This was in short about what is DHCP and how does it work. Without the DHCP protocol one will not be able to assign IP addresses to their networks automatically.

6 comments: