Link to home
Create AccountLog in
Avatar of lexmark1
lexmark1

asked on

DHCP WITH VLANS

I have 2800 cisco router with 2960 switch I want to create 7 vlans and want to use the router as dhcp can someone guide me step by step how to configure this.

Thanks for all
Avatar of Member_2_4839798
Member_2_4839798

A tip if you do not have 7 interfaces for each of your VLANS, you can use VLAN Encapsulation on an interface, and assign these gateway IP's to each encapsulated interface.
P.S Reading this material will really help you understand the steps required appose to just copy and pasting comments. If you get stuck just let me know.
Given the silence I have written and tested the below configs for you.

Router, based and working on a 2811 Router using interface 0/0.

hostname Router
!
!
!
!
!
ip dhcp pool VLAN11
 network 10.11.11.0 255.255.255.0
 default-router 10.11.11.1
ip dhcp pool VLAN12
 network 10.12.12.0 255.255.255.0
 default-router 10.12.12.1
ip dhcp pool VLAN13
 network 10.13.13.0 255.255.255.0
 default-router 10.13.13.1
ip dhcp pool VLAN14
 network 10.14.14.0 255.255.255.0
 default-router 10.14.14.1
ip dhcp pool VLAN15
 network 10.15.15.0 255.255.255.0
 default-router 10.15.15.1
ip dhcp pool VLAN16
 network 10.16.16.0 255.255.255.0
 default-router 10.16.16.1
ip dhcp pool VLAN17
 network 10.17.17.0 255.255.255.0
 default-router 10.17.17.1
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
 no ip address
 duplex auto
 speed auto
!
interface FastEthernet0/0.11
 encapsulation dot1Q 11
 ip address 10.11.11.1 255.255.255.0
!
interface FastEthernet0/0.12
 encapsulation dot1Q 12
 ip address 10.12.12.1 255.255.255.0
!
interface FastEthernet0/0.13
 encapsulation dot1Q 13
 ip address 10.13.13.1 255.255.255.0
!
interface FastEthernet0/0.14
 encapsulation dot1Q 14
 ip address 10.14.14.1 255.255.255.0
!
interface FastEthernet0/0.15
 encapsulation dot1Q 15
 ip address 10.15.15.1 255.255.255.0
!
interface FastEthernet0/0.16
 encapsulation dot1Q 16
 ip address 10.16.16.1 255.255.255.0
!
interface FastEthernet0/0.17
 encapsulation dot1Q 17
 ip address 10.17.17.1 255.255.255.0
!
interface FastEthernet0/1
 no ip address
 duplex auto
 speed auto
 shutdown
!
interface Vlan1
 no ip address
 shutdown
!
ip classless
!
!
!
!
!
!
!
line con 0
line vty 0 4
 login
!
!
!
end

Open in new window


Switch, based and working on a 2960

hostname Switch
!
!
!
interface FastEthernet0/1
 switchport mode trunk
!
interface FastEthernet0/2
!
interface FastEthernet0/3
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
 switchport access vlan 11
!
interface FastEthernet0/12
 switchport access vlan 12
!
interface FastEthernet0/13
 switchport access vlan 13
!
interface FastEthernet0/14
 switchport access vlan 14
!
interface FastEthernet0/15
 switchport access vlan 15
!
interface FastEthernet0/16
 switchport access vlan 16
!
interface FastEthernet0/17
 switchport access vlan 17
!
interface FastEthernet0/18
!
interface FastEthernet0/19
!
interface FastEthernet0/20
!
interface FastEthernet0/21
!
interface FastEthernet0/22
!
interface FastEthernet0/23
!
interface FastEthernet0/24
!
interface GigabitEthernet1/1
!
interface GigabitEthernet1/2
!
interface Vlan1
 no ip address
 shutdown
!
!
line con 0
!
line vty 0 4
 login
line vty 5 15
 login
!
!
end

Open in new window


Interface 0/1 is trunked to the routers 0/0 interface, interfaces 0/11-17 are using Vlan 11-17 based on port number.

I have tested this using 7 DHCP enabled clients successfully. Just copy and paste the config into your device after the "conf t" command.
Avatar of lexmark1

ASKER

Many thanks MichaelIanClaridge,

It works with me after I issued no shutdown command under interface 0/0.
But do I need to create vlans on the switch or not and how can prevent vlan11 talks to vlan12 because I don't want vlans talk to each other.

My appreciate.
Hey!

Yea sorry, no shut must have been missing.
The configs I gave you included 7 VLANS :)

As ports 11 to 17 are all on seperate VLANS there shouldn't be any inter VLAN comms.

All the best

MC
Oooops, that's incorrect! Sorry. Can't remember off the top of my head and I have man flu and can't think. Ill get back to you later if you haven't found a solution by then :)
Well if that is what you want, the easiest way is to remove the default gateways, you can copy and paste the below which will remove the default-router IP's.

hostname Router
!
!
!
!
!
ip dhcp pool VLAN11
 network 10.11.11.0 255.255.255.0
no default-router 10.11.11.1
ip dhcp pool VLAN12
 network 10.12.12.0 255.255.255.0
no default-router 10.12.12.1
ip dhcp pool VLAN13
 network 10.13.13.0 255.255.255.0
no default-router 10.13.13.1
ip dhcp pool VLAN14
 network 10.14.14.0 255.255.255.0
no default-router 10.14.14.1
ip dhcp pool VLAN15
 network 10.15.15.0 255.255.255.0
no default-router 10.15.15.1
ip dhcp pool VLAN16
 network 10.16.16.0 255.255.255.0
no default-router 10.16.16.1
ip dhcp pool VLAN17
 network 10.17.17.0 255.255.255.0
no default-router 10.17.17.1
!
!
!
!
!
!
!
!
!
!
!
!
!
interface FastEthernet0/0
 no ip address
 duplex auto
 speed auto
!
interface FastEthernet0/0.11
 encapsulation dot1Q 11
 ip address 10.11.11.1 255.255.255.0
!
interface FastEthernet0/0.12
 encapsulation dot1Q 12
 ip address 10.12.12.1 255.255.255.0
!
interface FastEthernet0/0.13
 encapsulation dot1Q 13
 ip address 10.13.13.1 255.255.255.0
!
interface FastEthernet0/0.14
 encapsulation dot1Q 14
 ip address 10.14.14.1 255.255.255.0
!
interface FastEthernet0/0.15
 encapsulation dot1Q 15
 ip address 10.15.15.1 255.255.255.0
!
interface FastEthernet0/0.16
 encapsulation dot1Q 16
 ip address 10.16.16.1 255.255.255.0
!
interface FastEthernet0/0.17
 encapsulation dot1Q 17
 ip address 10.17.17.1 255.255.255.0
!
interface FastEthernet0/1
 no ip address
 duplex auto
 speed auto
 shutdown
!
interface Vlan1
 no ip address
 shutdown
!
ip classless
!
!
!
!
!
!
!
line con 0
line vty 0 4
 login
!
!
!
end

Open in new window


Like I said previously I have created 7 VLANs on the switch, and encapsulated these on the router, just change the switchport assignments to add additional ports on the switch.

I hope this helps.

All the best.

MC
Thanks alot I was thinking about access list I did it works with me. But can I ask you how can I do this with mikrotik router not the 2800 cisco one.

My appreciate
ASKER CERTIFIED SOLUTION
Avatar of Member_2_4839798
Member_2_4839798

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer