In this post we will revisit an old friend that is used quite often in all of our modern networks, Dynamic Host Configuration Protocol (DHCP). The DHCP process allows a server to automatically provision IPv4 addresses, along with other important configurations, to clients as they boot up. The following processes take place when DHCP is implemented.
The client broadcasts messages on the physical subnet asking for IP configuration information and to discover available DHCP servers. If required, the network administrators can configure a local router to forward DHCP packets to a DHCP server located on a different subnet. This client-implementation creates a User Datagram Protocol (UDP) packet with the broadcast destination of 255.255.255.255, or the specific subnet broadcast address.
A DHCP client can also request its last-known IP address. If the client remains connected to a network for which this IP is valid, the server might grant the request. Otherwise, it depends whether the server is set up as authoritative or not. An authoritative server will deny the request, making the client ask for a new IP immediately. A non-authoritative server simply ignores the request, leading to an implementation-dependent timeout for the client to give up on the request and ask for a new IP address.
When a DHCP server receives an IP lease request from a client, it reserves an IP address for the client and extends an IP lease offer by sending a DHCPOFFER message to the client. This message contains the client’s MAC address, the IP address that the server is offering, the subnet mask, the lease duration, and the IP address of the DHCP server making the offer.
A DHCP lease duration is the amount of time that the DHCP server grants permission,to the DHCP client, to use a particular IP address. A typical server allows its administrator to set the lease time.
The server determines the configuration based on the client’s hardware address as specified in the Client Hardware Address (CHADDR) field. Then, the server specifies an IP address in the Your IP Address (YIADDR) field.
Depending on the required implementation, the DHCP server may use one of three methods of allocating IP-addresses.
- Dynamic Allocation: With this method, a network administrator assigns a range of IP addresses to the DHCP server, and each client computer on the LAN has its IP software configured to request an IP address from the DHCP server during network initialization. The request-and-grant process uses a lease concept with a controllable time period. This process allows the DHCP server to reclaim and then reallocate IP addresses that are not renewed. This is considered to be a dynamic re-use of IP addresses.
- Automatic Allocation: With this method, a DHCP server permanently assigns an available IP address to a requesting client from the range of a pool of IP addresses that have been defined by the administrator. This is like dynamic allocation, but the DHCP server keeps a table of past IP address assignments, so that it can preferentially assign to a client the same IP address that the client previously had.
- Static Allocation: With this method, a DHCP server allocates an IP address based on a table with MAC address/IP address pairs, which are manually configured in a data base by a network administrator. Only requesting clients with a MAC address listed in this table will be allocated an IP address. This feature, which is not supported by all routers, is usually called Static DHCP Assignment.
A client can receive DHCP offers from multiple servers, but it will accept only one DHCP offer and broadcast a DHCP request message. Based on the Transaction ID field in the request, servers are informed whose offer the client has accepted. When other DHCP servers receive this message, they withdraw any offers that they might have made to the client and return the offered address to the pool of available addresses.
When the DHCP server receives the DHCPREQUEST message from the client, the configuration processes enters its final phase. The acknowledgement phase involves sending a DHCPACK packet to the client. This packet includes the lease duration and any other configuration information that the client might have requested. At this point, the IP configuration process is completed.
The protocol expects the DHCP client to configure its network interface with the negotiated parameters.
In my next few posts, I will continue discussing the DHCP process and focus in on some of the special functions of DHCP servers, along with some of the security issues that must be addressed.
Author: David Stahl