Pcornel
Browse topics
Options
Recent
Favorites
Networking · Technical reference

Layer 2 Switch

Direct answer

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.

When to use this

Use it when checking the VLAN, trunk, STP and MAC learning on an access or distribution switch.

First 30 seconds

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.

Operational verification

frame → VLAN → MAC lookup → forward

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
Cisco IOS / IOS XE
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformCisco IOS / IOS XE · Cisco IOS XE
Key commandshow mac address-table
Scope / prerequisiteUse it when checking the VLAN, trunk, STP and MAC learning on an access or distribution switch.
Show · 1
What next?3 suggested next steps
Child topics (this level)5
Catalog command links1
Evidence0
On this pageJump to a specific section
Verification

Show 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-table

Look 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.

Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

1 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

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.

Command lookup Jump straight to Cisco syntax
Drill down

Subtopics

Go one level deeper into this subject.

Key points
  • 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.
Key checks
  • show vlan brief — VLANs
  • show interfaces trunk — trunks
  • show spanning-tree summary — STP
  • show 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

FunctionEffect
MAC learningSource MAC and port recorded in the MAC address table
ForwardingKnown unicast to one port; unknown unicast, broadcast and multicast flooded in the VLAN
VLANsSeparate broadcast domains on the same hardware
TrunksVLANs carried between switches with 802.1Q tags
STPBlocks loops in redundant topologies
EtherChannelSeveral links bundled into one logical link
Port security, DHCP snooping, DAIProtect the access layer

Defaults on a Catalyst 9300 (interface guide)

SettingDefault
ModeLayer 2 (switchport), dynamic auto
VLANVLAN 1 as access and native VLAN
Speed and duplexAutonegotiate
Auto-MDIXEnabled
PoEAuto on PoE models
PortFast, storm control, port securityDisabled
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

PracticeReason
Set access ports explicitly with switchport mode accessAvoid DTP negotiation to a trunk
Don't use VLAN 1 for usersIt's the default everywhere
Restrict allowed VLANs on trunksSmaller broadcast domains, less exposure
PortFast and BPDU Guard on edge portsFast host connection, protection from rogue switches

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

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
Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

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
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docCisco IOS / IOS XE Current documentation reviewed 2026-09-14

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%
Embedded reference data

Quick lookup tables

Layer 2 Switch · operational reference

Compact state/design/evidence reference for fast lookup.

StateMeaning
VLAN membershipBroadcast-domain context
MAC tableLearned L2 location
TrunkVLAN transport
STPLoop-free active topology
Confirmation

Confirm action

Continue?