Configure HSRP-Aware DHCP Relay

The Dynamic Host Configuration Protocol (DHCP) provides a mechanism for passing configuration information to hosts on a TCP/IP network. A Dynamic Host Configuration Protocol (DHCP) Relay Agent is a host or IP Router that relays DHCP packets between DHCP clients and DHCP servers.

DHCP Relay agent forwards DHCP discover, offer, reply and ack packets between clients and servers when they are not on the same physical subnet. In case of DHCP Relay, Router doesn't just routes packet as per Dest ID field in IP Packet but instead creates a new DHCP message to be sent towards configured Name server. Relay agent also sets the gateway IP address (the giaddr field of the DHCP packet) and if configured, adds the relay agent information option (option 82) to the packet. The reply from the server is forwarded to the client after removing option 82.

Thus, the DHCP Relay agents eliminates the necessity of having a DHCP server on each physical network.

This document describes a common deployment where we have Routers configured as DHCP Relay Agent along with First Hop Redundancy Protocol (FHRP), Hot Standby Router Protocol (HSRP) in use on the DHCP Client Segment.

Fig 1.1- Network Topology
In the topology below R2_DHCP_Relay and R3_DHCP_Relay Routers are HSRP Peers for LAN Subnet 192.168.23.0/24.

Both the Routers LAN Interface fastethernet0/0 interface is configured with DHCP Relay Agent as well.

Configurations on R2 and R3 routers as below:

R2_DHCP_Relay
!
interface FastEthernet0/0
ip address 192.168.23.2 255.255.255.0
ip helper-address 10.10.24.4
standby 1 ip 192.168.23.1
standby 1 priority 120
standby 1 preempt
!

R3_DHCP_Relay
!
interface FastEthernet0/0
ip address 192.168.23.3 255.255.255.0
ip helper-address 10.10.24.4
standby 1 ip 192.168.23.1
standby 1 priority 100
standby 1 preempt
!

The Bootstrap Request Message from Client will be entertained by both R2_DHCP_Relay and R3_DHCP_Relay Routers and will be forwarded to DHCP Server configured using ip helper-address command.

DHCP Server sends reply to both the Relay Agents 192.168.23.2 and 192.168.23.2 which in turn will be forwarded to DHCP Client further. If the client is not intelligent enough, it may get confuse with two reply coming from DHCP Server.

To overcome this situation, we could configure DHCP Relay Agent with HSRP awareness which is achieved by adding the following commands to both the HSRP active and standby routers:

R2_DHCP_Relay:
!
interface FastEthernet0/0
ip helper-address 10.10.24.4 redundancy HSRP
standby 1 name HSRP
!

R3_DHCP_Relay:
!
interface FastEthernet0/0
ip helper-address 10.10.24.4 redundancy HSRP
standby 1 name HSRP
!

With the above configuration Bootstrap Request Message will be initiated only by HSRP Active Router R2_DHCP_Relay because it is the HSRP active router (due to higher HSRP priority configured). Now, the DHCP server receives only one DHCP Discover message from only one router and it sends the reply message to only one of the two routers from where it received it. 

Hence, the client now will receive the DHCP OFFER packet only once and that too from the Router R2_DHCP router.