Skip to content
Internet Basics Explained — IP Routing, BGP, CDN & How Data Travels

Internet Basics Explained — IP Routing, BGP, CDN & How Data Travels

DodaTech Updated Jun 15, 2026 7 min read

The internet is a global network of interconnected computer networks that communicate using standardized protocols — a network of networks.

What You’ll Learn

In this tutorial, you’ll learn how IP addressing and routing work, what BGP does, how peering and CDNs improve performance, what latency and packet loss mean, and how data physically travels across the internet.

Why It Matters

The internet is the foundation of modern computing. Understanding how it works under the hood helps you diagnose connectivity issues, optimize application performance, and make informed infrastructure decisions.

Real-World Use

When you stream a video from Netflix, your request travels through your ISP, across multiple routers using BGP, possibly to a CDN edge server near you, all in under 100 ms. Doda Browser optimizes page loads by connecting to CDN edge servers and using persistent connections.


graph LR
  A[Your Device] --> B[Home Router]
  B --> C[ISP POP]
  C --> D[Regional Router]
  D --> E[Internet Exchange IXP]
  E --> F[Transit Provider]
  F --> G[CDN Edge]
  F --> H[Origin Server]
  E --> I[Peering]
  style A fill:#4f46e5,color:#fff
  style H fill:#f87171,color:#fff

How Data Travels Across the Internet

When you send a request to example.com, here’s what happens:

  1. DNS Resolution: Your device resolves the domain name to an IP address
  2. Packet Creation: Your request is split into packets with source/destination IPs
  3. Local Routing: Your home router forwards packets to your ISP
  4. ISP Routing: The ISP routes packets through its network
  5. Border Gateway: Peering or transit exchanges connect ISP to other networks
  6. Destination Network: The destination network routes to the actual server
  7. Response: The process reverses with the response data

IP Addressing

IPv4 addresses are 32-bit numbers (4.3 billion possible addresses). IPv6 uses 128-bit addresses (340 undecillion — enough for every atom on Earth with room to spare).

FeatureIPv4IPv6
Address size32 bits128 bits
Format192.168.1.12001:db8::1
Addresses~4.3 billion~340 undecillion
NAT needed?Yes (shared addresses)No
Header20-60 bytes40 bytes (fixed)

Routing

Routers forward packets toward their destination using routing tables. Each router knows which next hop to send a packet to for any given destination network.

Routing Protocols

ProtocolTypeUsed In
OSPFLink-state (shortest path)Within an AS (enterprise)
BGPPath-vector (policy-based)Between ASes (internet core)
RIPDistance-vectorSmall networks (legacy)

BGP (Border Gateway Protocol)

BGP is the protocol that makes the internet work. It’s how different networks (Autonomous Systems or ASes) exchange routing information.

  • AS: A network under a single administrative control (e.g., Google AS 15169)
  • BGP routes: Advertise IP prefixes with path attributes (AS path, next hop)
  • Policy-based routing: ISPs choose routes based on business relationships, not just shortest path
class BGPRoute:
    def __init__(self, prefix, as_path, next_hop):
        self.prefix = prefix
        self.as_path = as_path
        self.next_hop = next_hop

    def __repr__(self):
        return f"Prefix: {self.prefix}, AS Path: {' '.join(f'AS{n}' for n in self.as_path)}, Next Hop: {self.next_hop}"

# Simplified BGP table
bgp_table = [
    BGPRoute("93.184.216.0/24", [64500, 15169], "10.0.1.1"),
    BGPRoute("142.250.0.0/16", [64500, 12345, 15169], "10.0.1.2"),
]

for route in bgp_table:
    print(route)

def best_path(routes, target_prefix):
    matching = [r for r in routes if r.prefix == target_prefix]
    if not matching:
        return None
    # Simplified: shortest AS path wins
    return min(matching, key=lambda r: len(r.as_path))

best = best_path(bgp_table, "93.184.216.0/24")
print(f"\nBest path: {best}")

Expected output:

Prefix: 93.184.216.0/24, AS Path: AS64500 AS15169, Next Hop: 10.0.1.1
Prefix: 142.250.0.0/16, AS Path: AS64500 AS12345 AS15169, Next Hop: 10.0.1.2

Best path: Prefix: 93.184.216.0/24, AS Path: AS64500 AS15169, Next Hop: 10.0.1.1

Peering and Transit

Networks connect to each other through:

  • Transit: Paying another network to carry your traffic to the rest of the internet
  • Peering: Direct connection between two networks, usually at an Internet Exchange Point (IXP), often settlement-free

