JOVANA
Explore Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
All guides

Hubs, Bridges, and the Switch That Learns

Three boxes, all with ports you plug cables into — yet they behave worlds apart. Watch a dumb hub grow into a switch that quietly learns where everyone sits and stops shouting into every room at once.

Same shape, three brains

In the last guide we met Ethernet and its frame — a little envelope stamped with a source and a destination MAC address, the 48-bit factory-burned name of a network card. A frame knows who it is for, but it cannot deliver itself; something in the middle has to move it from the cable it arrived on to the cable that reaches its target. That something has gone through three generations: the hub, the bridge, and the switch. From the outside they look identical — a box studded with ports you plug cables into — but the brain inside each is wildly different, and the difference is the whole story of how a modern LAN got fast and quiet.

Start with the hub, the simplest brain of all — really no brain. A hub is a multi-port repeater: every bit that arrives on any one port is blindly copied out of every other port, instantly, with no idea what a frame or an address even is. It works purely at the physical layer, pushing electrical signals around. Plug eight computers into an eight-port hub and it behaves exactly like one long shared wire that all eight are clamped onto. When computer A sends a frame to computer B, the hub does not send it to B; it shouts it at C, D, E, F, G, and H too. Everyone hears everything, and everyone's network card has to inspect the destination address and quietly discard the frames not addressed to it.

The bridge: a wall with a smart door

The first real intelligence arrived with the bridge. A classic bridge has just two ports and sits between two hub-connected segments, like a doorway between two rooms. Unlike a hub, it does not work in raw electricity; it reads each whole frame, looks at the addresses, and decides whether the frame even needs to cross. If A and B are in the same room (the same segment), their conversation stays in that room — the bridge keeps the door shut on it, so the people in the other room get airtime to talk among themselves. Only frames truly bound for the far side are carried across. Suddenly each segment is its own collision domain, and a busy chat on one side no longer steals airtime from the other.

How does the bridge know which frames to pass and which to hold back? It does not come pre-programmed with a map of who lives where — that would be impossible to maintain. Instead it learns, and it learns by watching. This single trick — looking at the source address of every frame that arrives and remembering which port it came in on — is the seed of everything modern switches do. A bridge is really just a switch with only two ports; the switch is what you get when you give that learning brain many ports and very fast hardware.

How a switch learns where everyone sits

Picture the switch as a receptionist at a building's front desk who, on day one, knows nobody. Her only tools are a blank notebook — the MAC address table, also called the forwarding table — and one iron habit: every time a frame walks past her desk, she reads its return address (the source MAC) and jots down which door (which port) it came in by. That habit alone is called MAC learning, and it fills the notebook entirely from normal traffic, with nobody configuring anything. The table is just a list of pairs: this MAC address lives behind this port.

  1. A frame arrives on a port. The switch reads its SOURCE MAC and records "this address is reachable via this port" — refreshing a timer so stale entries eventually expire if a device goes quiet or moves.
  2. Now the switch looks at the frame's DESTINATION MAC and checks the table for it.
  3. If the destination is in the table, it forwards the frame out only that one port. This is the whole point: a private delivery, not a shout.
  4. If the destination is NOT yet known (or is a broadcast address), it floods the frame out every port except the one it arrived on — a one-time fallback so delivery still happens while learning catches up.
  5. When the reply comes back, its source MAC teaches the switch where that device sits too — so the second exchange onward is delivered precisely, no flooding.
MAC address table (after a little traffic):

   MAC address        Port
   AA:AA:...:01       1      (host A)
   BB:BB:...:02       3      (host B)
   CC:CC:...:03       5      (host C)

  Frame  A -> B  : dest BB..02 is known -> send out PORT 3 only
  Frame  A -> Z  : dest unknown         -> FLOOD to ports 2,3,4,5,...
  Frame  A -> ff:ff:ff:ff:ff:ff (broadcast) -> FLOOD to all but port 1
