1 Introduction
1.1 DHCP Background
DHCP is the abbreviation of Dynamic Host Configuration Protocol (DHCP), which is based on the Bootstrap Protocol (BOOTP) and has been standardized as RFC2131 in 1997. With DHCP, computers request IP address and network parameters automatically form a DHCP server, which can reduce the need for a network administrator or a user to configure these setting manually. IPv4 and IPv6 are both supported.
The basic mechanism of DHCP is simple: a client requests the use of an address for a period of time. Its allocation mechanism can guarantee not to reallocate that address within the requested time and attempt to return the same network address each time the client requests an address. Depending on implementation, the DHCP server may have three methods to allocate IP addresses:
(1) Dynamic allocation
The DHCP server reserves a range of IP addresses, and each DHCP client requests an IP address from the server during network initialization. The request-and-grant process uses a lease concept with a controllable time period, allowing the DHCP server to reclaim (and then reallocate) IP addresses that are not renewed.
(2) Automatic allocation
The DHCP server permanently assigns an IP address to a requesting client from the range 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.
(3) Manual allocation (commonly called static allocation)
The DHCP server allocates an IP address based on a preconfigured mapping to each client’s MAC address.
1.2 DHCP Message
The DHCP is based on the client-server (CS) model and adopts UDP in the transport layer. Two port numbers are used for its operations, which are 67 in the DHCP server and 68 in the DHCP client. A typical DHCP session can be divided into four steps: server discover (DHCPDISCOVER), lease offer (DHCPOFFER), IP request (DHCPREQUEST) and lease acknowledgement (DHCPACK), as shown in Figure 1 and 2.
(1) When a new client is linked to a network, it broadcasts a DHCPDISCOVER message on its logical subnet. This message may include options that suggest values for the network address and lease duration.
(2) Each server on that subnet may respond with a DHCPOFFER message that includes an available address in the “yiaddr” field and other parameters in DHCP options.
(3) The client collects DHCPOFFER messages from the servers over a period of time and chooses one message based on the configuration parameters (e.g. the first message or the message from previous server). Then, the client broadcasts a DHCPREQUEST message to indicate the selected server.
(4) T