How DHCP Relay Agents work Explained
This tutorial explains what a DHCP relay agent is and how it works. Learn how DHCP relay agents allow local hosts to obtain their IP configuration from the remote DHCP server.
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, if the DHCP server is configured on another network or a router is configured between the DHCP server and DHCP clients, the DHCP clients will not receive IP addresses from the DHCP server.
In such a situation, a network administrator has two choices either configure a DHCP server in each subnet or configure the router as a DHCP relay agent that connect the subnet to the DHCP server. A DHCP relay agent sits between a DHCP server and DHCP clients and allows the DHCP clients to obtain IP addresses from the DHCP server that is not configured on the same LAN.
In this tutorial, we will understand how configure Cisco routers as DHCP relay agents trough a packet tracer example. If you want to learn how to use Cisco routers' interfaces to configure a DHCP server on each subnet or how a DHCP server works, please check the previous parts of this article.
This tutorial is the seventh part of the article 'DHCP (Dynamic Host Configuration Protocol) basic concepts, configurations, functions, and options Explained'. Other parts of this tutorial are the following.
What DHCP is and Types of DHCP Explained
How DHCP works explained with examples
DHCP Configuration Parameters and Settings Explained
How to Configure DHCP Server on Cisco Switches
Configure DHCP Server for multiple VLANs on the Switch
How to Configure DHCP Server on Cisco Routers
How to Configure DHCP Relay Agent on Cisco Routers
How DHCP Snooping works Explained
Configure DHCP Snooping on Cisco Switches
How do DHCP Relay agents work?
A DHCP client always uses the local broadcast address to send a DHCP request. When a router's interface that is connected to a local subnet receives a DHCP broadcast message, depending on how it is configured, it can forward the message to the DHCP server or can discard the message immediately.
If the interface is not configured as the DHCP relay, it will discard the message immediately. But 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's interface 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 the unicast message, it realizes that the request is made by a DHCP relay instead of 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 subnet of the client. For example, if the source address of an incoming message is 10.0.0.1/8, then the DHCP server realizes that the client belong to a subnet which default gateway IP must be 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 and 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 that unicast message in local broadcast message and sends it in 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 IP configuration from the server.
In nutshell, a DHCP relay agent converts the local DHCP broadcast message in a unicast message by using its IP address as the source IP address and sends the unicast message to the DHCP server. When the DHCP server replies, it converts the received unicast replay in local broadcast message and sends it to the local network.
That's all for this tutorial. In the next part of this tutorial, we will understand how to configure DHCP relay agents on Cisco routers. If you like this tutorial, please don't forget to share it friends through your favorite social channel.
By ComputerNetworkingNotes Updated on 2020-10-16 15:57:53 IST
- Cisco IOS Naming Convention Explained with Examples
- OSPF LSA Types and LSA Flooding Explained
- IGP, EGP, and Autonomous System Explained
- OSPF Fundamental Terminology Explained
- OSPF Features, Advantages, Disadvantages
- Administrative Distance (AD) Explained
- Types of Access Control Lists Explained
- Cisco IOS Backup and Restore Process Step By Step Guide
- RIP Protocol configuration Guide with Examples