5 pts.
 DHCP for VLANs
How can I configure DHCP on router for multiple VLANs?

Software/Hardware used:
ASKED: January 28, 2010  12:11 PM
UPDATED: June 11, 2012  8:48 AM

Answer Wiki:
I'm not sure what kind of router do you use, in the following example I will configure a cisco router for DHCP for vlans *First create the DHCP Pool for valn in the global configuration mode and add the address pool you want to apply <pre>Router(config)#ip dhcp pool vlan1 Router(dhcp-config)#network 192.168.1.0 255.255.255.0 Router(dhcp-config)#default-router 192.168.1.1 Router(dhcp-config)#dns-server 192.168.10.10 Router(dhcp-config)#ip dhcp pool vlan2 Router(dhcp-config)#network 192.168.2.0 255.255.255.0 Router(dhcp-config)#default-router 192.168.2.1 Router(dhcp-config)#dns-server 192.168.10.10 Router(dhcp-config)#ip dhcp pool vlan3 Router(dhcp-config)#network 192.168.3.0 255.255.255.0 Router(dhcp-config)#default-router 192.168.3.1 Router(dhcp-config)#dns-server 192.168.10.10 Router(dhcp-config)#exit</pre> *Second make sure define the exclude address for server or some devices <pre>Router(config)#ip dhcp excluded-address 192.168.1.1 192.168.1.25 Router(config)#ip dhcp excluded-address 192.168.2.1 192.168.2.20 Router(config)#ip dhcp excluded-address 192.168.3.1 192.168.2.50</pre> *Third go to the interface that connect with the (VTP domain/single)switch and open the interface <pre>Router(config)#int fa0/0 Router(config-if)#no shut Router(config-if)#exit</pre> *Fourth create the sub-interfaces and assign the address for each <pre>Router(config)#int fa0/0.1</pre>* the number behind the encapsulation dot1Q must be the same with the vlan's ID number <pre>Router(config-subif)#encapsulation dot1Q 1 Router(config-subif)#ip add 192.168.1.1 255.255.255.0 Router(config)#int fa0/0.2 Router(config-subif)#encapsulation dot1Q 2 Router(config-subif)#ip add 192.168.2.1 255.255.255.0 Router(config)#int fa0/0.3 Router(config-subif)#encapsulation dot1Q 3 Router(config-subif)#ip add 192.168.3.1 255.255.255.0</pre> And then make sure the connection between the switch and router used the t<b>runk by using spanning-tree protocol</b> ____________________________________________ UPDATED
Last Wiki Answer Submitted:  February 3, 2010  3:31 am  by  SiThu   450 pts.
All Answer Wiki Contributors:  SiThu   450 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

I would just like to edit something on the fourth step.. The ip address for each subinterfaces should be the one indicated on your dhcp pool because it will serve as your default gateway for your vlans.

*Fourth create the sub-interfaces and assign the address for each

Router(config)#int fa0/0.1*
the number behind the encapsulation dot1Q must be the same with the vlan's ID number
Router(config-subif)#encapsulation dot1Q 1
Router(config-subif)#ip add 192.168.1.0 255.255.255.0>ip add 192.168.1.1 255.255.255.0

Router(config)#int fa0/0.2
Router(config-subif)#encapsulation dot1Q 2
Router(config-subif)#ip add 192.168.2.0 255.255.255.0>ip add 192.168.2.1 255.255.255.0

Router(config)#int fa0/0.3
Router(config-subif)#encapsulation dot1Q 3
Router(config-subif)#ip add 192.168.3.0 255.255.255.0>ip add 192.168.3.1 255.255.255.0
 900 pts.

 

Thanks Yeahboy,

I make mistake in there. Yes it should be valid address, no network address or broadcast address.

 450 pts.

 

wrong, wrong, wrong! I was okay with the creation of the DHCP scopes. But the whole Interface, sub-interface stuff has to go. What you need to do is create your L2 and L3 VLANs next. I will make 3 for you below:

conf t

vlan 5,6,7

interface vlan 5
ip address 192.168.1.1 255.255.255.0

interface vlan 6
ip address 192.168.2.1 255.255.255.0

interface vlan 7
ip address 192.168.3.1 255.255.255.0

Now that this is done you can either assign the VLANs to individual ports or trunk these VLANs to another switch. Let me know what you want to do and I will configure that for you too.

 80 pts.

 

Dear Ccie7335

Is it ok if i could create vlan on global configuration mode and add the ip to vlan interface?
I don’t know this command really because I’m now only CCNA level not yet CCNP, CCIE.
But I hope Encapsulation dot1Q will work. If you have see some weekness/problem on encap dot1Q plaese tell me, I want to know.
Thanks for your advice.
SiThu

 450 pts.

 

i can not configure use different vlans in cisco packet tracer for dhcp.