06-06-2012 05:52 AM - edited 03-04-2019 04:35 PM
I would like to setup dhcp so it will assign ip addresses from different pools depending on which port it is connected to. The tricky part is all the dhcp ports need to be in the same subnet. For example half the ports gets an address from 172.16.1.2-20 and the other half recieve an address from a pool with the range of 172.16.1.21-40. Would I have to setup different vlans or is there a way of attaching pools to a set of ports?
06-06-2012 06:13 AM
Hello Joe,
you can only differentiate by putting the ports in different Vlans and having the DHCP pools mapped to different smaller IP subnets.
Until two ports are part of the same Vlan there is no reason for the network device to discriminate between them: a user connected to any of the two ports will get an IP address from the same DHCP pool.
By the way, you can discriminate based on the MAC address of the client NIC configuring a DHCP pool with only one IP address. In this way you can always assign the same IP address to the same PC.
Hope to help
Giuseppe
06-06-2012 06:20 AM
Hi Joe,
You can create dhcp pool for diffirent vlans:
just like any other IOS DHCP configs ...here is a sample config:
interface vlan 1
ip add 1.1.1.1 255.255.255.0
interface vlan 2
ip address 1.1.2.1 255.255.255.0
ip dhcp excluded-address 1.1.1.1 1.1.1.10
ip dhcp excluded-address 1.1.2.1 1.1.1.10
!
ip dhcp pool vlan1
network 1.1.1.0 255.255.255.0
domain-name cisco.com
dns-server 4.4.4.2 4.4.4.1
default-router 1.1.1.1
lease 3
!
ip dhcp pool vlan2
network 1.1.2.0 255.255.255.0
domain-name cisco.com
dns-server 4.4.4.2 4.4.4.1
default-router 1.1.2.1
lease 3
!
Here is the link for configuring IOS DHCP services:
Here i am attaching my own new test lab with 2 ports of a switch(Means 2 diff vlans) and 2 diff pool for the respective vlans.
check it :
Test_Lab diagram
Test_Router config
Test_switch config
Regards
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide