How to create Inter-VLAN using single physical router interface

How to create Inter-VLAN using single physical router interface

This is instructions consists three components required to setup Inter-VLAN using a single physical router interface “router-on-the-stick”.

Step 1: Configure your router for the Inter-VLAN using F0/1

In this example, we are create VLANs consisting three Subnets of 192.168.2.0/26.

First Subnet: 192.168.2.0/26 -> First IP address 192.168.2.1, last IP address 192.168.2.62, Broadcast 192.168.2.63

Second Subnet: 192.168.2.64/26 -> First IP address 192.168.2.65, last IP address 192.168.2.126, Broadast 192.168.2.127

Third Subnet: 192.168.2.128/26 -> First IP address 192.168.2.129, Last IP address 192.168.2.190, Broadcast 192.168.2.191

Configure the first IP address of each network as a router sub interface.

Create a Sub Interface 1 for VLAN 1

R03#conf t
R03(config)#inter g0/1.1
R03(config-subif)#encapsulation dot1q 1
R03(config-subif)#ip address 192.168.2.1 255.255.255.192
R03(config-subif)#no shut
R03(config)#

Ensure the chosen interface is up.

R03#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R03(config)#inter f0/1
R03(config-if)#no shut

Create a Sub Interface 2 for VLAN 2

R03(config)#interface g0/1.2
R03(config-subif)#encapsulation dot1q 2
R03(config-subif)#ip address 192.168.2.65 255.255.255.192
R03(config-subif)#no shut
R03(config-subif)#exit
R03(config)#

Create a Sub Interface 3 for VLAN 3

R03(config)#interface g0/1.3
R03(config-subif)#encapsulation dot1q 3
R03(config-subif)#ip address 192.168.2.129 255.255.255.192
R03(config-subif)#no shut
R03(config-subif)#exit
R03(config)#exit
R03#

Note, we configured three router interfaces for VLAN 1, 2, 3 and assigned Host IP address of each sub network. Next we are going to configure the switch connecting to the router interface F0/1.

Step 2: Configure the Trunking port on the Switch connecting to the router and between teh switches

Create the three VLANs required on Switch #2:

SW02#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW02(config)#vlan 2
SW02(config-vlan)#name Servers
SW02(config-vlan)#exit
SW02(config)#vlan 3
SW02(config-vlan)#name PCs
SW02(config-vlan)#exit
SW02(config)#

Configure your management IP interface, typically VLAN 1 interface

SW03#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW02(config)#interface vlan 1
SW02(config-if)#ip address 192.168.2.2 255.255.255.192
SW02(config-if)#no shut
SW02(config-if)#exit
SW02(config)#

Issue show vlan command to ensure VLANS are configured properly.

SW02# Show vlan

Configure trunk on the switch port connecting to your router.

SW02#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW02(config)#inter f0/1
SW02(config-if)#switchport mode trunk
SW02(config-if)#switchport trunk allowed vlan all
SW02(config-if)#exit

See trunk ports details.

SW02#show interfaces trunk
Port Mode Encapsulation Status Native vlan
Fa0/1 on 802.1q trunking 1
Fa0/24 on 802.1q trunking 1

Ping each IP on the router interface to insure VLAN traffic is going to the router.

SW02#ping 192.168.2.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/1 ms

SW02#ping 192.168.2.65

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.65, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/1 ms

SW02#ping 192.168.2.129

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.129, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/1 ms

Configures port 24 of switch 3 as trunk port and allows VLAns 1, 2, and 3 to go through.

SW03#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW03(config)#interface f0/24
SW03(config-if)#switchport mode trunk
SW03(config-if)#switchport trunk allowed vlan 1,2,3
SW03(config-if)#exit
SW03(config)#

Configures port 24 of switch 2 as trunk port and allows VLAns 1, 2, and 3 to go through.

SW02#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW02(config)#interface f0/24
SW02(config-if)#switchport mode trunk
SW02(config-if)#switchport trunk allowed vlan 1,2,3
SW02(config-if)#exit
SW02(config)#

Configure VLANs and managment interface for Switch 3.
SW03(config)#vlan 2
SW03(config-vlan)#name Servers
SW03(config-vlan)#exit
SW03(config)#vlan 3
SW03(config-vlan)#name PCs
SW03(config-vlan)#exit
SW03(config)#

SW03(config)#interface vlan 1
SW03(config-if)#ip address 192.168.2.2 255.255.255.192
SW03(config-if)#no shut
SW03(config-if)#exit
SW03(config)#

Ping the router interfaces from switch 3.

Step 3: Assign each device port to its proper VLAN
See How To Add A Port To Vlan Cisco Switch

Publisher: abdirahman isse

Share this post