cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
50506
Views
1
Helpful
8
Replies

configure multiple dhcp pools on switch for multiple VLANs

harris.em
Level 1
Level 1

Is it possible to have multiple dhcp pools for multiple VLANs? The switch is a 6509 and/or 4506 catalyst. I don't want to use server-based products. Thanks in advance.

8 Replies 8

Ganesh Hariharan
VIP Alumni
VIP Alumni
Is it possible to have multiple dhcp pools for multiple VLANs? The
switch is a 6509 and/or 4506 catalyst. I don't want to use server-based
products. Thanks in advance.

You can check out the below link for configuration details:-

http://www.cisco.com/en/US/docs/ios/12_1/iproute/configuration/guide/1cddhcp.html#wp1000999

Hope to Help !!

Ganesh.H

FYI> This link does not work anymore -- 404

Reza Sharifi
Hall of Fame
Hall of Fame

Hi Harris,

Here is a sample config from a 3750 with multiple pools and multiple helper-addresses The same commands should be used on 6500 or 4500.

Switch-B(config)#do sh run | i dhcp
ip dhcp pool 20.20.20.0
ip dhcp pool 30.30.30.0
Switch-B(config)#do sh run int vlan 10
Building configuration...

Current configuration : 121 bytes
!
interface Vlan10
ip address 10.10.10.1 255.255.255.0
ip helper-address 20.20.20.1
ip helper-address 30.30.30.1
end

Switch-B(config)#

HTH

Reza

greenglyph
Level 1
Level 1

On our router, we do it like this (I'm not sure this applies to IOS switches, but it does work on our router):

  1. create subinterfaces configured with VLANs and IP addresses
  2. create DHCP pools with networks that contain the IP addresses of the VLAN subinterfaces

The router will then assign DHCP clients their addresses based on the interface VLAN/network that the request was recieved on

Here are some config snippets:

The interfaces (Step 1)

interface GigabitEthernet0/0                                                   

no ip address                                                                 

duplex auto                                                                   

speed auto                                                                    

!                                                                              

interface GigabitEthernet0/0.1                                                                                       

encapsulation dot1Q 1 native                                                         

ip address 192.168.1.254 255.255.255.0                                        

!                                                                              

interface GigabitEthernet0/0.2                                                                                        

encapsulation dot1Q 2                                               

ip address 192.168.2.254 255.255.255.0                                       

!                                                                              

interface GigabitEthernet0/0.3                                                                                        

encapsulation dot1Q 3                                                        

ip address 192.168.3.254 255.255.255.0

and here are the DHCP pools (Step 2)

ip dhcp pool Pool1                                                  

   network 192.168.1.0 255.255.255.0

   domain-name DOMAIN.COM                                                                                    

   dns-server 192.168.1.10                                                 

   default-router 192.168.1.254  


ip dhcp pool Pool2                                                
   network 192.168.2.0 255.255.255.0                                           
   domain-name DOMAIN.COM                                       
   dns-server 192.168.1.10                                                     
   default-router 192.168.2.254

ip dhcp pool Pool3                                               
   network 192.168.3.0 255.255.255.0                                           
   domain-name DOMAIN.COM                                       
   dns-server 192.168.1.10                                                     
   default-router 192.168.3.254
 
So, if a request comes in on VLAN 3, it will be handled by GigabitEthernet0/0.3, which has an IP of 192.168.3.254, on network 192.168.3.0, which is used in DHCP Pool3. So, the client will then be assigned an IP address from Pool3.
 
This should also work for entirely seperate interfaces, as opposed to subinterfaces.
Hope that helps.

Mohamed Sobair
Level 7
Level 7

Hi,

You can of course have multiple DHCP pools for multiple Vlans.

HTH

Mohamed

Hello,

I am also attempting to do the same configuration as above except all of the Subinterfaces are in the same VRF.  When I try to create multiple pools I receive the following error:

"% VRF USERNET is associated with pool DHCP-POOL1"

From what Ive been reading you can only have 1 DHCP Pool per VRF.  Is there any way around this?

Thanks.

Hello,

 

how are you configuring this ? I used the config below to associate multiple DHCP pools with the same vrf:

 

R1(config)#ip dhcp use vrf connected


hostname R1
!
vrf definition vrf1
rd 1:1
!
address-family ipv4
exit-address-family
!
ip dhcp excluded-address 192.168.10.1
ip dhcp excluded-address 192.168.20.1
ip dhcp excluded-address 192.168.30.1
ip dhcp excluded-address 192.168.40.1
!
ip dhcp pool LAN10
vrf vrf1
network 192.168.10.0 255.255.255.0
default-router 192.168.10.1
!
ip dhcp pool LAN20
vrf vrf1
network 192.168.20.0 255.255.255.0
default-router 192.168.20.1
!
ip dhcp pool LAN30
vrf vrf1
network 192.168.30.0 255.255.255.0
default-router 192.168.30.1
!
ip dhcp pool LAN40
vrf vrf1
network 192.168.40.0 255.255.255.0
default-router 192.168.40.1
!
interface GigabitEthernet0/0
vrf forwarding vrf1
ip address 192.168.10.1 255.255.255.0
duplex auto
speed auto
media-type rj45
!
interface GigabitEthernet0/0.30
encapsulation dot1Q 30
vrf forwarding vrf1
ip address 192.168.30.1 255.255.255.0
!
interface GigabitEthernet0/0.40
encapsulation dot1Q 40
vrf forwarding vrf1
ip address 192.168.40.1 255.255.255.0
!
interface GigabitEthernet0/1
vrf forwarding vrf1
ip address 192.168.20.1 255.255.255.0
duplex auto
speed auto
media-type rj45

Hello


@harris.em wrote:

Is it possible to have multiple dhcp pools for multiple VLANs? The switch is a 6509 and/or 4506 catalyst. I don't want to use server-based products. Thanks in advance.


Below is a example of dhcp pools using vrf on  SVI interfaces.

 

int vlan 10
ip address 10.1.10.254 255.255.255.0

int vlan 20
ip address 10.1.20.254 255.255.255.0

int vlan 30
ip address 10.1.30.254 255.255.255.0

int vlan 40
ip address 10.1.40.254 255.255.255.0


ip dhcp pool vlan10-20
vrf TEST
network 10.1.10.0 255.255.255.0
network 10.1.20.0 255.255.255.0 secondary
override default-router 10.1.20.254
default-router 10.1.10.254
lease 0 8


ip dhcp pool vlan30-40
vrf TEST
network 10.1.30.0 255.255.255.0
network 10.1.40.0 255.255.255.0 secondary
override default-router 10.1.40.254
default-router 10.1.30.254
lease 0 8

ip vrf TEST
ip dhcp use vrf connected <- when no helper addresses are required
ip dhcp use vrf remote <- when helper addresses are required


Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the community’s global network.

Kind Regards
Paul
Review Cisco Networking products for a $25 gift card