Q&A-3Troubleshoot a VLAN access-port mismatch.
Answer
What I'd say first. Before touching config, I pin down two things: what the endpoint sends (tagged or untagged) and what the port is supposed to do with it. Almost every "VLAN mismatch" is one of those two being wrong. My assumption set: the endpoint is a normal PC or phone sending untagged frames, the port should be an access port in one VLAN, that VLAN exists and is active, and the uplink trunk carries it. If any of those is false, the diagnosis changes, so I state them out loud and check them in that order.
Mechanism. An access port has a PVID: the access VLAN. Every untagged frame that arrives is classified into that VLAN and forwarded tagged internally. The endpoint never sees a tag. So if the port's access VLAN is 20 but the endpoint's gateway and DHCP scope live in VLAN 30, the endpoint still gets a lease, just from the wrong subnet, and can't reach its gateway. That's the classic symptom: link is up, DHCP works, but the address is wrong or the gateway is unreachable. If the port is actually in trunk mode, untagged frames land in the native VLAN (default 1), which is a third wrong answer.
Worked trace (example figures). PC sends untagged DHCP DISCOVER → switch tags it with the port's access VLAN, say 20 → broadcast floods VLAN 20 → the SVI for VLAN 20 relays to the DHCP server → server offers 10.20.4.0/24. If the port is really in VLAN 30, the same DISCOVER is tagged 30, relayed from the VLAN 30 SVI, and the PC gets 10.30.4.0/24. The lease itself tells you which VLAN the port is actually in: that's the fastest single clue.
Commands, in order.
| Check | Command | What a mismatch looks like |
|---|---|---|
| Port mode + VLAN | show interfaces Gi1/0/5 switchport | Operational Mode: static access, Access Mode VLAN: 30 when you expect 20 |
| VLAN exists/active | show vlan brief | VLAN 20 missing or act/unsup |
| Uplink carriage | show interfaces trunk | VLAN 20 absent from the allowed/forwarding list |
| STP state | show spanning-tree interface Gi1/0/5 | Blocking/Alternate instead of Forwarding |
| Dynamic assignment | show authentication sessions interface Gi1/0/5 | 802.1X pushed a different VLAN than the static config |
| Port security | show port-security interface Gi1/0/5 | Secure-shutdown: err-disabled, link down |
| MAC learning | show mac address-table interface Gi1/0/5 | MAC learned in the wrong VLAN, or none |
Failure modes and how I detect each. Wrong access VLAN: endpoint gets a lease from the wrong subnet. Read the address, don't guess. Port left in trunk mode: untagged frames hit native VLAN 1, so the endpoint lands in VLAN 1; show interfaces switchport shows Operational Mode: trunk. VLAN not created or shut: show vlan brief shows it missing, and the port shows inactive. Uplink trunk not allowing the VLAN: local port looks perfect, but nothing crosses. show interfaces trunk on both ends. 802.1X dynamic VLAN overriding static config: the port flips VLANs after auth; compare show authentication sessions before and after. Port-security err-disable: link is down, not mis-VLANed. Different symptom, different fix (shutdown/no shutdown after clearing). STP blocking on a redundant path: intermittent, not constant.
Trade-offs. Static access VLAN is predictable and easy to audit; dynamic assignment via 802.1X scales for roaming users but makes "what VLAN is this port in" a runtime question, not a config question. Trunk-to-endpoint (rare, for a VM host) removes the access/native ambiguity but pushes tagging responsibility to the endpoint. I only chase DHCP relay or gateway issues after confirming the port's actual VLAN: otherwise I'm debugging the wrong layer.
Close. Compare against a known-good port on the same switch: same show interfaces switchport output, same VLAN, same trunk carriage. The diff is the answer.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.