1. Library
  2. Routing and Networks
  3. Local Networks

Updated 10 hours ago

A router is a decision-maker at a crossroads.

Every data packet traveling across the Internet arrives at routers with the same question: How do I get where I'm going? The router examines the destination, consults its map of the network, and sends the packet on its way. This happens millions of times per second, at every hop, until your data reaches its destination.

A switch asks "who are you?" A router asks "where are you going?"

The Difference Between Routers and Switches

Switches connect devices within a single network—your laptop to your printer, your phone to your smart TV. They work with MAC addresses, the hardware identifiers burned into every network device. A switch learns which devices are connected to which ports and shuttles traffic between them.

Routers connect different networks together. Your home network to the Internet. One office to another across the country. The coffee shop Wi-Fi to everywhere else. Routers work with IP addresses—logical addresses that identify not just a device, but where that device lives in the global network topology.

This is why your home "router" is actually several devices in one box: a router (connecting your home network to the Internet), a switch (connecting your wired devices), a Wi-Fi access point (connecting your wireless devices), and a firewall (protecting everything from the outside world).

How Routing Actually Works

When you load a webpage, your request doesn't teleport to the server. It hops from router to router, each one making a decision about where to send it next.

Every router maintains a routing table—a map of network destinations and how to reach them. When a packet arrives, the router:

  1. Reads the destination IP address
  2. Searches its routing table for a matching entry
  3. Forwards the packet out the appropriate interface toward the next hop

The next router does the same thing. And the next. Until the packet arrives.

This distributed decision-making is what makes the Internet resilient. No single router needs to know the complete path. Each one only needs to know the next step.

The Routing Table

A routing table entry says: "To reach this network, send packets this direction."

A simple home router might have three entries:

  • My local network (192.168.1.0/24) — directly connected
  • My ISP's network — out the WAN port
  • Everything else — also out the WAN port (default route)

A core Internet router might have 900,000 entries, one for almost every network on Earth.

When multiple routes exist to the same destination, the router picks the most specific one. If you're trying to reach 192.168.1.50, a route for 192.168.1.0/24 wins over a route for 192.168.0.0/16. It's like asking for directions: "123 Main Street" is more useful than "somewhere in the city."

Where Routing Tables Come From

Static routes are manually configured. An administrator tells the router: "To reach the accounting department's network, send traffic to this next-hop address." Static routes are simple and predictable, but they don't adapt when things change.

Dynamic routing protocols let routers teach each other. Routers running the same protocol share information about what networks they can reach. When a link fails, they recalculate and find alternate paths—often within seconds, without human intervention.

The major protocols:

OSPF (Open Shortest Path First) is the workhorse of enterprise networks. Routers build a complete map of the network topology and calculate optimal paths. When something changes, they quickly converge on new routes.

BGP (Border Gateway Protocol) is the routing protocol of the Internet itself. It manages routing between organizations—between your ISP and other ISPs, between cloud providers and content delivery networks. BGP is less about finding the shortest path and more about policy: which networks are you willing to carry traffic for, and through whom?

RIP (Routing Information Protocol) is the original dynamic routing protocol. It counts hops and picks the path with fewest routers. Simple but slow to adapt. You'll still find it in legacy systems.

Most networks combine approaches: static routes for predictable paths, dynamic protocols for everything else.

Network Address Translation

Your home network probably has dozens of devices, but your ISP gives you one public IP address. How does that work?

NAT—Network Address Translation. Your router maintains a translation table. When your laptop sends a request to a website, the router replaces your laptop's private address (192.168.1.100) with its own public address before forwarding the packet. It notes the translation. When the response comes back, the router consults its table and delivers the packet to your laptop.

From the Internet's perspective, all traffic from your home appears to come from a single address. This solves two problems: IPv4 address exhaustion (we ran out of addresses years ago) and basic security (your internal network structure is hidden from the outside world).

The downside: some protocols assume end-to-end connectivity and break when addresses get rewritten mid-flight. NAT is a clever hack that became infrastructure.

Types of Routers

Home routers pack everything into one box: routing, switching, Wi-Fi, firewall, NAT. Optimized for simplicity and cost.

Enterprise routers separate these functions for flexibility and scale. More interfaces, more sophisticated routing protocols, more control. The routing, switching, and wireless might be separate devices managed as a system.

Edge routers sit at network boundaries—where your organization meets the Internet or connects to partners. They enforce security policies, filter traffic, and handle NAT.

Core routers live in the backbone, forwarding enormous volumes of traffic between major network segments. Speed is everything. A core router at an Internet exchange might forward terabits per second.

Virtual routers run as software on servers or in the cloud. No dedicated hardware. This is how software-defined networks and cloud providers implement routing at scale.

When Routers Make Decisions

If a router has multiple paths to a destination, it needs a way to choose. Routing protocols use metrics—numerical scores that express how "good" a route is.

Hop count: How many routers must the packet traverse? Fewer is better. (RIP uses this.)

Bandwidth: What's the capacity of the path? A gigabit link beats a 10 megabit link. (OSPF considers this.)

Latency: How long does transmission take? A fiber link across town beats a satellite link to orbit and back.

Administrative preference: Network engineers can manually weight routes to express policy—prefer this ISP over that one, use the backup link only if the primary fails.

The router picks the route with the best metric. If the best path fails, it falls back to the next best.

Router Security

Routers at network boundaries are natural enforcement points:

Firewalls built into routers filter traffic by source, destination, port, and protocol. Block incoming connections by default; allow only what's explicitly permitted.

Access control lists (ACLs) define rules: permit traffic from the VPN, deny traffic from known-bad IP ranges, allow web traffic out but not arbitrary connections.

VPN termination lets routers encrypt traffic between sites or to remote users. Data crosses the untrusted Internet protected inside an encrypted tunnel.

Advanced routers add intrusion detection, DDoS mitigation, and traffic inspection. The boundary router is often the first line of defense.

Troubleshooting

Ping tests basic reachability. Can packets get to the destination and back? If not, something's broken between here and there.

Traceroute shows the path. It lists every router hop between you and the destination, with timing for each. When traceroute stops or shows high latency at a specific hop, you've found where the problem lives.

Viewing the routing table (on a router you control) shows what the router knows. Is there a route to the destination? Where does it point? Sometimes the answer is obvious: the route is missing, or it points the wrong direction.

The Internet Is Routers

When you load a webpage, your request might cross twenty routers between your device and the server. Each one makes a decision. Each one forwards your packet one step closer. The latency you experience is partly the speed of light across fiber, but it's also twenty routers examining headers and consulting tables.

The entire Internet is routers making decisions, millions of times per second, about how to get your data where it's going. No central authority coordinates them. They just follow their protocols, share what they know, and forward packets toward their destinations.

It works. Somehow, it works.

Frequently Asked Questions About Routers

Was this page helpful?

😔
🤨
😃