DHCPv4 Relay

What is DHCPv4 Relay?

In enterprise network usually dedicated servers are used to provide DHCP, DNS, TFTP, and FTP services. The clients are not usually on the same subnet as those servers. The clients used to broadcast messages to locate the servers and get services.

Now look at the figure below, Laptop0 is attempting to acquire an IPv4 address from a DHCP server using a broadcast message but it is failed to get the IP address. The Laptop0 is now configured the Automatic Private IP Addressing (APIPA). Router0 is not configured as a DHCPv4 server and it cannot forward the broadcast message. The DHCPv4 server is configured but located on a different network, so Laptop0 cannot receive an IP address using DHCP.

DHCPv4 Relay 6

The Figure 2 below illustrates release and renew the process of the IP address, first we have release the IP addressing information with ipconfig /release command and then again trying to get the IP address from DHCP server using ipconfig /renew command but again attempting to renew its IPv4 address failed. Notice when the IPv4 address is released the address is shown to be 0.0.0.0. With ipconfig /renew command laptop0 broadcast a DHCPDISCOVER message but it is unable to locate the DHCPv4 server. Because routers do not forward broadcasts so, the request is not successful.

DHCPv4 Relay 7

So, we can solve this problem to add DHCPv4 servers on all the subnets. But, this solution creates additional cost and administrative overhead over the network. So, what is a better solution?

A better solution is the Cisco IOS helper-address configuration. The Cisco IOS helper enables a router to forward DHCPv4 broadcasts to the DHCPv4 server. When a router is configured to forward address assignment/parameter requests, it is called DHCPv4 relay agent.  Now, look at the example topology, When Laptop0 send a request to locate a DHCPv4 server to Router0. If Router0 configured as a DHCPv4 relay agent, it would forward the request to the DHCPv4 server located on subnet 172.16.0.0/24 network.

DHCPv4 Relay Agent Configuration

The figure below illustrates the Relay Agent configuration on Router0. The command for configuring a relay agent is ip helper-address interface configuration mode command. After the configuration as a DHCPv4 relay agent, Router accepts broadcast requests for the DHCPv4 service and then forwards those requests as a unicast to the IPv4 address configured with ip helper-address. The show ip interface command is used to verify the configuration.

DHCPv4 Relay 8

DHCPv4 Relay 9

 

Now you can verify the IP address configuration on Laptop0 and Laptop1. Both are now able to acquire an IPv4 address from the DHCPv4 server. The figure below illustrates the IPv4 address leased from DHCPv4 server to Laptop0.

DHCPv4 Relay 10

The ip helper-address command also forward Port 37 for Time, Port 49 for TACACS, Port 53 for DNS, Port 67 for DHCP/BOOTP client, Port 68 for DHCP/BOOTP server, Port 69 for TFTP, Port 137 for NetBIOS name service and Port 138 for NetBIOS datagram service.