DHCP for VLANs

5 pts.
Tags:
DHCP
DHCP Server Configuration
Router configuration
VLAN
How can I configure DHCP on router for multiple VLANs?
ASKED: January 28, 2010  12:11 PM
UPDATED: June 11, 2012  8:48 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

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

Discuss This Question: 5  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Yeahboy
    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 pointsBadges:
    report
  • SiThu
    Thanks Yeahboy, I make mistake in there. Yes it should be valid address, no network address or broadcast address.
    450 pointsBadges:
    report
  • Ccie7335
    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 pointsBadges:
    report
  • SiThu
    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 pointsBadges:
    report
  • Ihavesomedoubtnvlan
    i can not configure use different vlans in cisco packet tracer for dhcp.
    10 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following