Skip to main content

Module 16: Real-World Networking Scenarios

This module walks through complete networking scenarios, tracing packets from source to destination. Understanding these flows is crucial for debugging, architecture design, and interviews. The best way to truly understand networking is to follow a packet end-to-end. Each scenario below is like watching a letter travel through the postal system β€” from the moment you drop it in the mailbox, through every sorting facility and delivery truck, until it arrives at its destination. But unlike a letter, a network packet passes through multiple β€œtranslation desks” (NAT, firewalls, load balancers) that rewrite its headers at each stop.
Complete Request Journey
AWS NAT Gateway Flow
Estimated Time: 4-5 hours
Difficulty: Intermediate to Advanced
Prerequisites: All previous modules

Quick Reference: IP Addressing Fundamentals

Before diving into scenarios, let’s refresh the key concepts you’ll see throughout.

Private vs Public IP Addresses

Private IPs (RFC 1918)

Not routable on the internet - used inside your network only.Key insight: Millions of networks can use 192.168.1.1 simultaneously - they’re isolated!

Public IPs

Globally unique and routable - your identity on the internet.
  • Assigned by ISPs (who get them from regional registries)
  • Required for any internet-facing service
  • Expensive and limited (IPv4 exhaustion)
Examples: 8.8.8.8 (Google DNS), 151.101.1.140 (Reddit)

CIDR Notation Cheat Sheet

CIDR tells you how many bits are for the network vs hosts:
Why -2? First address = Network ID (192.168.1.0), Last address = Broadcast (192.168.1.255). Neither can be assigned to a host.

Special Addresses You’ll See

NAT - The Bridge Between Private & Public

NAT translates private IPs to your single public IP, tracking connections so responses return correctly.

Scenario 1: Typing β€œgoogle.com” in Your Browser

This is the classic interview question. Let’s trace every step in detail.

The Setup

Step-by-Step Flow

1

Browser Parses URL

2

DNS Resolution

Browser Cache Check:
OS Cache Check:
DNS Query:
3

TCP Connection (3-Way Handshake)

At your router (NAT translation):
4

TLS Handshake

5

HTTP Request

Inside the encrypted TLS tunnel:
6

Google's Infrastructure

7

HTTP Response

8

Packet Journey Back

9

Browser Renders Page

  • Parse HTML
  • Fetch CSS, JS, images (parallel connections)
  • Execute JavaScript
  • Render DOM
  • Display page

Packet at Each Layer


Scenario 2: Two Offices with Same Private IPs Accessing the Internet

The Question

β€œIf Company A uses 192.168.1.0/24 and Company B also uses 192.168.1.0/24, how do they both access the same website?”

The Setup

How It Works

Step 1: Company A’s PC sends request
Step 2: Company B’s PC sends request (at same time)
Step 3: Server sees two different sources
Step 4: Responses route correctly

The Key Insight

Private IPs are only significant within their own network. Once packets leave through NAT, the private IP is replaced with the unique public IP. The internet never sees 192.168.1.5 - it only sees the public IPs.This is why millions of home networks can all use 192.168.1.0/24 without any conflict!

Scenario 3: Private Subnet Accessing the Internet (AWS)

The Setup

The Flow: App Server Updating Packages

Step 1: App server needs to download update
Step 2: Route table lookup
Step 3: Packet sent to NAT Gateway
Step 4: NAT Gateway translates
Step 5: Packet goes to Internet Gateway β†’ Internet Step 6: Ubuntu server responds
Step 7: NAT Gateway reverse translates
Step 8: App server receives response

Why Can’t Internet Reach App Server?


Scenario 4: Microservice Calling Another Microservice

This scenario is the modern equivalent of Scenario 1, but inside a cluster instead of across the internet. Think of Kubernetes networking like an office building’s internal phone system. Each desk (pod) has an extension (IP). The directory service (CoreDNS) translates team names (β€œorder-service”) to the right extension. The PBX system (kube-proxy/iptables) handles call routing and load balancing across team members.

The Setup (Kubernetes-style)

The Flow

Step 1: DNS Resolution (CoreDNS)
Step 2: Request to ClusterIP
Step 3: Pod-to-Pod Networking
Step 4: Response

Scenario 5: SSH Through a Bastion Host

The Setup

Method 1: Two-Step SSH

Method 3: SSH Config File

The Network Flow

Security Group Rules


Scenario 6: HTTPS Request Through CloudFlare CDN

The Setup

DNS Setup

The Flow: First Request (Cache Miss)

Step 1: User β†’ CloudFlare Edge
Step 2: CloudFlare checks cache
Step 3: CloudFlare β†’ Origin
Step 4: Origin responds

The Flow: Second Request (Cache Hit)

What CloudFlare Adds


Key Takeaways

NAT Enables Internet Scale

Millions can share private IP ranges because NAT makes them unique at the public IP level.

Every Hop Adds Latency

Each router, NAT, proxy adds processing time. Minimize hops for performance.

Layers Build On Each Other

Application relies on Transport relies on Network relies on Data Link.

Security at Every Layer

Firewalls, Security Groups, NACLs, TLS - defense in depth.

What’s Next?

Module 17: IPv6 Deep Dive

Understand the future of IP addressing with IPv6 in detail.