The 802.1Q tag
- A trunk inserts 4 bytes after the source MAC, in every frame except the native VLAN's.
- 12 bits of VLAN ID: 4096 values, of which 0 and 4095 are reserved.
- PCP is the 3-bit priority used for QoS marking (CoS).
Two switches, a router, five PCs and an IP phone. Build the VLANs, access ports and the trunk between the switches, predict what breaks when a setting is wrong, then drill the show output.
Call it first. This setup loads on the network as soon as you answer.
Drill · simulated output
Simulated: the switches, router, addresses (10.1.x.x, documentation-style private space) and console output are Loopback's simulation of Catalyst switches and an IOS router, not real devices.
The numbers, orders and commands the network runs on. Cover a column and say it before you look.
A VLAN has to exist on each switch to be forwarded there. Assigning a port to a missing VLAN creates it; deleting a VLAN leaves its ports inactive.
| Port | Carries | On the wire |
|---|---|---|
| Access | One data VLAN | Untagged |
| Voice | Data VLAN + voice VLAN | PC untagged, phone tags voice |
| Trunk | Many VLANs | 802.1Q tagged, native untagged |
Check the port with show interfaces gi1/0/1 switchport: Administrative Mode is what you set, Operational Mode is what it's doing.
encapsulation dot1Q 99 native.allowed vlan 10,20 | Replaces the list |
|---|---|
allowed vlan add 30 | Appends |
allowed vlan remove 20 | Takes one out |
allowed vlan except 99 | All but these |
allowed vlan all / none | Everything / nothing |
show interfaces trunk lists allowed, then allowed and existing, then actually forwarding.
| This end | Far end | Result |
|---|---|---|
| trunk | trunk | Trunk |
| trunk | dynamic auto | Trunk |
| dynamic auto | dynamic auto | Access |
| trunk | access | Broken: the access side blocks |
Set both ends to switchport mode trunk and you never depend on negotiation.
| Option | Gateway lives on | Switch side | Watch out for |
|---|---|---|---|
| Router, one port per VLAN | Each physical interface | One access port per VLAN | Runs out of ports fast |
| Router on a stick | Subinterfaces: encapsulation dot1Q 10, then the IP | One trunk | Physical port left shutdown; wrong tag; access port toward the router |
| Layer 3 switch | SVIs: interface vlan 10, IP, no shutdown | Nothing extra | Needs ip routing; an SVI is down until its VLAN has an up port |
vlan 10 name USERS interface gi1/0/1 switchport mode access switchport access vlan 10 switchport voice vlan 30 interface gi1/0/24 switchport mode trunk switchport trunk native vlan 99 switchport trunk allowed vlan 10,20,30 ip routing interface vlan 10 ip address 10.1.10.1 255.255.255.0 no shutdown
interface gi0/0 no shutdown interface gi0/0.10 encapsulation dot1Q 10 ip address 10.1.10.1 255.255.255.0 interface gi0/0.20 encapsulation dot1Q 20 ip address 10.1.20.1 255.255.255.0 interface gi0/0.99 encapsulation dot1Q 99 native
show vlan brief show vlan id 10 show interfaces trunk show interfaces gi1/0/1 switchport show interfaces status show ip interface brief show running-config interface gi1/0/24
All of these work in the network's consoles, along with interface range gi1/0/1 - 2 and do from config mode.