What is DHCP: Interaction Process and Packet Structure

As the network scale expands and the network complexity increases, the configuration becomes more complex. In addition, the number of computers and mobile devices(such as mobile laptops or wireless terminals) increases sharply, causing frequent IP address changes and insufficient IP resources. The Dynamic Host Configuration Protocol(DHCP) is used to dynamically allocate IP addresses to hosts.

Part I. What is DHCP?

The Dynamic Host Configuration Protocol(DHCP) is a protocol that dynamically provides configuration parameters for Internet terminals. When a terminal submits an application, the DHCP server can provide the terminal with parameters such as the IP address, gateway, and DNS server address. The basic DHCP protocol consists of 3 roles: DHCP server, DHCP client, and DHCP Snooping/relay(optional).

On a TCP/IP network, each workstation must perform basic network configurations before accessing the network and its resources. Key parameters to be configured include IP address, subnet mask, default gateway, and DNS.

On a large network, ensuring that all hosts have correct configurations can be a difficult management task, especially for dynamic networks that contain roaming users and laptops. Computers are often moved from one subnet to another and removed from the network. Manual configuration or reconfiguration of a large number of computers may take a long time, and errors in IP host configuration may cause network communication failures.

Therefore, there is required to simplify IP address configuration and implement centralized IP address management. The Dynamic Host Configuration Protocol(DHCP) is designed for this purpose.

1. DHCP can reduce configuration errors.

The DHCP minimizes the number of errors caused by manual IP address configuration. For example, the possibility of allocating an IP address in use to another device is greatly reduced.

2. DHCP reduces network management workload.

TCP/IP configurations are centrally and automatically completed without manual intervention by a network administrator. A network administrator can define the TCP/IP configurations of the global network and specific subnets in a centralized manner. The DHCP options can automatically allocate all additional TCP/IP values to clients. Client addresses must be frequently updated. For example, a remote access client may move everywhere and needs to be configured efficiently and automatically when it is restarted in a new location.ln addition, most routers can forward DHCP configuration requests, reducing the need for setting up a DHCP server on each subnet unless other reasons make it necessary.

Part II. How does DHCP work?

● DHCP Server

A DHCP server processes requests for address allocation, lease renewal, and release from clients or snooping/ relays, and allocates IP addresses and other network configurations to clients.

● DHCP Client

A DHCP client exchanges packets with a DHCP server to obtain the IP address and other network configurations. The DHCP protocol is used to dynamically obtain parameters such as IP addresses from the DHCP server, facilitating client configuration and centralized management.

● DHCP Address Application Process

1. DHCP Process – Discover

A client broadcasts DHCP Discover packets on the local network segment to discover DHCP servers on the network.

Discovery phase:

A DHCP client searches for a DHCP server.

In the discovery phase, a DHCP client searches for a DHCP server by sending a DHCP Discover packet. Because the IP addresses of DHCP servers are unknown to the client, the DHCP client broadcasts the DHCP Discover packet on the network. All DHCP servers that receive DHCP Discover packets send response packets. The DHCP client can then know the locations of DHCP servers on the network.

2. DHCP Process – Offer

The server responds to the client with an available IP address. This address is not really allocated and is checked using the ICMP Echo Request(or ARP) packet before the assignment.

Offer phase:

The DHCP server provides an IP address for a DHCP client.

A DHCP server that receives a DHCP Discover packet from a DCHP client selects an appropriate IP address from its address pool and sends a DHCP Offer packet carrying the IP address, IP address lease term, and other configuration parameters(such as the gateway address and domain name server address)to the DHCP client.

3. DHCP Process – Request

If a client receives multiple HCP Offer packets, the DHCP client selects one of them based on the content and responds to it. If the client has obtained an IP address earlier, it writes the address in the Requested IP Address field of the Options field in the DHCP Request packet and sends it to the server.

Selection phase:

A DHCP client selects an IP address.

If multiple DHCP servers send DHCP Offer packets to a DHCP client, the DHCP client receives only the DHCP Offer packet that arrives first. Then, the DHCP client broadcasts a DHCP Request packet carrying the server identification(Option54), that is, the IP address of the DHCP server selected by the client.

The DHCP Request packet is sent in broadcast mode to notify all DHCP servers that the client selects the IP address provided by the DHCP server indicated in Option54. Other DHCP servers can therefore reclaim their pre-allocated IP addresses  

4. DHCP Process – ACK

After receiving the DHCP Request packet, the server binds the network address(network and hardware addresses) of the client to the allocated IP address, and then sends the IP address to the client.

A DHCP server confirms that an IP address is allocated to a DHCP client.

After receiving a DHCP Request packet from a DHCP client, the DHCP server searches for the corresponding lease record according to the MAC address carried in the DHCP Request packet If a record is found, the DHCP server sends a DHCP ACK packet containing the IP address and other settings to the client. After receiving the DHCP ACK packet, the DHCP client broadcasts a gratuitous ARP packet to detect whether another host is using the IP address allocated by the server. If no response is received within a specified period, the client uses the IP address.

5. DHCP Process – NAK

After receiving the DHCP Request packet, if the server finds that the requested address is unavailable, it responds with a DHCP NAK.

If a DHCP server does not find a lease record after receiving a DHCP Request packet or fails to allocate an IP address due to specific reasons, the DHCP server sends a DHCP NAK packet to notify the DHCP client that no IP address is available. The DHCP client then needs to resend the DHCP Discover packet to apply for a new IP address After obtaining an IP address, a DHCP client checks the status of the gateway in use before going online. If the gateway address is incorrect or the gateway is faulty, the DHCP client requests a new IP address ln four-step mode.

6. DHCP Process – Address Renewal

When a client address reaches 50% of the lease term(T1), the client sends a DHCP Request unicast packet to renew the lease. When a client address reaches 97.5% of the lease term(T2), the client sends a DHCP Request broadcast packet to renew the lease.

When an IP address reaches 50%(T1)of the lease term, the DHCP client automatically sends a DHCP Request packet to the DHCP server to renew the lease. If a DHCP ACK packet is received, the lease is renewed successfully lf a DHCP NAK packet is received, and the application process is initiated again. When an IP address reaches 87.5%(T2) of the lease term, if the DHCP client does not receive any response from the DHCP server, the DHCP client automatically sends a broadcast packet to DHCP servers to renew the IP address lease. If a DHCP ACK packet is received, the lease is renewed successfully. If a DHCP NAK packet is received, the application process is initiated again. If a client does not receive any response from any server before its IP address lease term expires, the client stops using the IP address and sends a DHCP Discover packet to request a new IP address.

● DHCP Network Application

On live networks, IP addresses are usually assigned from both local and remote address pools. The OLT organizes IPv4 addresses into an IPv4 address pool for management in either of the following modes:

1. The local address pool is managed by the OLT.The OLT allocates, renews, and reclaims IP addresses in the local address pool.

2. The remote address pool is an image of the external DHCP server. It does not contain the actual IP address but specifies the DHCP server corresponding to the address pool. When a remote address pool is used, the OLT can initiate requests on behalf of users or relay user requests to apply for, renew, or release IP addresses from the DHCP server. For example, DHCP snooping or relay.



Recent Post

Innovation Drives Development Quality Builds Brand

We R&D, manufacture, and sell optical communication access systems and terminal equipment. Now we’ve taken the lead in launching a number of original products in the industry, mainly including ONU/ONT, OLT, VoIP gateways, and other network access products, which are designed to meet the needs of telecom operators. We’re committed to helping broadband users worldwide enjoy an ultra-high-speed network!

Get In Touch With Our Experts

Tell us your business needs, and we will find the perfect solution.