Learning Centre
Infrastructure 6 min read

How Routing Works: Getting Packets from A to B

What a router does, how routing tables work, and what happens when a packet needs to leave your local subnet.

What is a Router?

A router is a device that forwards packets between different networks. Where a switch moves traffic between devices on the same subnet, a router decides the best path to a destination on a different subnet — or on the internet.

Most small businesses have one physical router at the edge of their network connecting the LAN to the internet. Larger environments add internal routers between VLANs, office buildings, or datacentre zones.

Local vs Routed Traffic

When a device on 192.168.1.0/24 sends a packet to another device on the same /24, both source and destination are within the same subnet. The packet goes directly — no router needed.

When the same device sends to 10.10.0.50 (a different network), the destination is outside the local subnet. The device cannot deliver it directly, so it sends the packet to its default gateway — the router.

How does a device know whether a destination is local? It compares the destination IP against its own IP address and subnet mask. If they share the same network address, the destination is local. If not, the packet goes to the gateway.

The Default Gateway

The default gateway is the IP address of the router interface on your local subnet. It is the exit point for any traffic that cannot be delivered locally.

When you configure a device with IP 192.168.1.10 and mask /24, you also set a default gateway — typically 192.168.1.1. All traffic to unknown destinations flows there first. The router then decides what to do with it.

Common mistake: If the default gateway is wrong or unreachable, devices on the local subnet can still talk to each other — but nothing outside the subnet will work. This is a very common cause of "I can reach devices on the local network but not the internet" problems.

The Routing Table

A router maintains a routing table — a list of known destinations and how to reach them. When a packet arrives, the router looks up the destination IP and forwards accordingly.

DestinationNext hopInterfaceMetric
192.168.1.0/24— (directly connected)eth00
10.10.0.0/24192.168.1.254eth010
0.0.0.0/0203.0.113.1eth11
  • Destination — the network this rule applies to.
  • Next hop — send the packet to this address to get it closer to the destination. "Directly connected" means the destination is on an interface the router owns.
  • Interface — which physical or logical port to use.
  • Metric — lower number = preferred when multiple routes exist.

The router picks the most specific match (longest prefix). A packet for 10.10.0.5 matches both 10.10.0.0/24 and 0.0.0.0/0, but the /24 is more specific — so it wins.

The Default Route (0.0.0.0/0)

The entry 0.0.0.0/0 matches every destination — it is the routing table's catch-all. This is what sends unknown traffic to your ISP's router, and from there out to the internet. Without a default route, packets to unknown destinations are simply dropped.

Static vs Dynamic Routing

Static routing means you manually add routes to the table. Simple and predictable, but someone must update them whenever the network changes. This is the right choice for most small business networks.

Dynamic routing uses protocols like OSPF or BGP to let routers discover and share routes automatically. Essential in large or complex networks, but unnecessary overhead for a single-site small business with one internet connection.

Routing is Hop by Hop

Routing is not end-to-end — it is hop by hop. The sending device passes the packet to its default gateway. That router checks its routing table, picks the next hop, and forwards the packet. The next router does the same. This repeats until the packet reaches a router that knows the destination is directly connected — and delivers it.

This is exactly what traceroute (Windows: tracert) shows you: each line is one hop, one router forwarding the packet one step closer to its destination.

$ tracert 8.8.8.8
  1    1 ms   192.168.1.1    (your gateway)
  2    8 ms   100.64.0.1     (ISP edge router)
  3   12 ms   72.14.215.165  (upstream provider)
  4   14 ms   8.8.8.8        (Google DNS — destination reached)

Know what's on every subnet

Good IP management makes routing decisions easier. When you can see every subnet and its allocations in one view, planning routes and firewall rules becomes straightforward.

Start free