0

I have two routers in the same subnet that have a HSRP configuration in order to take over, if one of the device fails. There is the same DHCP configuration on both devices:

ip dhcp pool LAN
 network 172.16.220.0 255.255.255.0
 default-router 172.16.220.1
 dns-server 8.8.8.8 8.8.4.4 

how can i make sure, that devices get only IPs from the HSRP active device? Usually, this is done via a small delay on the standby device. How can i configure this in IOS/IOS-XE?

1
  • The DHCP servers in network devices are very simple. If you want more advanced features, then you need to set up a real DHCP server and use DHCP relay (ip helper-address) on your routers. That way, the active router forwards the DHCP request between the host and the DHCP server.
    – Ron Maupin
    Commented May 7, 2021 at 12:27

1 Answer 1

1

Just found a workaround. You can link the status of the DHCP server to a HSRP name:

interface GigabitEthernet1
 ip address 172.16.220.3 255.255.255.0
 standby 10 ip 172.16.220.1
 standby 10 priority 70
 standby 10 preempt
 standby 10 name LAN

ip dhcp pool LAN
 network 172.16.220.0 255.255.255.0
 default-router 172.16.220.1
 dns-server 8.8.8.8 8.8.4.4
 server id redundancy LAN

So as long as the interface is in standby, the DHCP server on this device is in a deactivated state. As soon as HSRP comes Active, the DHCP server works as expected in giving IPs to the clients. ALthough this is not really a delay, I can still achieve my goal in preventing the standby device from giving out IPs to the clients. I tested this in a LAB and it works great.

3
  • 1
    How do you keep the DHCP servers in sync, then? There should be a mechanism that will prevent one DHCP server from handing out duplicate/overlapping addresses. Commented May 7, 2021 at 13:09
  • This is a problem in that the two DHCP servers are not coordinated, and when you switch over, ta used address address could be passed out by the new DHCP server. You do not have real DHCP failover. From Cisco: "An example usage scenario is when two DHCP servers are set up to service the same network segment (subnet) for redundancy. If the two DHCP servers do not coordinate their services with each other using a protocol such as DHCP failover, then each DHCP server must be configured to allocate from a non-overlapping set of addresses in the shared subnet."
    – Ron Maupin
    Commented May 7, 2021 at 13:17
  • Your concerns are true and i intend to solve that with an external DHCP database but will have to do some more labbing on that. But this is a different topic. So the issue of keeping the servers in sync would be the same if i would be able to configure a delay on one DHCP server. So in a way, this server id redundancy is just a workaround for the delay issue.
    – Mario Jost
    Commented May 7, 2021 at 19:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.