DEV Community

Enoch Franco
Enoch Franco

Posted on

Hub, Switch, and Router — Explained Using a Game of Cricket

Networking terms can feel like alphabet soup when you're starting out — Hub, Switch, Router, MAC address, IP address, Subnet Mask — thrown at you all at once, usually with zero real-world context. Here's how I finally made sense of it, using something a lot more familiar: cricket.

The Cricket Analogy

Imagine a cricket team with three players: a hub, a switch, and a router. All three are part of the same game, but each has a completely different job — one's a batsman, one's a bowler, one's a fielder. Networking devices work the same way: they're all part of one network, but each does something distinct.

Hub — The One Who Shouts to Everyone

A hub is the simplest of the three. If only two devices need to talk, you don't even need one — but the moment more than two devices are connected, a hub becomes necessary to relay traffic between them.

Here's the catch: a hub has no idea who's talking to whom. If Device A wants to send data to Device B, it sends that data to the hub — and since the hub doesn't know which device Device A actually wants to reach, it just broadcasts the data to every single connected device.

So a hub's "functionality" is really a lack of intelligence — it doesn't figure out who wants to speak with whom; it just floods the message everywhere and lets the devices sort it out.

Switch — The One Who Knows Everyone by Name

A switch does the same basic job as a hub — moving data between connected devices — but with one major upgrade: it actually knows who's who.

Instead of blindly broadcasting to every device, a switch keeps a table of each connected device's MAC address, so it can send data directly to the right recipient.

What Is a MAC Address?

Every device that connects to a network — a laptop, phone, router, anything — has a Network Interface Card (NIC). That NIC comes with a MAC address: a permanent ID burned in by the manufacturer.

If your laptop has an Ethernet port, the NIC lives right behind it. If you're connecting over Wi-Fi instead, the NIC is built into the Wi-Fi card. Either way, that hardware is what gives your device its MAC address.

Router — The One Who Connects Networks Together

While hubs and switches move data within one network, a router's job is to connect one network to another. The clearest everyday example: your router is what connects your home network to the wider internet.

Network Adapter and RJ45

Two more pieces worth knowing:

  • Network Adapter (NIC): The hardware inside your device that lets it join a network at all — wired via Ethernet or wireless via Wi-Fi. Think of it as the bridge between your device and the network. Every NIC carries its own unique MAC address.
  • RJ45: The physical connector at the end of an Ethernet cable (the connector itself, not the cable) — used to plug into ports on NICs, switches, and routers.

IP Address and Its Components

An IP address is a numerical label assigned to every device on a network. An IPv4 address looks like this:

192.168.1.50
Enter fullscreen mode Exit fullscreen mode

Every IP address is made up of two parts:

Part What it identifies Analogy
Network ID The network segment the device belongs to The street name
Host ID The specific device within that network The house number

For example, given 192.168.1.50 with subnet mask 255.255.255.0:

  • Network ID: 192.168.1.0
  • Host ID: 50

The Role of the Subnet Mask

The subnet mask is what actually splits an IP address into its Network ID and Host ID. With 255.255.255.0, the first three numbers (192.168.1) mark the network, and the last number (50) marks the specific host — the device — within it.

(Worth flagging: this clean "three numbers for network, one for host" split only happens with a /24 mask like this one. Other subnet masks can split the address at different points — sometimes within a single number rather than neatly along the dots — but that's a topic for a future post.)

IP Address vs. MAC Address — The Pen Name Analogy

This is the comparison that made it click for me:

  • An IP address is like a pen name — it identifies a device, but it can change over time, just like an author might use different pen names.
  • A MAC address is like the author's real name — it's assigned permanently to the hardware by the manufacturer and doesn't change under normal use. (One exception worth knowing: MAC addresses can technically be overridden at the software level — a technique called MAC spoofing — but the original, hardware-burned address itself never changes.)

An IP address itself splits into the same two pieces mentioned above:

  1. Network ID — shared by every device on the same network, showing they all belong to one group.
  2. Host ID — unique to each individual device, identifying exactly which one is communicating.

Key Takeaways

  • Hub: dumb but simple — broadcasts to everyone, every time.
  • Switch: smart — knows each device's MAC address and sends data only where it needs to go.
  • Router: connects separate networks together, most commonly your home network to the internet.
  • MAC address: permanent, hardware-based identity assigned by the manufacturer — technically spoofable in software, but the original hardware address itself never changes.
  • IP address: logical, assignable identity — can change, and is split into a Network ID and Host ID via the subnet mask.

Understanding these basics is the foundation for pretty much everything else in networking — VLANs, routing tables, subnetting — so if this is where you're starting too, you're in the right place.

Tags: #networking #beginners #tutorial #ccna

Top comments (0)