How to configure multiple dhcp for different vlans in Cisco Packet Tracer

In this LAB, I am going to share with us on how to configure DHCP servers for VLANs in router on a stick scenario. Three sub-interfaces will be created on the router, each representing a VLAN, with each sub-interface having a dhcp server configured to handle IP address leasing to hosts in that VLAN. Though I have treated VLAN setup before, find it here, to ensure that everyone is carried along, this LAB will include vlan creation.

Network topology

dhcp for vlans

Objective:

The objective of this Lab is to configure multiple dhcp servers for vlans on the router to service hosts in different vlans. We will start by configuring sub-interfaces with 802.1q encapsulation on the router and the assignment of IP addresses from different subnets to the sub-interfaces. Then we go over to the switch and create vlans. Finally, we will wrap things up with the configuration of dhcp servers for vlans on the router. Hosts in a vlan will acquire IP addresses from a dhcp server configured for that vlan.

Sub-interface configuration and IP address assignment on the router

Router>en

Router#conf t

Router(config)#int f0/0

Router(config-if)#no ip add

Router(config-if)#no shut

Router(config-if)#int f0/0.10

Router(config-subif)#en dot1q 10

Router(config-subif)#ip add 192.168.10.1 255.255.255.0

Router(config-subif)#desc vlan10_subinterface

Router(config-if)#int f0/0.20

Router(config-subif)#en dot1q 20

Router(config-subif)#ip add 192.168.20.1 255.255.255.0

Router(config-subif)#desc vlan20_subinterface

Router(config-if)#int f0/0.30

Router(config-subif)#en dot1q 30

Router(config-subif)#ip add 192.168.30.1 255.255.255.0

Router(config-subif)#desc vlan30_subinterface

 

You may also like: Why vlan1 should not be used as your native vlan

 

Create vlans and assign ports to vlan on the switch

 

Switch>en

Switch#conf t

Switch(config)#vlan 10

Switch(config-vlan)#name sales

Switch(config-vlan)#vlan 20

Switch(config-vlan)#name account

Switch(config-vlan)#vlan 30

Switch(config-vlan)#name IT

Switch(config-vlan)#exit

Switch(config)#

Add ports to Vlans

Switch(config)#int f0/1

Switch(config-if)#sw mode trunk

Switch(config-if)#int range f0/2 -3

Switch(config-if-range)#sw mode access

Switch(config-if-range)#sw access vlan 10

Switch(config-if-range)#int range f0/4 -5

Switch(config-if-range)#sw mode access

Switch(config-if-range)#sw access vlan 20

Switch(config-if-range)#int range f0/6 -7

Switch(config-if-range)#sw mode access

Switch(config-if-range)#sw access vlan 30

Switch(config-if-range)#

Create dhcp servers for vlans on the router

Router>en

Router#conf t

Router(config)#ip dhcp pool vlan10

Router(dhcp-config)#network 192.168.10.0 255.255.255.0

Router(dhcp-config)#default-router 192.168.10.1

Router(dhcp-config)#dns-server 8.8.8.8

Router(dhcp-config)#exit

Router(config)#ip dhcp excluded-address 192.168.10.1

Router(config)#ip dhcp excluded-address 192.168.10.255

Router(config)#

Router(config)#ip dhcp pool vlan20

Router(dhcp-config)#network 192.168.20.0 255.255.255.0

Router(dhcp-config)#default-router 192.168.20.1

Router(dhcp-config)#dns-server 8.8.8.8

Router(dhcp-config)#exit

Router(config)#ip dhcp excluded-address 192.168.20.1

Router(config)#ip dhcp excluded-address 192.168.20.255

Router(config)#

Router(config)#ip dhcp pool vlan30

Router(dhcp-config)#network 192.168.30.0 255.255.255.0

Router(dhcp-config)#default-router 192.168.30.1

Router(dhcp-config)#dns-server 8.8.8.8

Router(dhcp-config)#exit

Router(config)#ip dhcp excluded-address 192.168.30.1

Router(config)#ip dhcp excluded-address 192.168.30.255

Router(config)#

 

That’s it guys. At this state, all that is left is to go to the computers in various vlans and set them to acquire IP addresses automatically.

 

 

 

 

Spread the love

2 thoughts on “How to configure multiple dhcp for different vlans in Cisco Packet Tracer”

Leave a Comment