Networking

Switch

Ethernet's own page covers switching in a couple of sentences: a switch learns which MAC address lives on which port, and forwards accordingly. This page is that same idea, but as a physical box — including the classic beginner mix-up between a switch and a router, and the older, now-obsolete device (the hub) a switch actually replaced.

Quick reference
What it is
A device that connects multiple devices on the same LAN, forwarding each Ethernet frame only to the port where its destination MAC address actually lives.
Mental model
A receptionist who knows exactly which desk each person sits at, and walks a message directly there — instead of a hub, which shouts every message across the entire floor.
Key numbers
Operates at the Data Link layer; learned MAC-to-port entries typically age out after a few minutes of inactivity.
Reach for it when
Never chosen directly by an application — it's the physical infrastructure that lets more than two wired devices share the same local network.

Hub vs. switch

A hub — essentially obsolete today — is a dumb electrical repeater: whatever arrives on one port gets copied out to every other port, with no awareness of MAC addresses or destinations at all. Every device on a hub shares one collision domain and one slice of total bandwidth. A switch replaces that with actual intelligence: it inspects each frame's destination MAC address and forwards it only out the one port that address is known to live on.

Learning the MAC address table

A switch builds its forwarding table with no configuration at all, just by watching traffic:

A switch learns which MAC address lives on which port by recording the source MAC of every frame it receives, building a forwarding table with no manual configuration Switch MAC table A — MAC ..:01 B — MAC ..:02 C — MAC ..:03 port → MAC 1 → ..:01 2 → ..:02 3 → ..:03 The very first frame from a new device teaches the switch its port — nothing needs to be typed in by hand.
A frame to an address not yet in the table is the one case still flooded to every port — same fallback a hub always used.

Collision domains

On a hub, every device shares one collision domain — if two devices transmit at the same instant, the signals corrupt each other and both have to retry, exactly the shared-medium problem a hub's design guarantees. A switch gives every port its own separate collision domain, which is what makes full-duplex operation possible — a device can send and receive at the same time without ever colliding with anything, since it isn't sharing the wire with anyone else at all.

Managed vs. unmanaged switches

Unmanaged
Plug in a cable, it works — no configuration interface, no settings, the common case for a home network.
Managed
Exposes configuration — VLANs (splitting one physical switch into multiple logically separate networks), port mirroring (copying one port's traffic to another for monitoring/debugging), QoS prioritization, and SNMP-based monitoring — the standard choice once a network is large or important enough to need visibility and control.

Real-world applications

Gotchas

Field notes