We talked about the basic operations of DHCP in our previous blog post, "What is DHCP?”. Today, we will find out what kind of agent a DHCP relay agent is.
Generally, DHCP messages are broadcasted. So, in order for the messages to be exchanged between a DHCP client (PC) and DHCP server, both the client and server have to reside on the same subnet. That is because routers do not forward any broadcast IP packet (i.e. one with a destination MAC address of FF:FF:FF:FF:FF:FF and a destination IP address of 255.255.255.255) to other interfaces. Thus, a broadcast DHCP packet sent by a DHCP client cannot be delivered to DHCP server(s) on different subnet(s) through a router (shown in Figure (a)). This restriction requires all individual subnets have its own DHCP server for DHCP operations, which is practically not feasible in network operators' networks or corporate networks (Too many DHCP servers are required in the network!).
To address this problem, the concept of a DHCP relay agent has long been adopted. As shown in Figure 1 (b), enabling the DHCP relay agent function in the router allows DHCP messages to be exchanged between DHCP clients and DHCP servers residing on different subnets. The core function of this DHCP relay agent is to convert broadcast DHCP packets into unicast messages and then forward them to DHCP servers.
DHCP message flows in a network with a DHCP relay agent are as follows:
1. [DHCP client (PC) -> DHCP server] DHCP Discover Message
When a client PC broadcasts a DHCP Discover message, a DHCP relay agent receives and converts the message (SIP=DHCP Relay Agent, DIP=DHCP Server), and forwards it to the DHCP server (here, SIP=Source IP address, DIP=Destination IP address in IP header).
2. [DHCP client (PC) <- DHCP server] DHCP Offer Message
When the DHCP server unicasts a DHCP Offer message to the DHCP relay agent (SIP=DHCP Server, DIP=DHCP Relay Agent), the DHCP relay agent converts the received message and broadcasts it to the client PC (Note: messages are not broadcasted in all cases. Please click the link below and refer to our technical document “Understanding the Detailed Operations of DHCP”).
3. [DHCP client (PC) -> DHCP server] DHCP Request Message
When the client PC broadcasts a DHCP Request message, the DHCP relay agent converts the received message (SIP=DHCP Relay Agent, DIP=DHCP Server), and forwards it to the DHCP server.
4. [DHCP client (PC) <- DHCP server] DHCP Ack Message
When the DHCP server unicasts a DHCP Ack message to the DHCP relay agent (SIP=DHCP server, DIP=DHCP Relay Agent), the DHCP relay agent converts and broadcasts the message to the client PC (Note: Messages are not broadcasted in all cases. Please click the link below and refer to our technical document “Understanding the Detailed Operations of DHCP”).
Thx