An Ethernet switch works by learning the MAC address behind every port, storing those addresses in a content-addressable memory table, and forwarding each incoming frame only out the port that leads to its destination. When the destination is unknown, it floods the frame to all ports except the source. This is why a switch sends traffic only where it belongs, while a hub repeats every frame to every device.

The core idea is deceptively simple: a switch is a self-building map of your network. Every frame that arrives teaches it something, and every forwarding decision consults what it has already learned. The engineering that makes this happen at line rate, across dozens of ports, without slowing your traffic, is where the depth lives.

The forwarding pipeline: learning, lookup, and decision

A switch receives a frame on a port and immediately reads two fields: the source MAC address and the destination MAC address. It records the source address and the port it arrived on in its MAC address table, sometimes called a forwarding database (FDB). Then it looks up the destination.

Three outcomes are possible. If the destination is known and sits on a different port, the switch forwards the frame to that single port. If the destination is known and sits on the same port the frame came from, the switch filters it, dropping the frame because the two devices can already talk directly. If the destination is unknown, or is the broadcast address, the switch floods the frame to every port except the one it arrived on.

This is the mechanism that separates a switch from a hub. A hub is a repeating electrical device: a signal arriving on one port is regenerated onto all others, and every device shares one collision domain. A switch terminates each cable into its own collision domain and makes a forwarding decision per frame. That decision is what lets twenty devices on one switch run at full duplex simultaneously.

The lookup itself is a hardware trick. The MAC table is stored in a content-addressable memory (CAM), a chip that compares an incoming 48-bit address against every stored entry in parallel rather than stepping through a list. A typical access switch holds 8,000 to 16,000 MAC entries; a data-center model may hold 32,000 to 128,000 or more. Lookups complete in a few hundred nanoseconds, fast enough to keep up with every port at once.

One detail worth holding onto: a switch forwards based on the destination MAC, not the IP address. It does not know or care what protocol rides inside the frame. That indifference is why a switch is called Layer 2, and why it can carry IPv4, IPv6, and anything else without configuration.

Why flooding and aging matter: the quantified picture

Flooding looks wasteful, and in a sense it is, but it is also self-correcting. When a frame with an unknown destination is flooded, the destination device replies, and that reply carries its source MAC address. The switch learns it. The next frame to that device is forwarded, not flooded. In a healthy network, unknown-unicast flooding settles within seconds of a device appearing.

Entries do not live forever. A switch ages out MAC entries that have not been seen for a set period, typically 300 seconds (five minutes) by default on many enterprise switches, with configurable ranges often spanning 60 to 1,000 seconds. Aging prevents the table from filling with stale entries when devices move or disconnect. When a device changes ports, its old entry points to the wrong port until it either ages out or the device sends a frame from its new location, which updates the entry immediately.

Scale puts the mechanism in context. A 24-port access switch serving 24 devices holds at most 24 active MAC entries, a fraction of its table. A campus distribution switch aggregating 40 access switches of 48 ports each might see 1,920 endpoints, still within a mid-range table. Problems appear at the edges: virtualization hosts can present dozens of MAC addresses per physical port, and a table that fills forces the switch into a mode where new addresses cannot be learned, causing sustained flooding.

Bandwidth figures sharpen the comparison. A 24-port gigabit switch has 48 Gbps of aggregate port capacity (24 ports times 1 Gbps, counted once per direction), and a non-blocking design provides a switching fabric that can carry that full capacity simultaneously on every port. A hub, by contrast, gives all 24 devices a shared 1 Gbps, and collisions divide it further. The switch does not create bandwidth; it stops devices from stealing it from each other.

Where the simple model breaks: edge cases

The learning-switch model assumes a tidy tree. Real networks violate that assumption in ways that produce visible failures.

Broadcast storms are the classic. Because broadcast frames are flooded to every port, a loop between two switches creates a broadcast that circulates forever, multiplying until the network saturates. Spanning Tree Protocol (STP) exists to break loops by blocking redundant ports, and modern variants such as Rapid STP converge in seconds rather than the 30 to 50 seconds of original STP. Without loop protection, a single miswired cable can take down a floor.

Unknown-unicast flooding has a subtler failure mode. If a device goes silent for longer than the aging timer, its MAC entry expires, and traffic to it floods until it speaks again. On a busy network this is harmless; on a network with asymmetric routing or one-way traffic patterns, a device can receive a steady flood of traffic it never answers, consuming bandwidth indefinitely.

MAC table exhaustion is the third. An attacker or a misbehaving virtual host can generate frames with thousands of fake source addresses, filling the CAM table. Once full, the switch cannot learn new addresses and floods everything, which is both a performance problem and a surveillance opportunity, since every port then sees traffic it should not. Port security features that cap MAC addresses per port exist precisely to bound this risk.

There is also a counterintuitive case: a switch can be too helpful. Some switches learn from any frame, including frames with forged source addresses. A device that spoofs another device's MAC can redirect traffic intended for the victim. This is why managed switches offer static MAC entries and why port-level authentication exists.

Misconceptions worth correcting

