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.
- 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:
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
- Every wired home and office network — the switch is the physical hub-and-spoke point every wired device plugs into.
- Industrial control networks — managed switches with VLANs are commonly used to isolate a factory floor's PLC/sensor traffic from the corporate office network sharing the same physical cabling.
- Data center top-of-rack switching — every server in a rack connects to a switch dedicated to that rack, which then uplinks to the rest of the data center network.
Gotchas
- Switching loops — accidentally connecting two switches together with two separate cables (instead of one) creates a loop that floods broadcast traffic infinitely, capable of taking down an entire network in seconds — Spanning Tree Protocol (STP) exists on managed switches specifically to detect and block redundant paths before this happens.
- A switch alone cannot reach the internet — it has no concept of IP addresses or routing at all; that's exclusively a router's job, one layer up.
- A MAC address table entry that's gone stale (the device moved to a different port, or its network card changed) can cause a few seconds of failed delivery until the switch relearns — usually invisible, but a real, brief cause of "it worked, then didn't, then worked again."