A DHCP relay agent transparently transmits DHCP messages between a DHCP client and a DHCP server that reside on different network segments. The DHCP relay function allows DHCP clients and DHCP server that are not part of the same network to communicate.
DHCP relay is usually implemented on a specific interface of a router. This interface requires an IP relay address that is the IP address of the DHCP server specified on the DHCP relay agent. The DHCP relay-enabled interface sends the broadcast DHCP messages that it receives to the specified DHCP server.
If the flags field value is set to 1, the DHCP relay agent broadcasts DHCP reply messages to the DHCP client.
When a DHCP client starts and initializes DHCP, it broadcasts a configuration request packet (DHCPDISCOVER message) onto a local network. After a DHCP relay agent connecting to the local network receives the broadcast packet, it processes and forwards the packet to the specified DHCP server on another network.
After receiving the packet, the DHCP server sends the requested configuration parameters in a DHCPOFFER message to the DHCP client through the DHCP relay agent.
The DHCP client replies to the DHCPOFFER message by broadcasting a DHCPREQUEST message.
Upon receipt, the DHCP relay agent sends the DHCPREQUEST message in unicast mode to the DHCP server.
The DHCP server responds with a unicast DHCPACK or DHCPNAK message through the DHCP relay agent.
An IP address dynamically assigned to a DHCP client usually has a validity period. The DHCP server withdraws the IP address after the validity period expires. To continue using the IP address, the DHCP client must renew the IP address lease.
The DHCP client enters the binding state after obtaining an IP address. The DHCP client has three timers to control lease renewal, rebinding, and lease expiration. When assigning an IP address to the DHCP client, the DHCP server can specify timer values. If the DHCP server does not specify timer values, the default values are used. Table 1 describes the three timers.
Timer |
Description |
Default Value |
---|---|---|
Lease renewal |
When the lease renewal timer expires, the DHCP client automatically sends a DHCPREQUEST message to the DHCP server that has assigned an IP address to the DHCP client. The DHCP client then enters the update state, as shown in Figure 3. If the IP address is valid, the DHCP server responds with a DHCPACK message to notify the DHCP client that the DHCP client has obtained a new IP address lease, and the DHCP client re-enters the binding state. If the IP address is invalid, the DHCP server responds with a DHCPNAK message, and the DHCP client enters the initializing state. |
50% of the lease |
Rebinding |
After the DHCP client sends a DHCPREQUEST message for extending the lease, the DHCP client remains in the update state and waits for a response. If the DHCP client does not receive any responses from the server before the rebinding timer expires, it considers the original DHCP server unavailable and broadcasts a DHCPREQUEST message. Any DHCP server on the network shown in Figure 4 can reply to this request with a DHCPACK or DHCPNAK message. If the DHCP client receives a DHCPACK message, it returns to the binding state and resets the lease renewal timer and rebinding timer, as shown in Figure 3. If the DHCP client receives a DHCPNAK message, it stops using the current IP address immediately and returns to the initializing state to apply for a new IP address. |
87.5% of the lease |
Lease expiration |
When the lease expires, the DHCP client stops using the current IP address and returns to the initializing state to apply for a new IP address. |
100% of the lease |
A DHCP relay agent must support VPN instances to transmit DHCP packets between VPNs. To ensure successful DHCP packet transmission between VPNs, there must be reachable VPN routes. If a DHCP server and a DHCP client reside on different VPNs, the DHCP relay agent can transmit a DHCP request message to the VPN where the DHCP server resides and transmit a DHCP reply message to the VPN where the DHCP client resides. A DHCP relay agent can be deployed in CE1-PE1-PE2-CE2 networking, where the DHCP server connects to one CE and the DHCP client connects to the other CE. Both CE1 and CE2 can belong to the same VPN or different VPNs.
A DHCP relay agent can send a DHCPRELEASE message, carrying an IP address to be released, to the DHCP server.
When a DHCP client cannot send requests to the DHCP server to release its IP address, you can configure the DHCP relay agent to release the IP address assigned by the DHCP server to the DHCP client.