Cisco IOS DHCP IP pool assignment per VLAN
From The sin within
Contents |
Goals
To assign IP addresses via DHCP to computers based on the VLAN that requestor resides in
Prerequisites
- Good understanding on how DHCP works
- Fair understanding on how to use IOS CLI
Example and explanation
! ip dhcp excluded-address 10.20.30.1 ! ip dhcp pool Users network 10.20.30.0 255.255.255.0 default-router 10.20.30.1 dns-server 10.21.22.23 netbios-name-server 10.21.22.24 netbios-node-type h-node ! interface Vlan30 ip address 10.20.30.1 255.255.255.0 !
Explanation of the above example:
- First we made sure, that the IP address that we'll assign to the SVI will not be handed out via DHCP
- Second, we created a DHCP pool called Users and we assigned the network 10.20.30.0/24 to it
- Third, we've set some options such as: Default Gateway, DNS resolver and WINS server to the client
- Fourth, we created the Vlan 30 interface, and assigned the IP address of 10.20.30.1/24 to it
What's important
For this setup, you need to be aware that for the DHCP pool IP addresses to be handed out to the right clients, the IP address of the SVI should be an IP address inside a defined DHCP pool, as it's possible to create a DHCP pool for every SVI and assign addresses from it.
Notes
This was done on a WS-C6506-E running IOS (tm) s3223_rp Software (s3223_rp-IPBASEK9_WAN-M), Version 12.2(18)SXF3, RELEASE SOFTWARE (fc1)

