Sub topic 8
Limiting which VLANs a trunk carries
This chapter covers the allowed VLAN list on an 802.1Q trunk. It explains what the list does, how to change it safely, and how to troubleshoot it. It assumes you know how access ports and trunk ports work, what the 802.1Q tag contains, and the basic Cisco IOS command line.
Why a trunk should not carry everything
By default, a Cisco IOS trunk carries VLANs 1 through 4094. That default is convenient, but it has costs:
- Wasted bandwidth. Broadcasts, unknown-unicast floods and multicasts for a VLAN travel on every trunk that allows the VLAN. This happens even when nothing on the far side needs that traffic.
- Larger failure domain. A broadcast storm in one VLAN reaches every switch that carries it.
- Larger attack surface. A trunk that carries a VLAN can deliver traffic from it. Limiting VLANs reduces what a compromised or misconfigured device can reach.
- Less predictable design. If every trunk carries every VLAN, the diagram does not show where each VLAN really lives.
Limiting the VLANs on a trunk is called manual pruning. You decide which VLANs may cross each link, and the switch drops tagged frames for all others.
The allowed VLAN list
The allowed VLAN list is a per-trunk setting. A frame is only sent or accepted on a trunk if its VLAN ID is in the list. Frames for other VLANs are discarded at that port.
interface GigabitEthernet0/24
switchport mode trunk
switchport trunk allowed vlan 10,20The command above replaces the whole list. Only VLANs 10 and 20 cross this link.
The list accepts several forms:
| Command | Effect |
|---|---|
| `switchport trunk allowed vlan 10,20` | Sets the list to exactly VLANs 10 and 20 |
| `switchport trunk allowed vlan 10-20,30` | Sets a range plus a single VLAN |
| `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 50` | Sets the list to all VLANs except 50 |
| `switchport trunk allowed vlan all` | Restores the default of all VLANs |
| `no switchport trunk allowed vlan` | Also restores the default |
What the list does and does not affect
The allowed list filters user VLANs in both directions on the trunk. A few details matter:
- It is per port, per direction of use. Each end of a link has its own list. If one end allows VLAN 30 and the other does not, frames for VLAN 30 are dropped by the end that does not allow it. Always configure both ends identically.
- The native VLAN is filtered too. If you remove the native VLAN from the allowed list, untagged frames of that VLAN are no longer sent or accepted on that trunk. The port still stays a trunk. Some control protocols that depend on that VLAN may be affected, so test after the change.
- Control protocols still run. On Cisco switches, protocols such as CDP, VTP, PAgP and DTP are sent on VLAN 1 even when VLAN 1 is removed from the allowed list. Removing VLAN 1 does not stop these frames. Spanning tree is also still active for VLANs that the list excludes only in limited ways, so check the STP behavior of your platform before relying on it.
- Allowed does not mean active. A VLAN must also exist in the switch's VLAN database, and it must not be shut down. A VLAN that is in the allowed list but missing from the database is not forwarded.
Allowed, active and forwarding
A VLAN crosses a trunk only when several conditions are all true. The show interfaces trunk command lists them as separate sections, which makes it a good tool for finding which condition fails.
The show interfaces trunk output has four sections that map to these conditions:
- Port, mode, encapsulation, status and native VLAN. Confirms the port is trunking and shows its native VLAN.
- Vlans allowed on trunk. The configured allowed list.
- Vlans allowed and active in management domain. The allowed VLANs that also exist on this switch.
- Vlans in spanning tree forwarding state and not pruned. The VLANs that are really forwarding on this port.
A VLAN that appears in section 2 but not in section 3 usually has not been created on this switch. A VLAN that appears in section 3 but not section 4 is being blocked by spanning tree or pruned dynamically.
A worked example
Suppose two access switches, SW1 and SW2, connect to a distribution switch over trunks. SW1 serves VLAN 10 (USERS) only. SW2 serves VLAN 10 and VLAN 20 (SERVERS).
On the distribution switch, the uplink to SW1 should carry only VLAN 10:
interface GigabitEthernet0/1
description to SW1
switchport mode trunk
switchport trunk native vlan 999
switchport trunk allowed vlan 10
switchport nonegotiate
!
interface GigabitEthernet0/2
description to SW2
switchport mode trunk
switchport trunk native vlan 999
switchport trunk allowed vlan 10,20
switchport nonegotiateLater, a new VLAN 30 (PRINTERS) is created and one printer connects to SW2. VLAN 30 must be created on both switches that carry it and added to the SW2 trunk, at both ends:
vlan 30
name PRINTERS
!
interface GigabitEthernet0/2
switchport trunk allowed vlan add 30If you create VLAN 30 but forget the add on one end, the printer's frames reach the first switch and stop there. Hosts see this as a connectivity problem that is limited to one VLAN across one link.
Dynamic pruning versus manual pruning
Two things are called pruning, and they are different.
- Manual pruning is what this chapter describes. You edit the allowed list, and the result is fixed until you change it.
- VTP pruning is a feature of the VLAN Trunking Protocol. Switches tell their neighbors which VLANs have active ports, and trunks stop forwarding flooded traffic for VLANs with no interested downstream ports. It only applies when VTP is in use and pruning is enabled. VLANs 1 and 1002 to 1005 are never pruned.
VTP pruning reduces flooding but does not provide a security boundary. A port in the allowed list is still allowed, even if VTP pruning is currently keeping traffic off it. Many designs avoid VTP entirely (using VTP transparent mode or off) and rely on manual allowed lists because the result is easy to audit.
Checking your work
Use these commands after any change:
show interfaces trunk
show interfaces GigabitEthernet0/24 switchport
show vlan briefshow interfaces GigabitEthernet0/24 switchport shows the configured list under "Trunking VLANs Enabled". show vlan brief confirms that each VLAN exists and which access ports belong to it. Trunk ports do not appear in show vlan brief, because that command lists access ports only.
Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| One VLAN works on one switch, but not across the link | The VLAN is missing from the allowed list on one end | Add it on both ends with `allowed vlan add` |
| Everything stopped after a change | `allowed vlan N` was used instead of `allowed vlan add N` | Restore the list with `allowed vlan 10,20,N`, and use `add` in future |
| VLAN is in the allowed list but not in "allowed and active" | The VLAN does not exist on this switch | Create it with `vlan N` |
| VLAN is allowed and active but not forwarding | Spanning tree is blocking that VLAN on the port, or VTP pruning removed it | Check `show spanning-tree vlan N` and the VTP pruning state |
| Untagged traffic does not cross the trunk | The native VLAN was removed from the allowed list | Add it back or move the native VLAN to an allowed one |
Summary of design guidance
- Allow only the VLANs that need to cross each trunk.
- Use
addandremovefor changes on live links. - Configure both ends of a link the same way.
- Check all four sections of
show interfaces trunk, not only the allowed list. - Treat the allowed list as a traffic filter, and not as a replacement for correct native VLAN and negotiation settings.
Exercise
A trunk on a distribution switch carries VLANs 10, 20 and 30. An administrator runs switchport trunk allowed vlan 40 on this port to add a new VLAN 40. What happens, and what should the administrator have typed?
Show answer
The command replaces the whole list, so the trunk now carries only VLAN 40 and traffic for VLANs 10, 20 and 30 stops crossing the link. The administrator should have typed switchport trunk allowed vlan add 40, which keeps the existing VLANs and appends VLAN 40. The fix now is switchport trunk allowed vlan 10,20,30,40.
Exercise
On a switch, show interfaces trunk lists VLAN 30 under "Vlans allowed on trunk" but not under "Vlans allowed and active in management domain". Which condition is failing, and how do you correct it?
Show answer
VLAN 30 is allowed on the port, but it does not exist (or is not active) in this switch's VLAN database. Create it with vlan 30 in global configuration mode, and optionally give it a name. After that it should appear in the third section.