IP & Routing
How IP addressing and routing move packets across interconnected networks to reach the correct destination on the Internet.
What Is an IP Address?
- An IP address allows routers to figure out where to send data across networks.
- It is assigned by the network and can change when you move to a different network.
- Its structure helps the Internet scale to billions of devices efficiently.
Details
When you visit a website, DNS translates the domain name into an IP address. That IP address tells the Internet where the destination device exists.
Routers do not understand domain names — they forward packets based on IP addresses. Every packet traveling across the Internet includes a source IP and a destination IP.
An IP address has structure. One part identifies the broader network, and the other part identifies the specific device inside that network. This structure allows routers to make efficient forwarding decisions instead of storing a route for every single device in the world.
Unlike a MAC address (which is tied to hardware), an IP address is logical. It is assigned by your network and can change when you connect somewhere else — for example, switching from home Wi-Fi to a coffee shop network.
This combination of structure and flexibility is what allows the Internet to scale globally while still being manageable.
Public vs Private IP
Private IP traffic enters the router, NAT rewrites it, and exits with a public IP.
- Private IPs are used within homes, schools, and companies and are not routable on the public Internet.
- Public IPs are globally unique and allow devices or services to be reached from anywhere.
- Routers use NAT to translate private addresses into a public address for outbound traffic.
Details
Private IP ranges such as 10.x.x.x, 172.16.x.x–172.31.x.x, and 192.168.x.x are reserved for internal network use. Millions of separate networks reuse these same ranges because they are not visible on the global Internet.
Public IP addresses, in contrast, must be globally unique. They are assigned by Internet authorities and are required for direct Internet communication.
In a typical home network, your devices use private IP addresses internally. When sending traffic to the Internet, the home router performs Network Address Translation (NAT), replacing the private source IP with the router’s public IP.
This translation allows multiple internal devices to share a single public address while still maintaining proper return routing.
What Is Routing?
Network A
Router 1
Router 2
Destination
Each router independently examines only the destination IP and forwards the packet toward the next network hop.
- Routers connect separate networks and move packets between them.
- Forwarding decisions are made using the destination IP address.
- Routers operate at the network layer and ignore application-level data like HTTP.
Details
A router’s job is narrow but critical: it examines the destination IP address of an incoming packet and decides where to send it next.
Routers connect different networks together, allowing traffic to move beyond a single local segment. Without routers, communication would be limited to one isolated network.
Importantly, routers do not interpret application data. They do not read HTTP headers or understand whether the packet contains a web request, video stream, or file transfer.
At Layer 3, only the IP destination matters. The router forwards the packet toward its target network, one hop at a time.
Routing Tables
Multiple routes may match. The router selects the most specific network — the longest prefix.
- A routing table maps destination networks to the next hop router.
- When a packet arrives, the router searches for the best matching network entry.
- Routers prefer the most specific match using longest-prefix logic.
Details
A routing table is essentially a decision chart. Each entry says: If the destination belongs to this network, forward it to this next hop.
When a packet arrives, the router compares the destination IP address against all known network entries in the table.
If multiple entries match, the router selects the most specific one. This is called longest-prefix match. Conceptually, this means a route that describes a smaller, more precise network is preferred over a broad one.
For example, if one route covers an entire organization and another covers a specific department subnet, the router chooses the more precise path. This keeps routing accurate and efficient.
How a Packet Travels Across the Internet
- A packet moves through multiple routers, not directly from sender to receiver.
- Each router forwards it one step closer to the destination network.
- The full path emerges from many independent routing decisions.
Details
Imagine a client in New York sending a request to a server in California.
The packet first leaves the client device and reaches the local router (often your home or office gateway). From there, it enters your Internet Service Provider’s network.
Inside the ISP, the packet travels through larger backbone routers designed to handle massive volumes of traffic. It may cross regional and national networks, passing through several intermediate routers.
Eventually, the packet reaches the destination network that owns the server’s IP address. The final router forwards it to the server itself.
No single router knows the entire journey. Each one only knows the best next step.
What Is TTL (Time To Live)?
- TTL is a field in the IP header that starts with a set numeric value.
- Each router decrements the TTL by 1 at every hop.
- When TTL reaches 0, the packet is dropped.
Details
TTL (Time To Live) is a safety mechanism built into every IP packet.
When a packet is created, it is assigned an initial TTL value (commonly 64 or 128 depending on the operating system). Every time the packet passes through a router, that router reduces the TTL by one.
If the TTL reaches zero before the packet arrives at its destination, the router discards it and typically sends back an error message.
This mechanism prevents infinite routing loops. If routers become misconfigured or temporarily form a loop, packets cannot circulate forever because TTL guarantees they eventually expire.
Without TTL, routing mistakes could consume bandwidth indefinitely and destabilize large portions of the network.
Common Network Layer Failures
- An incorrect destination IP can result in “no route to host.”
- Routing table misconfigurations can send traffic to the wrong next hop.
- Packets may be dropped if TTL expires before reaching the destination.
Details
If a packet is addressed to the wrong IP or a non-existent network, routers simply cannot find a valid route. The result is a failure before the application layer is ever involved.
Routing table misconfigurations are another common cause. If a router points traffic toward an incorrect next hop, packets may be misdirected or lost entirely.
TTL expiration can also cause packet drops. If the packet travels too many hops — often due to inefficient routing or loops — it will be discarded before arriving.
A more severe failure is a network partition, where two segments of the network become disconnected due to outages or physical link failures. In that case, no path exists at all.
At the network layer, failure simply means one thing: the packet cannot be forwarded to its destination.
IP vs TCP Responsibility
TCP monitors delivery and resends lost segments.
IP forwards packets best-effort. Lost packets are not recovered here.
- IP provides best-effort delivery with no guarantees of arrival or order.
- IP does not retransmit lost packets or manage congestion.
- TCP builds reliability on top of IP through acknowledgments and retransmissions.
Details
IP operates at the network layer and focuses only on moving packets from source to destination. It does not guarantee that packets arrive, arrive once, or arrive in the correct order.
If a packet is lost due to congestion or a routing issue, IP does nothing to recover it. It simply attempts delivery on a best-effort basis.
TCP operates at the transport layer above IP. It establishes a connection, assigns sequence numbers to segments, waits for acknowledgments, and retransmits data when necessary.
TCP also ensures ordered delivery and manages flow and congestion control. In short, IP delivers packets. TCP turns those packets into a reliable conversation.
IP Is Stateless
- IP does not maintain session or connection state between packets.
- Each packet is routed independently, even if they belong to the same application request.
- Packet order is not preserved at the network layer.
Details
IP is fundamentally stateless. Routers do not track conversations, sessions, or application context.
When a packet arrives at a router, the router looks only at the destination IP address and forwards it based on the routing table. It does not remember where previous packets went or whether earlier packets succeeded.
Because of this, packets belonging to the same request can take different paths across the Internet. They may arrive out of order, or some may be dropped entirely.
This stateless design keeps routers fast and scalable. Maintaining per-connection memory at every router would make the global Internet dramatically slower and more complex.
The tradeoff is that reliability and ordering must be handled by higher layers, not by IP itself.
Question Section
1 / 5