GuideSwitchingLayer 2

Ethernet Switching: How a Switch Learns and Forwards Frames

Understand how an Ethernet switch works internally: MAC tables, forwarding, flooding, broadcast domains, VLAN context, Layer 2 loops, and practical troubleshooting.

View all guidesReview Ethernet

What switching is and the problem it solves

Switching is the process by which an Ethernet switch receives a frame on one port and decides where that frame should be forwarded inside a Layer 2 network. Its job is not to choose an IP route between different networks. Instead, it moves Ethernet frames efficiently inside the Layer 2 domain associated with each interface.

A switch learns which MAC addresses are reachable behind its ports and uses that information to avoid sending every frame everywhere. This is one of the reasons a switched LAN scales far better than a repeater-based network: each full-duplex link can operate independently and known unicast traffic is sent only toward the port where the destination is expected.

Key idea: a switch primarily makes forwarding decisions with MAC addresses and VLAN context; a router makes Layer 3 decisions with IP prefixes and a routing table.

How a switch learns: the MAC table or FDB

When a frame enters a switch, the device examines the source MAC address and associates it with the ingress port and VLAN. This database is often called the MAC address table, CAM table, or more generally the Forwarding Database (FDB) in bridging terminology.

Learning is dynamic. If a host moves to another port, the association can change. If a MAC address is not seen for a period of time, its dynamic entry ages out. The FDB is not the same thing as an ARP cache. An ARP table maps IPv4 addresses to MAC addresses, while a switch FDB maps MAC addresses to Layer 2 forwarding ports inside a VLAN.

Destination stateWhat the switch knowsTypical action
Known unicast MACAn egress port is associated with the destinationForward only toward that port.
Unknown unicast MACNo usable destination entry existsFlood inside the VLAN except on the ingress port.
BroadcastThe frame is intended for the whole broadcast domainReplicate it inside the VLAN.

Forwarding, filtering, and flooding

With a known destination MAC, the switch performs forwarding toward the correct port. If the destination has been learned on the same port where the frame arrived, the switch can filter it because sending it back out that link would serve no purpose. If the destination unicast address is not present in the FDB, the switch uses unknown unicast flooding within that VLAN.

Flooding does not mean a modern switch always behaves like a hub. It is a specific behavior used for broadcasts and destinations that are not yet known. Once the destination answers, the switch can learn its source MAC and later frames can be forwarded selectively.

Collision domains and broadcast domains

In modern switched Ethernet, each full-duplex link is a separate point-to-point link rather than one shared medium, so the old idea of a single large collision domain no longer describes the LAN. This connects directly to the evolution of Ethernet: CSMA/CD mattered on shared and half-duplex media, but it does not govern a normal full-duplex switched link.

The broadcast domain still matters. Without logical segmentation, a Layer 2 broadcast may propagate through every relevant port in the same switched LAN. VLANs divide that infrastructure into multiple logical broadcast domains.

Store-and-forward and cut-through

Switches can use different internal forwarding strategies. With store-and-forward, the switch receives the entire frame before forwarding it and can verify the frame check sequence before sending the frame onward. With cut-through approaches, forwarding can begin before the whole frame has arrived, reducing latency but changing what can be validated before transmission.

Modern switching ASICs may use pipelines, shared or dedicated buffers, and hardware-specific optimizations, so a marketing label does not fully describe everything happening inside the device. For networking fundamentals, the essential point is that the switch examines Ethernet information and applies Layer 2 forwarding logic.

Microsegmentation, full duplex, and aggregate capacity

An access port connected to a single host creates a dedicated Ethernet link. When both ends operate correctly in full duplex, they can transmit and receive at the same time. A switch lets many of these links operate concurrently and transfers frames among them through its internal switching fabric.

This does not create unlimited bandwidth. Uplinks, interface speeds, switching-fabric capacity, and buffers still impose limits. If many access ports send toward one slower uplink, congestion can build, queues can fill, and frames can be dropped even though every individual access link is healthy.

Switching always has VLAN context

In a VLAN-aware network, MAC learning and forwarding happen within a logical VLAN context. A switch must not bridge traffic between different VLANs simply because it knows the destination MAC. The separation remains in place during learning and forwarding, and IEEE 802.1Q trunks are commonly used when several VLANs must share one physical link.

When two hosts belong to different VLANs, Layer 2 switching alone is not enough. Traffic must cross a Layer 3 boundary by using a router or multilayer switch. That is the conceptual boundary between Layer 2 segmentation and IP connectivity between subnets.

Why Layer 2 loops are dangerous

Physical redundancy is useful, but redundant links between switches can create loops. Ethernet frames do not carry an IP-style hop count that automatically expires, so broadcasts and some unknown unicasts can circulate repeatedly. The result may be a broadcast storm, duplicate frames, and constant instability in MAC learning.

Traditional Ethernet networks therefore use loop-control mechanisms such as STP and RSTP. These protocols build a loop-free logical topology while keeping redundant physical links available in case the active topology must change.

Access switches and multilayer switches

A Layer 2 switch focuses on bridging and VLANs. A multilayer switch also performs IP routing and can act as the default gateway for several VLANs through switched virtual interfaces. Enterprise designs often separate access, aggregation or distribution, and Layer 3 routing functions conceptually even when one physical platform can perform several of them.

A useful troubleshooting habit is to identify the unit being forwarded. A frame that stays inside one VLAN is handled at Layer 2; a packet that must move to another IP subnet requires a Layer 3 decision.

How to troubleshoot switching problems

Start with the physical link, speed and duplex, port VLAN, and MAC learning. Then verify whether the destination appears in the expected FDB and whether spanning-tree or a protection feature has placed a port in a non-forwarding state.

  • Is the physical link up?
  • Is the port assigned to the expected VLAN?
  • Does the switch learn the source MAC?
  • Is the destination MAC learned on another port?
  • Does a trunk actually carry the VLAN?
  • Has STP changed the forwarding state of a redundant link?

Working through those questions keeps you from jumping immediately to IP troubleshooting when the failure is still inside Ethernet or Layer 2 segmentation.

What to study after switching

Continue with VLANs to understand logical broadcast domains. Then study 802.1Q trunks, STP/RSTP, and link aggregation with LACP. Add Wi-Fi to see how wireless access connects back into the same switching and VLAN architecture.