Skip to main content

4.4 How Data Travel the Internet: Routing, Metrics, and Paths

add to ChatGPT
Verified for the 2027 examUpdated November 2026Fiveable Content Team
Fiveable

🌐AP Networking Unit 4 Review

QR code for AP Networking practice questions

4.4 How Data Travel the Internet: Routing, Metrics, and Paths

🌐 AP Networking

    continue practicing 4.4

    Multiple choice

    Every time you load a webpage, your data takes a journey across multiple networks, bouncing through routers until it reaches a server that might be on the other side of the planet. How does your laptop know where to send that request? How does the response find its way back to you and not some random device? This topic breaks down the mechanics of that journey: how routers make decisions, how private networks talk to the wider internet, and how you can actually trace the path your data takes.

    How Data Moves Between Networks

    Before your device sends anything, it does a quick check. It compares its own IPv4 address and subnet mask against the destination's IPv4 address. This tells your device one critical thing: is the receiver on the same network as me, or somewhere else?

    If the destination is on the same subnet, your device can send the data directly. But if the destination lives on a different network (like a web server across the country), your data has to leave your local network. That means it goes to the default gateway, which is almost always your router. From there, the data will pass through at least one router, and usually many more, before it reaches its destination.

    The Role of the Default Gateway

    Think of the default gateway as the exit door of your local network. Any packet headed somewhere "not here" gets handed off to this gateway. The gateway then forwards it onward through the internet.

    Once the packet finally arrives at the destination network, the router there takes over. It sends the packet directly to the correct device using that device's private IP address on the local network.

    Network Address Translation (NAT)

    Here's the issue: there aren't enough public IPv4 addresses for every device on Earth to have one. Network Address Translation (NAT) solves this. NAT lets devices with private IP addresses (the ones inside your home or office network) communicate with the outside world through a shared public address.

    Here's how it works. When an outbound packet leaves your network, the default gateway swaps the packet's source IP address. The private IP gets replaced with the gateway's single external (public) IP address. This way, many devices inside your network can share just one public IP address.

    A Concrete NAT Example

    Say your laptop has the private address 192.168.1.25 and wants to load a webpage. Your router's public address is 203.0.113.10.

    1. Your laptop sends a packet with source 192.168.1.25 toward the web server.
    2. The router swaps that source address, so when the packet hits the internet, it looks like it came from 203.0.113.10.
    3. The web server sends its reply back to 203.0.113.10 (because that's the only address it knows).
    4. The router sees the reply, checks its NAT table, and forwards the packet directly to 192.168.1.25 inside your network.

    NAT does two important things: it conserves public IPv4 addresses (which are running out), and it adds a layer of security. Outside devices can't easily reach your internal machines because they don't know the private addresses behind the gateway.

    Routing Tables and Hops

    Routers (and switches that can route) decide where to send packets by consulting a routing table. This table is a list of networks the router knows about, along with the best path to reach each one.

    Every time a router hands a packet off to the next router, that counts as one hop. The first hop is always through your default gateway. After that, the packet typically crosses routers run by Internet Service Providers (ISPs) as it makes its way toward the destination network.

    Routing Tables in Detail

    A single entry in a routing table typically holds four pieces of information:

    • Destination network address (along with its subnet mask): where is this route taking packets?
    • Next hop address: which router does the packet go to next?
    • Physical interface: which port or network card does the router use to reach that next hop?
    • Metric: a cost value that measures how "expensive" this route is, such as hop count or time

    Static vs Dynamic Routing

    Routes can be set up two ways:

    • Static routing: an administrator manually configures each route. Simple, but doesn't adapt to changes.
    • Dynamic routing: routers use a routing protocol to automatically share information and pick paths.

    A routing protocol is the set of rules that governs how routers exchange info and decide which paths data should take. Different protocols use different algorithms to find the "best" path based on their chosen metrics.

    Metrics: How Routers Pick the Best Path

    A metric is a cost value tied to a route. The key rule: a lower metric means a more efficient route. When a router has multiple possible next hops to reach the same destination, it picks the one with the lowest metric.

    Metrics reflect real network conditions like distance, speed, bandwidth, or congestion. Because networks change over time (a link gets congested, a router fails, bandwidth increases), metrics can shift. This means data might follow a different path tomorrow than it does today, even between the same two devices.

    The Four Routing Protocols to Know

    Each routing protocol computes metrics differently, which is why they can pick different "best" paths across the same network.

    Routing Information Protocol (RIP)

    RIP uses hop count as its metric. The best path is the one that passes through the fewest routers from source to destination. Simple, but it ignores things like speed. A path with 3 slow hops will be chosen over a path with 4 fast hops under RIP.

    Open Shortest Path First (OSPF)

    OSPF looks at link speed and bandwidth. It picks the shortest path based on those factors and can reroute as needed if conditions change. This usually produces faster paths than RIP because it cares about how fast each link is, not just how many there are.

    Border Gateway Protocol (BGP)

    BGP is the protocol that directs packets between the large sections of the internet operated by ISPs. If RIP and OSPF are about picking paths within a network or region, BGP is about picking paths between the huge chunks of the internet itself.

    Intermediate System to Intermediate System (IS-IS)

    IS-IS uses link state information to compute the most reliable path for data. It's often used in large service provider networks.

    Quick Comparison

    ProtocolMetric BasisTypical Use
    RIPHop countSmaller networks
    OSPFLink speed, bandwidthEnterprise networks
    BGPPolicy between ISPsBetween large internet sections
    IS-ISLink stateReliable paths in large networks

    Tracing the Route with traceroute and tracert

    Want to actually see the path your data takes? There are two command-line tools that reveal this:

    • traceroute on Mac and Linux
    • tracert on Windows

    Both do the same job: they show the route a packet follows from your network to the destination network, listing the IPv4 address of every hop along the way.

    Reading the Output

    Each line of the output represents one hop. For each hop, you'll typically see:

    • The hop number
    • The domain name or IP address of that router
    • How long that hop took to respond (usually in milliseconds)

    Here's what a trimmed tracert output might look like when tracing a path to a website:

    </>Code
    Tracing route to example.com [93.184.216.34]
    
      1    1 ms    1 ms    1 ms   192.168.1.1
      2   12 ms   11 ms   13 ms   10.0.0.1
      3   15 ms   14 ms   15 ms   isp-router.net [203.0.113.1]
      4   22 ms   21 ms   23 ms   core1.isp.net [198.51.100.5]
      5   45 ms   44 ms   46 ms   93.184.216.34

    Hop 1 is your default gateway (your home router). Hops 2 through 4 are routers along the way, often operated by ISPs. Hop 5 is the destination.

    What You Can Learn From It

    The output lets you:

    • Count the hops: how many routers did your data cross?
    • Spot delays: if one hop suddenly jumps from 15 ms to 300 ms, something is slow there
    • Find failure points: if the trace stops or shows asterisks (* * *), a router along the path isn't responding

    This makes traceroute and tracert useful for troubleshooting. If a website is loading slowly or not at all, running one of these tools can show you where the problem is, whether it's your gateway, your ISP, or somewhere deeper in the internet.

    See Fiveable more often in Google

    Mark Fiveable as a preferred source and Google is more likely to show you our guides in Top Stories, with a "preferred" badge in AI Mode and AI Overviews.

    Prefer us on Google