Use it when checking the VLAN, trunk, STP and MAC learning on an access or distribution switch.
Layer 2 Switch
A Layer 2 switch forwards Ethernet frames by MAC address within VLANs, learning source MACs per port, flooding unknown destinations, and using trunks and STP to connect to other switches.
1. A Layer 2 switch forwards frames by MAC within VLANs.
2. STP prevents loops.
3. Trunks carry VLANs.
4. EtherChannel bundles links.
5. Port security at the edge.
frame → VLAN → MAC lookup → forward
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
show mac address-tableShow Commands
Read-only Cisco show commands for confirming state, narrowing a fault and interpreting the current boundary.
How to read the output
show mac address-tableLook first: VLAN, MAC, type, learned interface
Healthy: Endpoint MAC is learned in expected VLAN/interface.
Warning: Missing, flapping or learned on unexpected interface/VLAN.
Does not prove: MAC learning does not prove ARP/IP routing or application reachability.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification and output interpretation Verify boundary
Verify VLAN existence, port mode, trunk allowed/active VLANs, MAC learning and STP state. A port being up/up does not show the intended VLAN or loop-free forwarding path exists.
Subtopics
Go one level deeper into this subject.
A switch learns MAC addresses by recording the source MAC and ingress port (per VLAN) of each frame in its MAC address table; unknown destinations are flooded and entries age out (300 s by default).
Subtopic VLANOn a Layer 2 switch, a VLAN is a separate broadcast domain: access ports belong to one VLAN, trunks carry many, and traffic between VLANs needs a router or Layer 3 switch.
Subtopic TrunkingTrunking carries several VLANs over one link by tagging frames with 802.1Q VLAN IDs; untagged frames belong to the native VLAN, which must match on both ends.
Subtopic STPOn a Layer 2 switch, Spanning Tree Protocol blocks redundant paths so the switched network has no loops while keeping backup links ready to forward if the active path fails.
Subtopic EtherChannelOn a Layer 2 switch, EtherChannel bundles several physical links into one logical port-channel, so STP sees one link and traffic is load-balanced across members by hashing.
- A Layer 2 switch forwards frames based on MAC addresses.
- It learns which MAC is on which port and floods unknown destinations.
- VLANs split it into separate broadcast domains.
show vlan brief— VLANsshow interfaces trunk— trunksshow spanning-tree summary— STPshow mac address-table— learning
ReferenceImportant terms & boundaries4 sections · depth on demand
In depth
The Layer 2 switch: forwarding by MAC address within VLANs
A Layer 2 switch learns which MAC address lives behind which port and forwards frames only where they need to go. Cisco's Catalyst 9300 interface guide defines its port types: access ports carry one VLAN with untagged traffic and drop tagged frames, while 802.1Q trunk ports carry multiple VLANs, by default all of VLANs 1–4094, unless an allowed list restricts them.
Switch functions
| Function | Effect |
|---|---|
| MAC learning | Source MAC and port recorded in the MAC address table |
| Forwarding | Known unicast to one port; unknown unicast, broadcast and multicast flooded in the VLAN |
| VLANs | Separate broadcast domains on the same hardware |
| Trunks | VLANs carried between switches with 802.1Q tags |
| STP | Blocks loops in redundant topologies |
| EtherChannel | Several links bundled into one logical link |
| Port security, DHCP snooping, DAI | Protect the access layer |
Defaults on a Catalyst 9300 (interface guide)
| Setting | Default |
|---|---|
| Mode | Layer 2 (switchport), dynamic auto |
| VLAN | VLAN 1 as access and native VLAN |
| Speed and duplex | Autonegotiate |
| Auto-MDIX | Enabled |
| PoE | Auto on PoE models |
| PortFast, storm control, port security | Disabled |
SW1(config)# interface GigabitEthernet1/0/5
SW1(config-if)# switchport mode access
SW1(config-if)# switchport access vlan 110
SW1(config-if)# spanning-tree portfast
SW1# show mac address-table interface GigabitEthernet1/0/5
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
110 5054.0012.3456 DYNAMIC Gi1/0/5
SW1# show interfaces GigabitEthernet1/0/5 switchport | include Mode|Access
Administrative Mode: static access
Operational Mode: static access
Access Mode VLAN: 110 (USERS)
Configuration practices
| Practice | Reason |
|---|---|
Set access ports explicitly with switchport mode access | Avoid DTP negotiation to a trunk |
| Don't use VLAN 1 for users | It's the default everywhere |
| Restrict allowed VLANs on trunks | Smaller broadcast domains, less exposure |
| PortFast and BPDU Guard on edge ports | Fast host connection, protection from rogue switches |
Documented example, not captured output.
Quick reference
A Layer 2 switch forwards frames by MAC address within VLANs, runs STP, supports trunks, port security, 802.1X, PoE and QoS marking. Management is via an SVI in a management VLAN with a default gateway (ip default-gateway when routing is off).
show vlan brief
show interfaces status
show mac address-table
show spanning-tree summary
Architecture/protocol mechanics and state model
A Layer-2 switch forwards Ethernet frames using VLAN membership plus the MAC address table while STP constrains active topology. Access/trunk state, MAC learning and STP role are independent pieces of forwarding evidence.
Limits and common misconceptions
A learned MAC does not show IP reachability; an STP forwarding port does not show the destination MAC is reachable; and a trunk up state does not show every intended VLAN is carried.
ReferenceConfiguration & state1 section · depth on demand
Design and configuration intent
Define VLAN ownership, access/trunk roles, native/allowed VLAN policy, EtherChannel/STP behavior and edge protections. Keep the Layer-2 boundary explicit rather than allowing accidental broadcast-domain extension.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Network Devices → Layer 2 Switch. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.cisco.com/c/en/us/support/ios-nx-os-software/ios-xe-17/series.html · confidence 94%Quick lookup tables
Layer 2 Switch · operational reference
Compact state/design/evidence reference for fast lookup.
| State | Meaning |
|---|---|
| VLAN membership | Broadcast-domain context |
| MAC table | Learned L2 location |
| Trunk | VLAN transport |
| STP | Loop-free active topology |