Sub topic 14
Verifying and Troubleshooting VLANs and Trunks
This chapter assumes you can configure access ports, trunks, the native VLAN and allowed VLAN lists, and router-on-a-stick, as covered earlier. It also assumes you are comfortable with basic IOS show commands. Here you will build a repeatable method for checking a VLAN design and for isolating the faults that come up most often.
A layered method
Most VLAN faults sit at one of four places: the access port, the trunk, the Layer 3 gateway, or the host. Work from the bottom up and stop at the first check that fails.
- Port and VLAN state. Does the VLAN exist, and is the port in it?
- Trunk state. Is the link trunking, and does it carry the VLAN in both directions?
- Gateway. Does a subinterface or SVI exist for the subnet and respond?
- Host. Are the address, mask and default gateway correct?
Verifying VLANs and access ports
Start with the VLAN database and port membership.
show vlan brief
show interfaces GigabitEthernet0/24 switchport
show interfaces trunkA typical show vlan brief looks like this:
VLAN Name Status Ports
---- ---------- --------- ---------------------------
1 default active Gi0/3, Gi0/4
10 USERS active Gi0/1
20 SERVERS active Gi0/2
30 GUEST act/lshutRead the columns for these problems:
- A port is missing from every VLAN row. Trunk ports do not appear in
show vlan brief. An access port that is missing may be err-disabled, or it may be assigned to a VLAN that does not exist. - Status
act/lshutorsuspend. The VLAN exists but is shut down locally or suspended, so its ports cannot forward traffic. Re-enable it undervlan 30withno shutdownandstate active. - Status
inactiveon a port. On many platforms an access port assigned to a nonexistent VLAN shows as inactive. Some IOS versions create the VLAN automatically when you enter the command, so do not rely on that. Create the VLAN explicitly.
The command show interfaces <int> switchport separates configuration from reality. Compare Administrative Mode (what you configured) with Operational Mode (what the port is doing). If the administrative mode is trunk and the operational mode is static access, the link is not trunking.
Verifying trunks
show interfaces trunk is the most useful single command here. It prints four tables:
Port Mode Encapsulation Status Native vlan
Gi0/24 on 802.1q trunking 999
Port Vlans allowed on trunk
Gi0/24 10,20
Port Vlans allowed and active in management domain
Gi0/24 10,20
Port Vlans in spanning tree forwarding state and not pruned
Gi0/24 10The tables narrow a VLAN down in this order:
- Allowed on trunk. The result of
switchport trunk allowed vlan. - Allowed and active. The allowed VLANs that actually exist and are active on this switch.
- Forwarding and not pruned. The VLANs that spanning tree has not blocked on this port.
A VLAN that drops out between two tables tells you why traffic fails. In the example above, VLAN 20 is allowed and active but not forwarding. That points to spanning tree blocking the port for VLAN 20, to a native VLAN mismatch, or to a problem on the far switch. It does not point to the allowed list.
Run the same command on both ends of the link. Many trunk faults are asymmetric, so one side looks correct.
Common faults
| Symptom | Likely cause | Check | Fix |
|---|---|---|---|
| Host in VLAN 10 cannot reach anything, including the gateway | Port in the wrong VLAN, or VLAN missing or suspended | `show vlan brief` | Correct `switchport access vlan`, create or activate the VLAN |
| Hosts in the same VLAN on different switches cannot reach each other | VLAN not in the allowed list, or missing on the far switch | `show interfaces trunk` on both switches | Add the VLAN to the allowed list and create it on both switches |
| Trunk is not up, or one side shows `static access` | Mode mismatch, such as `trunk` on one side and `access` on the other | `show interfaces ... switchport` on both ends | Set `switchport mode trunk` on both sides |
| `%CDP-4-NATIVE_VLAN_MISMATCH` log message | Different native VLAN on each end | `show interfaces trunk` on both ends | Set the same native VLAN on both ends |
| Some VLANs work, others do not, across one trunk | Allowed list differs between the two ends | Compare allowed tables | Make the lists match |
| Intra-VLAN traffic works, inter-VLAN traffic does not | Gateway or routing fault | `show ip interface brief` on the router | Fix the subinterface, SVI or host gateway |
Native VLAN mismatch
If switch A sends untagged frames meaning VLAN 1 and switch B treats untagged frames as VLAN 999, the two switches silently merge those VLANs. Hosts may appear to work, but traffic leaks between VLANs and spanning tree may report errors. Cisco switches detect this through CDP and log a message. Fix it by setting the same native VLAN on both ends. Do not turn off the warnings.
Trunk mode mismatch
With DTP disabled by switchport nonegotiate, a port set to trunk will not form a working trunk with a neighbor set to access. The trunk side sends tagged frames that the access side drops, because the access port does not understand tags for other VLANs. When you disable negotiation, you must set the mode explicitly on both sides.
Pruned or disallowed VLAN
Changing the allowed list with the plain form switchport trunk allowed vlan 30 replaces the list. This is a classic outage: an engineer meant to add VLAN 30 and removed everything else. Use the add keyword instead:
interface GigabitEthernet0/24
switchport trunk allowed vlan add 30Router-on-a-stick faults
If hosts reach their own VLAN but not other VLANs, check these on the router:
- The physical parent interface has
no shutdown. Subinterfaces stay down if the parent is down. - Each
encapsulation dot1Q <id>matches the VLAN ID the switch uses. A wrong ID gives an up subinterface that never sees traffic. - The native VLAN subinterface, if used, has the
nativekeyword on theencapsulationline. Without it the router expects tagged frames. - The switch trunk allows every VLAN that the router serves.
show ip interface brief
show interfaces GigabitEthernet0/0.10
show running-config interface GigabitEthernet0/0.10For a Layer 3 switch using SVIs, an SVI stays down if no active port in its VLAN is up, or if the VLAN does not exist. Also confirm that ip routing is enabled on the switch.
Verifying on a host
On Linux you can confirm that the VLAN subinterface exists and has the right ID:
ip -d link show eth0.10
ip addr show eth0.10
ip routeTo confirm what is actually on the wire, capture on the parent interface, not the VLAN subinterface. The subinterface hides the tags.
sudo tcpdump -e -n -i eth0 vlan 10The -e option prints the link-level header, so you see vlan 10 on tagged frames. If you see traffic in the wrong VLAN, or no tagged traffic at all, the fault is between the host and the first switch. If frames arrive untagged when you expect tags, the port is probably an access port, or the VLAN is the native VLAN.
To test tag handling from a lab host, you can parse a captured frame with the helper below, which reads the tag fields directly:
import struct
def parse_dot1q(frame: bytes):
"""Return the 802.1Q fields of an Ethernet frame, or None if it is untagged."""
tpid, tci = struct.unpack("!HH", frame[12:16])
if tpid != 0x8100:
return None
return {
"pcp": tci >> 13,
"dei": (tci >> 12) & 0x1,
"vid": tci & 0x0FFF,
}Edge cases to remember
- Config looks right but the port is down. Check
show interfaces statusforerr-disabledbefore you chase VLAN settings. - The VLAN database is per switch. Trunks carry tagged frames, but a switch with no VLAN 20 defined drops or ignores frames tagged for it, unless something like VTP propagates the VLAN.
- MAC address table.
show mac address-table vlan 10shows whether the switch has learned the host's MAC on the expected port in the expected VLAN. A MAC learned on the wrong port or VLAN reveals the misconfiguration quickly. - MTU. A tag adds 4 bytes. If large frames are lost while small pings work, check the maximum frame size on every link in the path.
- Test in order. Ping the local gateway first, then a host in another VLAN, then a remote network. Each result narrows the failing layer.
Exercise
Hosts in VLAN 20 on switch A cannot reach hosts in VLAN 20 on switch B. VLAN 10 works across the same trunk. show vlan brief shows VLAN 20 active on both switches. What would you check next, and what is the most likely cause?
Show answer
Run show interfaces trunk on both switches and compare the "allowed on trunk" tables. The most likely cause is that VLAN 20 is missing from the allowed list on one end, for example after someone entered switchport trunk allowed vlan 10 without the add keyword. If the VLAN is allowed and active on both ends but missing from the forwarding table, check spanning tree and the native VLAN on both ends.
Exercise
A router subinterface Gi0/0.30 is up/up with the correct IP address, but hosts in VLAN 30 cannot ping their gateway. Name two checks on the router and one on the switch.
Show answer
On the router, confirm that encapsulation dot1Q 30 matches the VLAN ID and that the parent interface Gi0/0 is not shut down. On the switch, run show interfaces trunk and confirm that VLAN 30 is in the allowed list, active, and forwarding on the port that faces the router.