Courses/System Design/Part 2/IP & Routing Basics

IP & Routing Basics

How data travels across networks and routing fundamentals

🎙️ How Data Finds Its Way Across the Internet

Imagine sending a letter across the world. You write the address, drop it in a mailbox, and trust the postal system to deliver it. That's exactly what happens when you send data across the internet — but instead of envelopes and stamps, we use IP addresses and routing protocols. In this lesson, we'll explore how data travels from your device to a server — through routers, hops, and networks — using IP and routing fundamentals.

🌐 What Is IP?

IP (Internet Protocol) is the addressing system of the internet. It gives every device a unique address so data knows where to go.

IP Address

A unique identifier for a device on a network

Format:

IPv4:
192.168.1.1

(32-bit)

IPv6:
2001:0db8:85a3::8a2e:0370:7334

(128-bit)

Analogy:

An IP address is like a home address. Without it, the mail can't be delivered.

📦 What Is a Packet?

When you send data (like a message or a video), it's broken into small chunks called packets. Each packet contains:

The data itself
A destination IP address
A source IP address
Other metadata (like sequence number)

Analogy:

Packets are like envelopes — each one carries part of the message and knows where it's going.

🚦 What Is Routing?

Routing is the process of finding the best path for a packet to travel from source to destination.

Routers

Devices that forward packets between networks
They read the destination IP and decide where to send the packet next
Each router is like a checkpoint or intersection

Analogy:

Routing is like GPS navigation. Routers are road signs that guide packets toward their destination.

🛣️ How Routing Works (Step-by-Step)

1Your device creates a packet with destination IP
2Local router receives it and checks its routing table
3Packet hops across multiple routers — each one forwarding it closer to the destination
4Destination server receives the packet and sends a response back the same way

Note: Packets don't always take the same path — routing is dynamic and can change based on congestion or failures.

🧭 Routing Tables

Every router maintains a routing table — a map of known networks and where to send packets.

Static routes:

manually configured

Dynamic routes:

updated using routing protocols

Common Routing Protocols:

RIP (Routing Information Protocol)
OSPF (Open Shortest Path First)
BGP (Border Gateway Protocol) — used between ISPs and large networks

Analogy:

Routing tables are like a GPS app's map — constantly updated to find the best route.

🔄 IP + Routing in Action

Example: You open www.example.com in your browser.

1DNS resolves the domain to an IP address
2Your device creates an HTTP request
3The request is wrapped in a TCP segment
4The TCP segment is wrapped in an IP packet
5The IP packet is sent to your router
6The router forwards it across the internet
7The server receives it and sends a response back

🧠 Mental Hook: "Digital Postal System"

IP
= Address
Packet
= Envelope
Router
= Post office
Routing Table
= GPS map
Routing Protocol
= Traffic updates

🔗 Why This Matters in System Design

IP and routing determine how fast and reliably data reaches your backend
Understanding routing helps you design multi-region systems, CDNs, and failover strategies
Helps you debug latency, packet loss, and connectivity issues

🎙️ Closing Thought

IP and routing are the invisible highways of the internet. Every time you send a message, stream a video, or load a webpage — packets are navigating across routers using IP addresses and routing tables. And as we move deeper into system design, understanding this journey helps us build faster, more resilient systems.