Shiva's Blog

VLAN Routing

VLAN Routing

Many networks are segmented using the VLAN feature of managed switches. Traffic between VLANs must be routed. There are various ways to accomplishing this.

Methods of VLAN routing:

Subinterfaces:

Switch Virtual interfaces:

Configuration:

VLAN 16 PC6 -> 192.168.0.2/24 PC7 -> 192.168.0.3/24 PC8 -> 192.168.0.4/24

VLAN 32 PC3 -> 192.168.1.2/24 PC4 -> 192.168.1.3/24 PC5 -> 192.168.1.4/24

Switch (SW1) configuration: Access VLAN: FastEthernet 0/1-0/3 VLAN 16 FastEthernet 0/4-0/6 VLAN 32

Trunk VLAN: GigabitEthernet 0/1 —> VLAN 16, VLAN 32

Router (R1) configuration:

g0/0/0.16 VLAN 16 192.168.0.1 g0/0/0.32 VLAN 32 192.168.1.1

Subinterface

Subinterface


SW1 configuration:

#vlan 16
#name tech
#interface range FastEthernet 0/0-3
#switchport mode access
#swtichport access VLAN 16

#vlan 32
#name office
#interface range FastEthernet 0/4-6
#switchport mode access
#switchport access VLAN 32

#interface GigabitEthernet 0/1
#switchport mode trunk
#switchport trunk allowed VLAN 16,32

R1 configuration:
#interface g0/0/0.16
#encapsulation dot1q 16
#IP address 192.168.0.1 255.255.255.0
#no shut
#interface g 0/0/0.32
#encapsulation dot1q 32
#IP address 192.168.1.1 255.255.255.0
</code>

download the packet tracert lab file: (https://github.com/d-cva/d-cva.github.io/blob/master/assets/labs/vlanrouting-subinterface.pkt)