DHCP Server setup with Inter-VLAN Routing

Table of contents

If you want to understand a simple network, this is an example of an Inter-VLAN with a DHCP server using Packet Tracer.
On my way to learning networking and obtaining a certification, I need to understand and master basic concepts. That’s why I’m looking for lab exercises and examples online to fill that knowledge gap.
Software Required :
- We only need CISCO Packet Tracer
Step by Step Configuration Process
Step 1: Add Devices to the Workspace:
Open CPT
Select from End Devices and drag the devices you want onto the workspace
Add PC’s and a Server ( you can select how many pc’s you want, but next you have to configure)
From Network devices, drag a Switch (2960) and a Router (2911)
Step 2: Connect devices physically
Click in the cable and connect devices ( Straight through cable)
Take in consideration interfaces
Router (GigabitEthernet 0/0) to the Switch (FastEthernet 0/1).
Each PC to the Switch.
The Server to the Switch.
Step 3: Configure VLANs on the Switch
Click on the switch to open the configuration panel and select the CLI ( Command Line Interface)
To create VLANs we use the following steps :
Switch>enable #start switch config Switch#configure terminal Switch(config)# Switch(config)#vlan 10 #Enter VLAN you want to create Switch(config-vlan)#name Sales #Enter VLAN name Switch(config-vlan)#vlan 20 Switch(config-vlan)#name IT Switch(config-vlan)#vlan 30 Switch(config-vlan)#name HR
Now we have to assign VLANs to ports
Assign the PC’s to the respective VLANs
Switch(config)#interface range FastEthernet 0/2-5 Switch(config-if)#switchport mode access Switch(config-if)#switchport access vlan 10 Switch(config-if)#exit Switch(config)#interface range FastEthernet 0/6-10 Switch(config-if)#switchport mode access Switch(config-if)#switchport access vlan 20 Switch(config-if)#exit Switch(config)#interface range FastEthernet 0/11-15 Switch(config-if)#switchport mode access Switch(config-if)#switchport access vlan 30 Switch(config-if)#exit
Having the interfaces is time to config the Trunk port on the Router.
Configure TRUNK port for the Router
We have to configure the ports connected to the Router as Trunk ports
A trunk port on a router or switch is a network port configured to carry traffic for multiple VLANs over a single physical connection. It uses VLAN tagging, typically through the IEEE 802.1Q standard, to distinguish between the different VLANs as data travels across the network. Trunk ports are commonly used to connect switches to each other or to routers in setups where multiple VLANs need to be managed across devices, enabling efficient use of cabling and organized network segmentation.
Switch(config)#interface FastEthernet 0/1
Switch(config-if)#switchport mode trunk
Switch(config-if)#switchport trunk allowed vlan all
Step 4: Configure the Router for Inter-VLAN Routing
Click on the Router and go to configuration window and CLI to enter the configuration mode
Router>enable
Router#configure terminal
Router(config)#
Configure Sub-Interfaces for Each VLAN:
- For each VLAN,create a sub-interface with the VLAN ID and assign an IP addresses (gateway for each VLAN):
Router(config)#interface GigabitEthernet0/0.10 #Check interface
Router(config-if)#encapsulation dot1Q 10
Router(config-if)#ip address 192.168.10.1 255.255.255.0 #Always check addresses
Router(config-if)#exit
** check yoou are in the other config and out of before one **
Router(config)#interface GigabitEthernet0/0.20
Router(config-if)#encapsulation dot1Q 20
Router(config-if)#ip address 192.168.20.1 255.255.255.0
Router(config-if)#exit
"check yoou are in the other config and out of before one"
Router(config)#interface GigabitEthernet0/0.30
Router(config-if)#encapsulation dot1Q 30
Router(config-if)#ip address 192.168.30.1 255.255.255.0
Router(config-if)#exit
** Enable Interface **
Router(config)#interface GigabitEthernet0/0
Router(config-if)#no shutdown # Do not forget this step
** Save the configuration **
Router(config-if)# do wr
Step 5: Configure the DHCP Server
In this section we’re gonna config the DHCP Server
- Click in the server, go to configuration window, and config tab to assign Static IP Address to the server.
- Select FastEthernet0 on the left, and set the IP address to 192.168.10.2 and subnet mask to 255.255.255.0, also set Default Gateway as 192.168.0.1.
Enable the DHCP on the server.
Go to the Services and DHCP, enable DHCP server toggling “ON”
Configure DHCP Pool for each subnet in question
—— For VLAN 10 (Sales ) | —— For VLAN 20 (IT ) | —— For VLAN 30 (HR ) |
Pool Name : Sales | Pool Name : IT | Pool Name : HR |
Default Gateway: 192.168.10.1 | Default Gateway: 192.168.20.1 | Default Gateway: 192.168.30.1 |
Start IP Address: 192.168.10.10 | Start IP Address: 192.168.20.10 | Start IP Address: 192.168.30.10 |
Subnet Mask: 255.255.255.0 | Subnet Mask: 255.255.255.0 | Subnet Mask: 255.255.255.0 |
Maximum Users: 20 | Maximum Users: 20 | Maximum Users: 20 |
- Click on ADD after each pool to save the settings
Step 6: Configure DHCP Relay on the Router
We need to go back to the Router CLI and enter to the configuration mode terminal
Configure IP Helper on each VLAN sub-interface:
For VLAN 20:
Router(config)#interface GigabitEthernet0/0.20
Router(config-subif)#ip helper-address 192.168.10.2
Router(config-subif)#exit
For VLAN 30:
Router(config)#interface GigabitEthernet0/0.30
Router(config-subif)#ip helper-address 192.168.10.2
Router(config-subif)#exit
Step 7: Configure PCs to Obtain IP Addresses via DHCP
We need to configured each PC, go to DESKTOP tab, IP CONFIGURATION and select DHCP
Each PC should received an IP address from the correct subnet range based on the previous configured VLANs
Network Diagram
Verify configuration
In a PC go to CLI and type ipconfig /all to verify the assigned IP address
You also can test connectivity using ping to other PC ect…
Subscribe to my newsletter
Read articles from Isael Melendez directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Isael Melendez
Isael Melendez
Tech enthusiast , always learning IT field. ♦Cybersecurity Analyst and Cloud Computing student @ MDC | Banking Specialist ♦CodePath Intermediate Intern.