Sub topic 8
Limiting which VLANs a trunk carries
This chapter assumes you can configure access ports and a basic 802.1Q trunk, and that you know how a switch floods broadcast, unknown unicast and multicast frames. It covers the allowed VLAN list, which is manual pruning.
Why limit a trunk
By default, a Cisco IOS trunk allows VLANs 1 to 4094. The switch floods broadcasts for every VLAN that exists on it out of every trunk that allows that VLAN, even when nothing downstream uses it.
Limiting the list has three benefits:
- Less broadcast and unknown-unicast traffic crosses links that do not need it.
- A fault or broadcast storm in one VLAN stays off links that do not carry it.
- A VLAN that should not reach a device cannot reach it by accident.
The allowed VLAN list
The switchport trunk allowed vlan command sets which VLANs may cross the trunk. Frames from a VLAN that is not on the list are neither sent nor accepted on that port.
interface GigabitEthernet0/24
switchport mode trunk
switchport trunk allowed vlan 10,20This command is easy to misuse because it replaces the whole list. Use the keywords add, remove, except and none to change the list without retyping it.
| Command | Effect |
|---|---|
| `switchport trunk allowed vlan 10,20` | The list becomes exactly 10 and 20. |
| `switchport trunk allowed vlan add 30` | Adds VLAN 30 to the current list. |
| `switchport trunk allowed vlan remove 20` | Removes VLAN 20 from the current list. |
| `switchport trunk allowed vlan except 99` | Allows all VLANs except 99. |
| `switchport trunk allowed vlan none` | Allows no VLANs. |
Both ends must agree
The allowed list is set on each end of the link separately. If one switch allows VLAN 30 and its neighbor does not, the neighbor discards VLAN 30 frames, and hosts in that VLAN cannot cross the link. The trunk still shows as up, so nothing looks broken at the interface level.
Manual pruning
Limiting the allowed list on each trunk to the VLANs that need it is called manual pruning. A typical design looks like this:
- List which VLANs each access switch actually serves.
- Allow only those VLANs on its uplink, and on the distribution-side port that faces it.
- Allow the native VLAN, or any VLAN used for management, only where you need it.
- Keep the lists symmetric on both ends of every link.
Pruning changes which links flood a VLAN. It does not change the VLAN database. The VLAN still exists on the switch, and ports in it still work locally.
Checking the result
show interfaces trunkThe output has three lists for each trunk port. Read them together:
Vlans allowed on trunkis the list you configured.Vlans allowed and active in management domainis the allowed VLANs that exist in the switch's VLAN database.Vlans in spanning tree forwarding state and not prunedis the VLANs that are actually forwarding on this port.
If a VLAN appears in the first list but not the second, the VLAN has not been created on that switch. If it is in the second list but not the third, spanning tree is blocking it on this port or it is pruned.
Exercise
A trunk on GigabitEthernet0/24 currently allows VLANs 10 and 20. You run switchport trunk allowed vlan 30. Which VLANs does the trunk carry now, and which command should you have used to add VLAN 30?
Show answer
The trunk now carries only VLAN 30, because the command replaces the list. To keep 10 and 20 and add 30, use switchport trunk allowed vlan add 30.
Exercise
Hosts in VLAN 30 on Switch A cannot reach hosts in VLAN 30 on Switch B. The trunk between them is up and VLAN 30 exists on both switches. What do you check next?
Show answer
Run show interfaces trunk on both switches and compare the "Vlans allowed on trunk" lists. If VLAN 30 is missing from either end, add it with switchport trunk allowed vlan add 30 on that port.