How DHCP Relay Agents work Explained

DHCP clients use local broadcast messages to obtain IP addresses from the DHCP server. By default, routers do not forward local broadcast messages. This means that if the DHCP server is configured on another network or a router is configured between the DHCP server and the DHCP clients, the DHCP clients will not receive IP addresses from the DHCP server.

In such a situation, you have two choices: either configure a DHCP server in each subnet or configure the router as a DHCP relay agent that connects the subnet to the DHCP server. A DHCP relay agent sits between a DHCP server and DHCP clients, allowing clients to obtain IP addresses from a DHCP server that is not on the same LAN.

How do DHCP Relay agents work?

A DHCP client uses the local broadcast address to send a DHCP request. When a router's interface connected to a local subnet receives a DHCP broadcast message, depending on its configuration, it can forward it to the DHCP server or discard it immediately.

If the interface is not configured as the DHCP relay, it will discard the message immediately. However, if it is configured as the DHCP relay, it will forward that message to the DHCP server.

Since a router's interface forwards only unicast messages, and a DHCP message is a broadcast message, the router wraps the broadcast message in a new unicast message and forwards it to the DHCP server.

When the DHCP server receives a DHCP request in a unicast message, it recognizes that the request is from a DHCP relay rather than a DHCP client. Because a DHCP client never uses a unicast address to send a DHCP request.

The DHCP server uses the source address of the incoming unicast message to determine the client's subnet. For example, if the source address of an incoming message is 10.0.0.1/8, the DHCP server knows that the client is on a subnet whose default gateway IP is 10.0.0.1/8.

Once the default gateway IP is determined, the DHCP server checks its pools and finds the pool that uses the same default gateway. In this case, it finds the pool that is configured with the default gateway IP 10.0.0.1/8.

After determining the pool, the DHCP server picks an available IP configuration from the pool, wraps it in a unicast message, and sends it back to the DHCP relay. When the DHCP relay receives a unicast message from the DHCP server, it converts it into a local broadcast message and sends it on the local subnet. The original client receives the DHCP offer message as a local broadcast message.

The following image shows how a client of the subnet 10.0.0.1/8 receives an IP configuration from the server.

how dhcp relay work

This tutorial is part of the tutorial series "DHCP (Dynamic Host Configuration Protocol) basic concepts, configurations, functions, and options explained". Other parts of this series are the following.
Chapter 1  What DHCP is and Types of DHCP Explained
Chapter 2  How DHCP works explained with examples
Chapter 3  DHCP Configuration Parameters and Settings Explained
Chapter 4  How to Configure DHCP Server on Cisco Switches
Chapter 5  Configure DHCP Server for multiple VLANs on the Switch
Chapter 6  How to Configure DHCP Server on Cisco Routers
Chapter 7  How DHCP Relay Agents work Explained
Chapter 8  How to Configure DHCP Relay Agent on Cisco Routers
Chapter 9  How DHCP Snooping works Explained
Chapter 10  Configure DHCP Snooping on Cisco Switches

Conclusion

In a nutshell, a DHCP relay agent converts a local DHCP broadcast message into a unicast message, using its IP address as the source IP address, and sends it to the DHCP server. When the DHCP server receives a unicast reply, it converts it into a local broadcast message and sends it to the local network.

ComputerNetworkingNotes CCNA Study Guide How DHCP Relay Agents work Explained

We do not accept any kind of Guest Post. Except Guest post submission, for any other query (such as adverting opportunity, product advertisement, feedback, suggestion, error reporting and technical issue) or simply just say to hello mail us ComputerNetworkingNotes@gmail.com