The most common misconception is that a switch "routes" traffic. It does not. A switch forwards frames within one broadcast domain; a router moves packets between networks. A Layer 3 switch blurs the line by performing routing in hardware, but the underlying forwarding decision for plain Ethernet traffic is still a MAC lookup.

The second is that a switch improves internet speed. It does not touch your connection to the provider. What it improves is local traffic: two devices on the same switch can exchange data at full port speed without competing with anything else. Your broadband rate is set by the link to your ISP, which the switch never sees.

The third is that more ports means more bandwidth per device. Aggregate capacity and per-device bandwidth are different numbers. A 48-port gigabit switch gives each port 1 Gbps in each direction, full duplex, and the fabric is sized to carry all of them at once, but no single device gets more than its port speed.

The professional caveat: unmanaged switches are not "set and forget" in every environment. They work well at home and in small offices, but they offer no VLANs, no loop protection, no port mirroring, and no visibility into the MAC table. In a network where loops or misbehaving devices are possible, the lack of those controls turns a cheap fix into an expensive outage.

Comparison: switch types and what they buy you

Type Forwarding basis Typical ports Management Best fit
Unmanaged switch MAC table, no config 5 to 24 None Home, small office
Smart/managed L2 switch MAC table, VLANs, STP 8 to 48 Web or CLI Small to mid business
Layer 3 switch MAC plus IP routing 24 to 48 Full CLI Campus distribution
PoE switch MAC table plus power delivery 8 to 48 Varies Cameras, phones, access points
Data-center switch MAC table, high fabric 32 to 64 high-speed Full programmatic Server racks

The choice hinges on control, not raw speed. A managed Layer 2 switch costs roughly USD 100 to USD 400 for 24 ports, while an unmanaged 24-port unit runs about USD 30 to USD 80. The premium buys VLAN segmentation, loop protection, and the ability to see what the switch has learned. For a network with more than a handful of devices or any shared infrastructure, that visibility is usually worth the difference.

Timeline: what happens when a frame arrives

Moment Event Typical duration
Frame arrives Preamble stripped, frame buffered Under 1 microsecond
Source learning Source MAC written to CAM table Under 1 microsecond
Destination lookup CAM search for destination MAC A few hundred nanoseconds
Decision Forward, filter, or flood Immediate
Transmission Frame serialized onto egress port 1.2 microseconds per 1,000 bytes at 1 Gbps
Aging Idle entry expires if unseen 300 seconds default
Relearn Moved device updates entry on next frame Immediate

The store-and-forward versus cut-through distinction lives in this timeline. Store-and-forward switches buffer the entire frame and check its frame check sequence (FCS) before forwarding, adding latency proportional to frame size but catching corrupted frames. Cut-through switches begin forwarding after reading the destination MAC, roughly the first 6 bytes, cutting latency to a fraction of a microsecond at the cost of passing along bad frames. Most access switches use store-and-forward; low-latency trading and some data-center fabrics use cut-through.

Practical actions: getting the most from your switch

Start by matching the switch to the job. Count devices, then add headroom. A 24-port switch with 18 devices leaves six ports for growth and for a link to another switch.

Enable loop protection on any managed switch. Spanning Tree should be on by default on enterprise gear, but verify it. On unmanaged switches, avoid cabling two switches together with more than one cable unless you know the model handles it.

Set port security where devices are fixed. Capping each port at one or two MAC addresses stops the table-exhaustion attack and flags unauthorized devices. Many managed switches log a violation and can shut the port automatically.

Watch the MAC table if you operate the network. A table that sits near capacity, or a port showing dozens of learned addresses, points to virtualization, a loop, or an attacker. Most managed switches expose the table through their web interface or command line.

Keep aging at the default unless you have a reason to change it. Shorter timers increase flooding; longer timers hold stale entries. The 300-second default balances both for most networks. If you run one-way traffic patterns, consider lengthening it to reduce unknown-unicast flooding.

Plan for PoE if you are buying once. Power over Ethernet switches deliver up to 15.4 watts per port under the original standard, 30 watts under PoE+, and up to 60 to 90 watts under newer standards, enough for cameras, phones, and access points. A non-PoE switch plus separate injectors costs more in cabling and clutter than the PoE premium.

Limitations: what a switch cannot do

A switch is a local forwarding device. It cannot see beyond its own broadcast domain without help, cannot prioritize traffic by application by default, and cannot stop a determined attacker from spoofing addresses unless you configure it to. It has no concept of the internet, no routing table, and no firewall rules. Those functions belong to routers, firewalls, and higher-layer appliances.

The MAC table is also a soft boundary. It reflects what the switch has recently seen, not what is configured, so a table dump is a snapshot, not an inventory. Devices that sleep, move, or change addresses leave traces that expire. For asset tracking, the switch is a starting point, not a source of truth.

And the mechanism itself has a ceiling. A switch forwards frames between ports on the same device; once traffic must cross to another switch, it depends on the link between them, and once it must leave the network, it depends on a router. The switch is the most local and most reliable piece of the path, and also the one with the narrowest view. Understanding that boundary is what turns a vague sense that "the switch handles it" into a working model of your network.