Open In App

What is DHCPv4 Operation?

Last Updated : 30 Mar, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Prerequisites: DHCP Server

DHCPv4 assigns dynamically IP address and other configuration information to the client. It uses UDP services. DHCPv4 is controlled by a DHCPv4 server that dynamically distributes network configuration parameters such as IP addresses, subnet masks,s and gateway addresses. The DHCPv4 server leases an IP address from the IP address pool to the DHCPv4 client. DHCPv4 is a network protocol that enables the server to automatically assign the IP address to the client. DHCPv4 port number for the server and client is 67 and 68 respectively.

DHCPv4 Components:

  • DHCPv4 Server: DHCPv4 server is a network device running DHCPv4 services that hold IP addresses and other configuration information. It automatically provides network information and also maintains data storage which stores the available IP addresses.
  • DHCPv4 Client: DHCPv4 client is the endpoint that uses the services provided by DHCPv4 and receives the configuration information from the DHCPv4 server. It is the node that requests an IP allocation to a network.
  • DHCPv4 Relay Agent: A host or router that listens for the client messages that are being broadcast to the network and forwards that message to the intended configuration server. Using the DHCPv4 relay agent we can configure multiple LANs with a single server.
  • IP address pool: IP address pool is the range of addresses that are available to the DHCPv4 clients.
  • Subnet: Subnet is the divided segments of the IP networks. It is used to manage networks.
  • Lease:  Lease is the length of time for which DHCPv4 clients hold the IP address information. When it expires the client has to renew it.

Lease Origination:

When DHCPv4 clients boot up it follows a four-step operation to obtain the lease. A client starts the process by broadcasting a DHCPv4 Discover message with its MAC address to all the available DHCPv4 servers.

Lease Origination

 

DHCPv4 Discover:

DHCPv4 client broadcasts the DHCPv4DISCOVER message which contains the source address as 0.0.0.0 to every node on the network including the server. DHCPv4DISCOVER message finds the DHCPv4 servers. It uses layer 2 and layer 3 broadcast addresses to communicate with the servers as the DHCPv4 clients don’t have any valid IP address.

DHCPv4 Offer:

When DHCPv4 servers receive the DHCPv4DISCOVER message it reserves an available IP address to lease the client. The server creates an ARP which includes the MAC address of the intended client and the leased IP address. Then, DHCPv4 servers send the DHCPv4OFFER message to the requesting client as unicast which includes the layer 2 MAC address of the server and client as the source and destination address respectively. 

DHCPv4 Request:

Requested DHCPv4 client on receiving offer message it broadcasts DHCPv4 REQUEST message on the network with the address of server whose offer message is selected by the client. The server which is related to that server address checks whether the address to be assigned to the node is available in data storage. This message is used both for lease origination and lease renewal. This message is broadcasted to all the DHCPv4 servers informing them about the accepted offer and informing the intended DHCPv4 server whose offer the client has accepted. 

DHCPv4 Acknowledgement:

DHCPv4 server on receiving the DHCPv4 REQUEST message from the client verifies the lease through ICMP ping to that address to check if it is not used already and creates a new ARP entry for the client lease and unicasts the DHCPv4 ACK message. If the address is assigned, it marks the IP address in storage as unavailable to ensure consistency. The server sends a DHCPv4 ACK packet to the client which contains network information. It is the copy of the DHCPv4OFFER message except for the message which contains the information about configuration and performs ARP lookup to the assigned address. If there is no reply to the ARP, the client knows that it is a valid IP address, and it can use it as its own IP.

Lease Renewal:

Lease Renewal

 

DHCPv4 working:

DHCPv4 runs in the application layer which dynamically assigns IP addresses to DHCPv4 clients and allocates them the configuration information. The information includes subnet masks, IP addresses, default gateway, and DNS addresses. DHCPv4 is a client-server-based protocol that assigns unique IP addresses from the pool to the requesting DHCPv4 client. 

Applications of DHCPv4:

  • DHCPv4 centrally administrates the IP configuration information.
  • DHCPv4 automatically configures the host process.
  • DHCPv4 clients get their accurate IP address in time.
  • DHCPv4 increases flexibility and scalability. 

Like Article
Suggest improvement
Share your thoughts in the comments