We know that broadcast traffic doesn’t pass through routers. However, a computer searches for DHCP by broadcasting over the network segment for an IP address request. Since this traffic does not pass through routers, it cannot obtain an address if it cannot find a DHCP in the same segment.
How to Enable DHCP Relay Agent on Cisco Router
Now, suppose there are two small networks. One office is located in the Center and the other is located in the Branch office in a nearby or remote location.
There is a way to ensure that these DHCP requests for broadcast traffic on the routers run. In other words, since finding a DHCP server to obtain an address is a very important service, there is an exception to allow these large mass traffic to find a DHCP server and to find these computers from other offices.
There are very few computers and it is not worth putting a dedicated server to specify their addresses, so there are two options; putting a fixed IP address on these computers, or configuring a DHCP relay agent service.
The DHCP Relay Agent is, therefore, a server or router configured to listen for DHCP broadcasts from DHCP clients and forward these messages to DHCP servers on different subnets. Relay agents are part of the DHCP standards and operate according to standard documents (RFCs) that define protocol design and related behavior. Therefore, “RFC 1542 Compliant Router” is a router that supports the transmission of DHCP broadcast traffic.
We know that DHCP clients use broadcasts to obtain an IP address from the DHCP server. Routers do not normally broadcast unless they are configured to allow. Therefore, without additional configuration, DHCP servers are only assigned to assign IP addresses to clients on your local network. In order to assign IP addresses to clients in other segments, it is necessary to configure the network so that DHCP broadcasts can reach the DHCP server from the client.
The Relay Agent is used to distribute IP addresses to different locations. A network adapter configured as an Agent receives DHCP Broadcasts in its network environment and sends it to the corresponding DHCP server as Unicast.
The device for which the Relay Agent is configured can be a Router or Server. There is also 3rd party software that performs this task.
How to Setup DHCP Relay Agent
Follow the steps below to install DHCP Agent on the Cisco Router.
Open the Cisco simulator software and create a network topology for the DHCP as follows.
Open the Cisco Router R1 CLI command prompt and configure the Router’s GigabitEthernet interfaces as follows.
R1# conf t
R1(config)# interface gigabitethernet 0/0
R1(config-if)# ip address 192.168.5.1 255.255.255.0
R1(config-if)# no shutdown
R1(config)# interface gigabitethernet 0/1
R1(config-if)# ip address 192.168.10.1 255.255.255.0
R1(config-if)# no shutdown
Configure the DHCP server on the router as follows.
Here, the purpose of enabling DHCP is to see the difference between Relay Agent. Then we will try to get the IP address from a different location by canceling DHCP.
R1# conf t
R1(config)# ip dhcp pool LAN
R1(dhcp-config)# network 192.168.5.0 255.255.255.0
R1(dhcp-config)# default-router 192.168.5.1
R1(dhcp-config)# dns-server 192.168.5.1
Ping the connection from the PC1 command prompt to the default gateway.
Configure the IP address configuration of PC1 to DHCP.
PC1 sends a DHCP Broadcast message and wait to obtain an IP address from the DHCP server on the network.
PC1 successfully retrieved TCP/IP information from the DHCP server configured on the Router.
Configure the server you added to the 192.168.10.0/24 network as follows and click the Add button to add the configuration to the list.
After making sure that the DHCPRELAY pool is added to the list, proceed to the next step.
Delete the DHCP pool with the no ip dhcp pool LAN command, and then execute the ip helper-address command on the interface that will act as AGENT.
R1# conf t
R1(config)# no ip dhcp pool LAN
R1(config)# interface gigabitethernet0/0
R1(config-if)# ip helper-address 192.168.10.10
For PC1’s IP configuration, select Static and then select DHCP.
Please wait while obtaining the IP address.
As you can see in the image below, PC1 received its TCP/IP settings from the DHCP Server with IP address 192.168.10.10. You can also see that it receives the IP address from block 192.168.5.150 – 192.168.5.200 in the DHCP pool configured as Agent.
You can watch the video below to enable the DHCP relay service on the Cisco Router and also subscribe to our YouTube channel to support us!
With the DHCP relay agent, you can easily distribute IP addresses to different segments. Thanks for following us!