Trunks and Inter-VLAN Communication
1. What is a trunk?
- A trunk is a link between two network devices (usually switches) that carries multiple VLANs simultaneously.
- Uses the 802.1Q protocol to identify which VLAN each frame belongs to.
Why?
It allows VLANs to remain separate while traveling over the same cable. Without trunking, only one VLAN could pass through a standard Ethernet cable.
2. Key concepts
802.1Q | VLAN encapsulation standard on a trunk |
Native VLAN | VLAN that passes over an untagged trunk |
Ruter-on-a-Stick | Inter-VLAN routing method with a single router using subinterfaces |
3. Configuring a Trunk on a Switch
interface fastethernet 0/24 |
Select an interface Access (config-if) mode |
switchport mode trunk | Activate the trunk mode |
switchport trunk allowed vlan 10,20,30 | Allow only VLANs 10,20,99 to access this trunk |
switchport trunk native vlan 99 | Set the native VLAN to identifier 99 |
show interfaces trunk |
4. Communication between VLANs
- By default, VLANs cannot communicate with each other.
- A router-on-a-stick uses a router configured with subinterfaces to enable inter-VLAN routing.
Basic configuration on a router
interface gigabitethernet 0/0.10 | |
encapsulation dot1Q 10 | |
ip address 192.168.10.1 255.255.255.0 | |
interface gigabitethernet 0/0.20 | |
encapsulation dot1Q 20 | |
ip address 192.168.20.1 255.255.255.0 |
Each subinterface corresponds to a specific VLAN.