Let us say I have a switch on which I have created two VLANs 10 and 20. I have set ports 1-10 to be on VLAN 10 and ports 11-20 to be on VLAN 20. Presently the PCs in both VLANs are configured with static IP addresses, I have SVIs on both VLANs on the switch and the PCs can ping each other in different VLANs and that all works. VLAN 10 PCs are on subnet and VLAN 20 PCs are on, with the SVI and PC default gateway being .1 on each network.

What I would like to do now is create two DHCP pools on the switch called POOL10 and POOL20 and for PC's connected to any of the VLAN10 ports to be assigned an IP address and other details from POOL10 and PCs connected to any of the VLAN20 ports to get their configuration from POOL20. But what I can't figure out, nor find in the documentation, is how to associate a DHCP pool with a particular VLAN on the switch.

I know I could use a separate PC running its own DHCP server on each VLAN but I would like to do this entirely on the switch (or a router using the DHCP helper feature) so that all the pools are administered in one place.

I've seen this question but it doesn't seem to apply in this scenario.

  • All DHCP pools are per-VLAN - or rather per-SVI -, associated by the scope address and the SVI IP address. Where is your problem? You might want to add your (sanitized) config to the question for us to see.
    – Zac67
    Nov 19, 2020 at 11:45
  • I feel I must be missing something obvious then, when I create the DHCP pool on the switch I do conf t then ip dhcp pool POOL10 and then I am in DHCP configuration mode but I'm not in VLAN nor interface modes? How would I say DHCP broadcasts received on a port in VLAN10 should be served from POOL10?
    – Gaius
    Nov 19, 2020 at 11:49
  • Do you mean that if I have SVI on VLAN 10 and create a DHCP pool POOL10 with addresses in then the switch will "know" those are for VLAN10 just because they are in the same network as that VLAN's SVI?
    – Gaius
    Nov 19, 2020 at 12:03

2 Answers 2

ip dhcp pool POOL10
ip dhcp pool POOL20

The dhcp agent knows which pool to use based on the source interface of the request. So, a request arriving on the SVI VLAN10 will get an address from POOL10. (and so forth)

When the DHCP server isn't in the same network, the dhcp relay agent adds gateway information so the server knows where the request originates. (also where to send the reply)

  • That's simpler than I thought it would be - thanks!
    – Gaius
    Nov 19, 2020 at 13:11
  • 1
    For Cisco... With HPE (Comware), one must explicitly assign pools to interfaces.
    – Ricky
    Nov 19, 2020 at 14:12

According to your requirement SVI 's are configured in layer3 multilayered switch that is virtual L3 interfàce by creating vlan 10 & 20

Now to ensure ip allocation dynamically to PCs . Dynamic host configuration protocol(DHCP) configuration is required on switch

Switch (config)# ip DHCP pool vlan10


Switch(config)#default gateway

Switch (config) ip DHCP excluded address X.X.X.X

Switch(config)#ip DHCP pool vlan 20


Switch(config)#defailt gateway 192.168 .20.1

Switch(config)# ip DHCP excluded adddress X.X.X.X

The above configuration will ensure that all pc connected in vlan 10 & 20 ip allocation dynamically.

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.