CDNs (Content Delivery Networks)

CDNs cache content at edge servers close to users, reducing latency and origin server load.

CDNEdge LocationsKey Feature
Cloudflare310+ citiesFree tier, DDoS protection
Akamai4,100+ locationsMassive scale, enterprise
Fastly80+ POPsHighly customizable VCL
AWS CloudFront450+ POPsTight AWS integration

Latency and Packet Loss

Latency is the time data takes to travel from source to destination. Factors include:

  • Speed of light (fiber: ~200,000 km/s)
  • Router processing time
  • Queueing delays
  • Distance (NY to London: ~55 ms, NY to Sydney: ~150 ms)

Packet loss occurs when packets are dropped due to congestion, faulty hardware, or buffer overflow. TCP interprets loss as congestion and reduces its sending rate.

import time
import subprocess

def ping_latency(host="google.com", count=4):
    """Measure round-trip latency to a host"""
    try:
        result = subprocess.run(
            ["ping", "-c", str(count), host],
            capture_output=True, text=True, timeout=15
        )
        for line in result.stdout.split("\n"):
            if "time=" in line:
                ms = float(line.split("time=")[1].split(" ms")[0])
                print(f"  RTT: {ms:.1f} ms")
        if "packet loss" in result.stdout:
            loss_line = [l for l in result.stdout.split("\n") if "packet loss" in l][0]
            print(f"  {loss_line.strip()}")
    except Exception as e:
        print(f"  Ping failed: {e}")

print(f"Latency to google.com:")
ping_latency("google.com")
print(f"\nLatency to local server:")
ping_latency("192.168.1.1")

Expected output (approximate):

Latency to google.com:
  RTT: 12.5 ms
  RTT: 11.8 ms
  RTT: 13.2 ms
  RTT: 12.1 ms
  0% packet loss

Latency to local server:
  RTT: 0.8 ms
  RTT: 0.5 ms
  0% packet loss

ISPs (Internet Service Providers)

ISPs are categorized into tiers:

TierDescriptionExample
Tier 1Global backbone, no transit costsLevel 3, NTT, CenturyLink
Tier 2Regional/national, buys transitComcast, Verizon
Tier 3Local, buys from Tier 2Local cable/DSL providers

Common Mistakes

  1. Confusing latency and bandwidth: Low bandwidth means slow data transfer rates. High latency means slow responses. They’re independent.
  2. Ignoring BGP route propagation: BGP updates can take minutes to propagate globally. New prefixes aren’t instantly reachable.
  3. Not using anycast for critical services: Anycast DNS (like 8.8.8.8) routes users to the nearest server automatically, improving performance and resilience.
  4. Thinking traceroute shows exact paths: Routers can forward packets differently than the probes. The path shown may not match the actual data path.
  5. Underestimating peering impact: Traffic between two ISPs that don’t peer goes through a transit provider, adding latency. Direct peering reduces hops.

Practice Questions

  1. What is an AS (Autonomous System)? A network under a single administrative control with a unique AS number. Each AS runs its own routing policies.

  2. How does BGP differ from OSPF? OSPF finds the shortest path within an AS. BGP exchanges routes between ASes using path-vector, considering policy, not just distance.

  3. What is the purpose of a CDN? To cache content closer to users (edge servers), reducing latency and load on origin servers.

  4. What factors contribute to internet latency? Speed of light (physical distance), router processing, queueing delays, and application processing.

  5. What is the difference between peering and transit? Peering is a direct connection between two networks (often free). Transit pays a network to reach other networks.

Challenge

Run traceroute google.com (or tracert on Windows). Research each hop. Identify which AS each router belongs to. How many networks did your traffic traverse?

Real-World Task

Use a ping monitoring tool or ping -c 100 google.com to measure jitter (variance in latency). High jitter (>10 ms) indicates network instability.

Mini Project: Network Diagnostic Tool

Build a Python tool that performs ping, traceroute, and DNS resolution. Display latency statistics, hop-by-hop paths with AS numbers (using a whois database), and packet loss percentages.

Security angle: Understanding how data travels helps you secure it at every hop. Doda Browser’s connection security model checks for HTTPS, HSTS, and certificate validity before sending data over the internet.

What’s Next

Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro.

What’s Next

Congratulations on completing this Internet Basics tutorial! Here’s where to go from here:

  • Practice daily — Consistency is more important than long study sessions
  • Build a project — Apply what you learned by building something real
  • Explore related topics — Check out other tutorials in the same category
  • Join the community — Discuss with other learners and share your progress

Remember: every expert was once a beginner. Keep coding!

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro