0

I have 2 layer 3 switches DS1 and DS2. There are the same VLANs but different IP addresses on VLAN interfaces.

On DS1:
VLAN 10: 192.168.10.1/24
VLAN 20: 192.168.20.1/24
On DS2:
VLAN 10: 192.168.10.2/24
VLAN 20: 192.168.20.2/24

Both of them have DHCP pools to provide IP addresses for devices but different in default-router.

On DS1:
DHCP pool 10: default-router 192.168.10.1
DHCP pool 20: default-router 192.168.20.1
On DS2:
DHCP pool 10: default-router 192.168.10.2
DHCP pool 20: default-router 192.168.20.2

I want DS1 is active and DS2 is standby so I set standby priority on DS1 is 120 and on DS2 is default (100). Can someone tell me why devices receive IP addresses from DS2 while DS1 is active? I think it only happens when DS1 goes down. I tried to reset network but it still received IP addresses from DS2 (default-router is .2 instead of .1).

enter image description here

2
  • 1
    With HSRP you'd use the virtual IP address as (default) gateway, not one of the static ones..
    – Zac67
    Commented May 13, 2023 at 6:41
  • 1
    Because DHCP doesn't know jack about HSRP. If you put multiple DHCP servers on a network - and you have - which ever one the client sees first is the one it will use. If you want redundant DHCP, you'll need proprietary software that supports that.
    – Ricky
    Commented May 14, 2023 at 19:16

1 Answer 1

3

You haven't mentioned the equipment in use and you have not said clearly that the layer 3 switch is acting as the DHCP server but you seem to indicate that is the case.

I can be pretty sure that in most implementations the DHCP server on any switch or router is not aware of the state of the HSRP or similar standby protocol. The DHCP server should be configured to always give out the same gateway IP address regardless of which switch interface is 'active' in HSRP and which is standby. Each DHCP server also needs to either be aware of each other via some kind of DHCP snooping configuration or need to be configured to give out different ranges of IP addresses in the same network (one switch has a pool of 192.168.10.10-100 and the other has the pool of 192.168.10.101-200, for example) so they do not try to assign an IP address that may have already been offered by the other switch.

The ideal solution would be to use a separate DHCP implementation that is independent of the switches completely such as a separate server or cluster of servers that provide a redundant DHCP service. But regardless, the gateway for each pool should always be configured to be the active IP address in the HSRP configuration. It should not be an IP address unique to a specific interface of one switch or the other.

2
  • Thankyou, @FrameHowitzer . I'm using 2 layer 3 switches for backup purpose as in the figure that I just added. According to your advice, I'm going to configure "to give out different ranges of IP addresses in the same network" and "the gateway for each pool should always be configured to be the active IP address in the HSRP configuration". Am I understanding correctly?
    – Penguin
    Commented May 13, 2023 at 4:48
  • 1
    Yes, that is correct. The DHCP servers on the switches should use pools that do not overlap but are part of the same network and should always give out the same default gateway address. Commented May 13, 2023 at 14:30

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.