The switch fills this table itself from the source addresses it sees. Known destination = forward to one port; unknown or broadcast = flood everywhere else.

Why the switch made the LAN fast and quiet

Because the switch delivers each frame to exactly one port, every port becomes its own private collision domain. Plug one computer into each port and that link is shared with nobody — so the old worry of two devices garbling each other simply disappears. That unlocks full-duplex operation: the device can send and receive at the same time over the two separate pairs of wires in the cable, like a phone call where both people can talk at once, instead of the old half-duplex walkie-talkie rule where you had to take turns and listen before speaking. A 1 Gbps full-duplex link can move 1 Gbps each way at the same time. Half-duplex and its collision-detection dance are now a legacy curiosity, mostly seen only when a switch falls back to talk to ancient gear.

Here is the honest limit that trips people up, and the next guide leans on it hard. A switch chops a LAN into many separate collision domains — but it does NOT break up the broadcast domain. When a frame is addressed to the broadcast address (all ones, ff:ff:ff:ff:ff:ff), the switch floods it everywhere by design, and so do all the switches connected to it; one broadcast reaches every device in the whole switched network. That is sometimes exactly what you want — it is how a newcomer shouts "who has this address?" before any private conversation can begin — but it means a switched LAN is still one big shared neighbourhood for broadcasts. Splitting the broadcast domain takes a router or a VLAN, which are the topics of the next two guides.

Loops, trunks, and bundled cables

Switches let you build big networks by wiring switch to switch, but that freedom hides a trap. If two switches are joined by two paths — say someone added a backup cable — a flooded broadcast can circle forever: switch X floods it to switch Y, Y floods it back to X, round and round, multiplying with every lap until the network drowns. There is no time-to-live field on an Ethernet frame to stop it, so the Spanning Tree Protocol (STP) steps in. The switches gossip among themselves, agree on a single loop-free tree of active links, and deliberately switch off the redundant links so exactly one path exists between any two points. If an active link fails, STP notices and switches a standby link back on — so you keep the safety of a spare cable without the catastrophe of a loop.

Two more switch superpowers round out the picture, both previewed here and developed later. First, a single physical switch can be carved into several isolated virtual LANs, or VLANs — separate broadcast domains living in one box, so finance and guests never see each other's broadcasts even though they share hardware. To carry many VLANs over a single cable between switches, the link becomes a trunk using 802.1Q tagging: each frame gets a small VLAN tag inserted so the far switch knows which VLAN it belongs to. Second, when one link between switches is not enough, link aggregation bundles several physical links into one logical pipe — more total throughput, and automatic failover if one cable dies. The next guide takes loops and broadcast domains deeper, and the guide after that is all about VLANs.

The helpers that make joining painless

A switch moves frames between MAC addresses, but the software on your computer thinks in IP addresses, not MACs. So before host A can send a frame to host B on the same LAN, it must answer a question: I know B's IP address — what is B's MAC address? That is the job of the Address Resolution Protocol (ARP). A broadcasts a tiny question to the whole LAN — "who has IP 192.168.1.20? tell me your MAC" — the switch floods it, only the owner of that IP answers with its MAC, and A caches the pairing so it need not ask again for a while. Notice this is exactly why broadcast still matters even on a smart switched network: the first hello has to be a shout, because nobody knows where the stranger sits yet.

There is a chicken-and-egg before even that: when you plug in or join the Wi-Fi, your device starts with no IP address at all, so it cannot send normal traffic yet. The Dynamic Host Configuration Protocol (DHCP) solves it, again leaning on broadcast. The newcomer shouts a request to the whole LAN; a DHCP server hears it and offers a lease — an IP address, the subnet mask, the default gateway (the router to reach the wider world), and DNS server addresses — all in one bundle, for a limited time. This is why connecting to a café network just works without you typing anything: ARP and DHCP, both built on the broadcast that the switch faithfully floods, quietly hand your device everything it needs to start talking. The final guide in this rung walks the full join-the-network sequence step by step.