How Routers Work

A Router's One Job: Connecting Different Networks

While a switch forwards traffic within one local network based on MAC addresses, a router forwards traffic between different networks entirely, based on IP addresses - it's the device that actually connects a home network to the wider internet.

The Routing Table: A Router's Map

A router maintains a routing table listing known destination networks and which direction (which outgoing interface, or which next-hop router) to send traffic toward for each one.

Destination Network      Next Hop
192.168.1.0/24            Directly connected (local network)
0.0.0.0/0 (everything else)  Send to ISP's router (the "default route")

The Default Route: What Handles "Everything Else"

The special entry 0.0.0.0/0 is a catch-all: any destination not explicitly matched by a more specific route in the table gets sent this way instead - typically toward the ISP, for anything beyond the local network. This is exactly what lets a home router send all outbound internet traffic somewhere sensible without needing a specific rule for every possible destination on earth.

Making a Forwarding Decision, Step by Step

  1. A packet arrives with a destination IP address.
  2. The router checks its routing table for the most specific matching entry.
  3. The packet is forwarded out the corresponding interface toward the next hop.
  4. This repeats at every router the packet passes through, until it reaches a router directly connected to the destination network.

Router vs Switch: The Core Distinction

A switch operates within one local network (Layer 2, MAC addresses); a router operates between separate networks (Layer 3, IP addresses). This is precisely why routers are the devices that make the internet's interconnected structure of countless independent networks actually possible.

Written by Lorens Mishra

Software Engineer Notes Management System Administrator

Discussion

0 comments
Sign in to join the discussion.

No comments yet. Be the first to say something.