DHCP Option in HSRP /VRRP

I'm configuring HSRP having scenario described in figure below. One gateway is active for one network and standby for other network and vice versa for other gateway. DHCP is configured on both Gateways and clients get automatic IPs. My question is if one Gateway (Switch A) is down other Gateway (Switch B) automatically becomes active for network for whome it is standby. Which DHCP option we need to configure on both Gateways DHCPs so that when Switch B is active and Switch a is down, and another client plugs in to network for which Switch A is active how come Switch B knows which IPs are allready assigned by Switch A and Switch B assign IPs to new clients other than IPs previously assigned by Switch A.


Solution 1:

DHCP discovery messages are broadcast on the local network and thus arrive on both gateways running a DHCP server. Both DHCP servers will send an offer and the client will accept one of these. Sometimes the client will accept an offer from the DHCP server runnin on switch A, sometimes it will accept an offer from the DHCP server running on switch B. As both DHCP servers do not exchange any information between each other, two different clients can be given the same IP addresses, one from swithc A and the other from switch B.

This all happens regardless of your HSRP or VRRP configuration. If you want two DHCP servers to be responsible for the same subnet and you want both to exchange lease information with each other you should look at more feature-rich DHCP servers, e.g. Kea from ISC. This will require you to configure IP helper addresses (DHCP relays) on the two switches.

A second option is to have switch A give out IP addresses from a certain range and switch B from a different range. For example, if the subnet is 192.168.1.0/24 then switch A can assign IP addresses from 192.168.1.10-128 and switch B can assign addresses from 192.168.1.129-254.

For better assistance you should share your HSRP/VRRP configuration and your DHCP server configuration.