AP Networking

How data travel the internet: routing, metrics, and paths

When you send a request to a web server, your data don't travel in a single step — they pass through a chain of routers, each making its own forwarding decision. Understanding how routers choose their path and how NAT enables multiple private devices to share a single public IP is fundamental to understanding how the modern internet works.

What this topic covers

  • 4.4.A — How data travel between different networks: gateways, NAT, and routing tables
  • 4.4.B — Routing protocols and metrics: how routers choose the best path
  • 4.4.C — traceroute / tracert to trace paths and identify delays

The key decision: same network or different?

Before sending data, a device compares its own IP address and subnet mask with the destination IP address. If the destination is on the same network, the device delivers the packet directly. If the destination is on a different network, the device forwards the packet to its default gateway — the first hop on the path to the destination.

Network Address Translation (NAT) (4.4.A)

Private IP addresses (like 192.168.x.x) cannot be routed on the public internet. NAT bridges private and public networks by translating IP addresses at the gateway.

How NAT works (outbound)

  1. Device with private IP 192.168.1.25 sends data to a web server
  2. When the packet reaches the router, NAT replaces the source IP (192.168.1.25) with the router's public IP (203.0.113.10)
  3. The packet travels the internet with the public IP as the source address

How NAT works (return traffic)

  1. The web server sends its response to 203.0.113.10 (the router's public IP)
  2. The router's NAT table maps the public IP back to the original private IP (192.168.1.25)
  3. The router delivers the response to the correct internal device

Why NAT matters: NAT conserves public IPv4 addresses by allowing many devices to share a single public address, and adds a layer of security by keeping internal IP addresses hidden from the internet.

Advertisement

Routing tables and hops

Every router and routing-capable switch maintains a routing table — a list of known networks and the best path to reach each one. When a packet arrives, the router looks up the destination in its table and forwards the packet to the next hop.

Field Description
Address + subnet mask The destination network this route serves
Next hop The IP address of the next router to forward the packet to
Interface The physical port the packet should leave through to reach the next hop
Metric A cost value for the route (hops, time, bandwidth); lower metrics are preferred

Hops

A hop occurs each time a packet is forwarded from one router to another. The first hop passes through the default gateway. Additional hops pass through routers typically operated by ISPs. Once the packet reaches the destination network, the final router delivers it to the device using the device's private IP address.

Routing protocols (4.4.B)

Routes can be set statically (manually) or configured dynamically using routing protocols. Dynamic routing protocols let routers discover and share network paths, choosing the best route based on metrics.

RIP — Routing Information Protocol

Uses hop count as its metric. Selects the path with the fewest routers between source and destination. Limited to smaller networks (max 15 hops).

OSPF — Open Shortest Path First

Uses link speed and bandwidth. Reroutes in real time to use the shortest path. Well-suited to larger enterprise networks.

BGP — Border Gateway Protocol

Routes packets between large sections of the internet operated by ISPs. BGP is the protocol that makes internet-scale routing possible between autonomous systems.

IS-IS — Intermediate System to Intermediate System

Uses link state to calculate the most reliable path for data to travel. Used in large service provider networks alongside OSPF.

Advertisement

Tracing the path: traceroute / tracert (4.4.C)

traceroute (Mac/Linux) and tracert (Windows) display the path a packet takes from the source to the destination, showing the IP address and response time for each hop.

What each line shows

  • › The hop number
  • › The IP address (or domain name) of the router at that hop
  • › The response time (latency) for that hop in milliseconds

How to interpret the output

  • › Count hops to determine path length
  • › A sharp increase in response time at one hop indicates a delay at that point
  • › Timeouts (* * *) may indicate a router that doesn't respond to traceroute or a failure point

# tracert output (Windows)

1 1 ms 1 ms 1 ms 192.168.1.1

2 8 ms 7 ms 9 ms 10.0.0.1

3 95 ms 98 ms 94 ms 72.14.215.1 ← delay here

4 11 ms 10 ms 11 ms 216.58.200.1