Network Security & Internet
Fundamentals

Pre-requisite Study Guide for Cloudflare Solutions Engineers

Suraj Nair
Senior Solutions Engineer — Cloudflare

10 Modules · 86 Topics
August 2026

Table of Contents

Click any topic to jump directly to it

3.6NAT
3.7DHCP
4.3IXPs
4.8Anycast
4.11VPNs
6.8DNSSEC
7.7Cookies
7.9Caching
7.10CORS
7.12WebSockets
9.5CSRF
Module 1 of 10

Computing Basics

Understanding what data actually is before it travels anywhere.

Module 1 · Topic 1.1

What is Data?

What is Data?

Data is simply information — any information. Your name is data. A photo is data. A song is data. The temperature outside is data. The price of a stock is data.

Humans represent information in many ways — words, drawings, numbers, sounds. But computers can't understand any of those directly. Computers are electronic machines. They only understand one thing: is there an electrical signal or not?

Signal Present
1
ON · electricity flowing · high voltage
No Signal
0
OFF · no electricity · low voltage

That's it. That's the entire foundation of computing and networking. Everything — every photo, video, email, webpage — is ultimately stored and transmitted as a long sequence of 1s and 0s.

Binary — The Language of Computers

This system of representing everything as 1s and 0s is called binary.

Humans use the decimal system — 10 digits (0–9). We chose 10 probably because we have 10 fingers. Computers use binary — 2 digits (0 and 1) — because transistors (the tiny switches inside every chip) have exactly two states: on or off.

Transistor — The Fundamental Building Block
OFF No electricity flowing = 0 ON Electricity flowing = 1 A modern CPU chip contains billions of these transistors

Bits — The Smallest Unit of Data

A single 0 or 1 is called a bit — short for binary digit. It is the absolute smallest possible unit of data. One bit alone can only represent two things: yes/no, on/off, true/false.

Bytes — The Basic Working Unit

8 bits grouped together = 1 Byte. With 8 bits you get 2⁸ = 256 possible combinations — enough to represent every letter (upper and lowercase), every digit, and common symbols.

This mapping of characters to binary numbers is called ASCII (American Standard Code for Information Interchange):

ASCII — How Characters Map to Binary
Character Binary (8 bits) Decimal value "A" 01000001 65 "B" 01000010 66 "a" 01100001 97 space 00100000 32

So the word "Hi" stored in a computer is: 01001000 01101001 — two bytes, sixteen 1s and 0s.

Data Sizes

UnitSizeReal-world example
1 bitSingle 0 or 1One switch position
1 Byte8 bitsOne character of text
1 KB1,024 bytesA short text email
1 MB1,024 KBA photo from your phone
1 GB1,024 MBA HD movie
1 TB1,024 GBA large hard drive
1 PB1,024 TBWhat large companies store
1 EB1,024 PBWhat the entire internet generates per day

How Bits Travel Physically

When data travels across a network it's still 1s and 0s — just represented differently depending on the physical medium:

MediumHow 1 is sentHow 0 is sentUsed for
Copper cable (Ethernet)High voltage pulseLow voltageLocal networks, short distances
Fiber opticLight pulseNo lightLong distances, submarine cables
WiFiRadio wave pattern ARadio wave pattern BWireless local networks

The data itself doesn't change — only the physical representation does. At the receiving end it's always converted back to 1s and 0s.

💡 Analogy — The Light Switch Wall

Imagine a wall of 8 light switches in a row. Each switch can be independently UP (on = 1) or DOWN (off = 0). The pattern of ups and downs represents one byte — one character of data.


Switch: 1 2 3 4 5 6 7 8 State: ↑ ↓ ↓ ↓ ↓ ↓ ↓ ↑ Binary: 1 0 0 0 0 0 0 1 = 65 = "A"

A modern CPU has billions of these switches (transistors), flipping billions of times per second. That is all computing is — incredibly fast switch flipping.

⚠️ Common Misconceptions
  • "Bits and bytes are the same thing" — Not the same. 1 byte = 8 bits. Easy to confuse, critical to keep distinct — especially when reading internet speeds.
  • "100 Mbps means I download at 100 MB/s" — No. Internet speeds are in megabits. Divide by 8: 100 Mbps = 12.5 MB/s actual speed. ISPs advertise in bits because the number sounds bigger.
  • "Data is only text" — Everything is data. Photos, video, audio, code — all ultimately 1s and 0s. A 4K video is just a very, very long sequence of bits.

Module 1 · Topic 1.2

Number Systems

Why Three Number Systems?

Networking regularly uses three number systems. You don't need to be a mathematician — you need to understand what each is, why it exists, and how to read it. Converting between them is a bonus, not a core skill.

SystemBaseDigits UsedUsed For
Decimal100–9Human everyday use
Binary20, 1How computers work internally
Hexadecimal160–9, A–FMAC addresses, IPv6, memory addresses

Decimal — What You Already Know

Decimal is base 10. Uses 10 digits: 0–9. When you run out of single digits, you add another column to the left. Each column represents a power of 10:

How Decimal Columns Work — Example: 1,342
10³ = 1000 10² = 100 10¹ = 10 10⁰ = 1 1 3 4 2 (1×1000) + (3×100) + (4×10) + (2×1) = 1,342

This is so natural we don't even think about it. But this exact same logic applies to every other number system — only the base changes.

Binary — How Computers Think

Binary is base 2. Only two digits: 0 and 1. Each column is a power of 2 instead of a power of 10:

Binary Column Values — Decoding 01000001 = Letter "A" = 65
2⁷ 2⁶ 2⁵ 2⁴ 2⁰ 128 64 32 16 8 4 2 1 0 1 0 0 0 0 0 1 0×128 + 1×64 + 0 + 0 + 0 + 0 + 0 + 1×1 = 65 = Letter "A"
🎡 Analogy — Odometer with Only 2 Digits

Imagine a car odometer where each wheel only has 0 and 1 instead of 0–9. It counts the same way as a normal odometer — it just runs out of digits much faster and needs more columns to represent the same numbers. That's all binary is.


Single wheel: 0 → 1 → rolls over → 0 (carry the 1 left) Two wheels: 00 → 01 → 10 → 11 → 00 (carry again) (0) (1) (2) (3) (back to 0)

Hexadecimal — Compact Binary

Hexadecimal (hex) is base 16. It uses 16 digits: 0–9 and then A–F for values 10–15. Letters were chosen simply because we ran out of single-digit numbers after 9.

The key insight: one hex digit = exactly 4 binary bits. This makes hex a compact shorthand for binary — much easier to read and write without losing any information.

Hex Compresses Binary — Same Value, Much Shorter
Binary: 0100 0001 = 8 characters Hex: 4 1 = 0x41 = 2 characters Both represent exactly the same value: the letter "A" = 65

Decimal ↔ Binary ↔ Hex — Side by Side

DecimalBinaryHexNote
00000000000Minimum value of one byte
10000010100AA is 10 in hex
15000011110FF is 15 in hex
160001000010Hex "carries over" at 16
650100000141Letter "A" in ASCII
25511111111FFMaximum value of one byte

Where You'll See Hex in Networking

MAC Addresses
00:1A:2B:3C:4D:5E

Each pair = 1 hex byte = 8 bits. Six pairs = 48 bits total.
IPv6 Addresses
2606:4700::

Each group = 4 hex digits = 16 bits. Far more readable than raw binary.
Prefix "0x"
You'll often see 0x41 written in technical docs. The 0x prefix simply means "this number is in hex."
💡 The Most Important Hex Fact

FF in hex = 255 in decimal = 11111111 in binary — the maximum value of one byte. This is exactly why IPv4 address octets max out at 255. Each octet is one byte, and one byte can't go higher than 255.

⚠️ Common Misconceptions
  • "I need to convert between these systems in my head" — You don't. As an SE you just need to recognise which system you're looking at and roughly what it represents. Tools do the math.
  • "Binary is slow because it needs more digits" — No. Computers process entire bytes or 64 bits simultaneously in parallel. Binary is the most efficient system for electronics.
  • "Hex uses letters because someone made a mistake" — Intentional design. Letters A–F extend the single-character digit set beyond 9, keeping each value as one character.

Module 1 · Topic 1.3

How Computers Store Data

A computer processes data — but processing takes time. Data needs somewhere to live while the computer works on it, and somewhere to persist when the power goes off. These are two very different requirements solved by two very different types of storage.

⚡ Temporary Storage — RAM
Lives only while powered on.
Extremely fast.
Small capacity.
Expensive per GB.

Use: active working memory
💾 Permanent Storage — HDD / SSD
Survives power off.
Slower than RAM.
Large capacity.
Cheap per GB.

Use: files, OS, applications

RAM — Random Access Memory

RAM is your computer's working space. Everything actively being used right now lives in RAM — your open browser, your document, the video you're watching. The CPU needs to access data billions of times per second, and RAM delivers it in nanoseconds.

Inside a RAM Cell — How One Bit is Stored
CAPACITOR (stores charge) Charged = 1 Empty = 0 TRANSISTOR (controls access) 🔀 Opens gate to read or write To CPU One cell = One bit. Billions of these make up your RAM chip.
⚡ Critical Property — Volatile

RAM requires constant power to hold its charge. Cut the power → all data instantly gone. This is why unsaved work disappears in a crash, and why restarting fixes many software problems — RAM is wiped completely clean.

HDD — Hard Disk Drive

HDDs are permanent storage. A completely mechanical device with actual moving physical parts — spinning magnetic platters and a read/write head that physically moves across them.

Inside a Hard Disk Drive
Magnetic tracks 5,400–7,200 RPM Read/Write Head Platter (spins constantly) North pole = 1 | South pole = 0 Spindle Motor

To read data the head must physically seek to the right track, then wait for the platter to spin the right sector underneath — this mechanical movement takes milliseconds, making HDDs vastly slower than RAM.

SSD — Solid State Drive

SSDs also provide permanent storage but with no moving parts at all. They use flash memory — transistors that trap electrical charges permanently, even without power.

Flash Memory Cell — How SSDs Store a Bit Without Power
Source Channel (electron flow path) Drain Floating Gate Control Gate Electrons trapped here = 0 Trapped electrons persist without power → non-volatile No moving parts → 100,000× faster than HDD seeks

HDD vs SSD — Full Comparison

PropertyHDDSSD
TechnologyMagnetic spinning plattersFlash memory chips
Moving partsYes (motor, platters, arm)None
Access speed5–10 ms0.05–0.1 ms
CapacityUp to 20TBUp to 8TB (typical)
Price per GB~$0.02/GB (very cheap)~$0.08/GB
DurabilityFragile — drops damage itDrop-resistant
NoiseAudible spinningSilent
Non-volatile?✅ Yes✅ Yes
Best forBulk cold storageOS, apps, active files

The Full Memory Hierarchy

Storage isn't just RAM vs disk. There is a full hierarchy from fastest and smallest to slowest and largest — each level a tradeoff between speed and cost.

🔴 CPU Registers Bytes · Inside CPU · ~0.3 ns · Most expensive
🟠 CPU Cache (L1 / L2 / L3) KB to MB · On chip · ~1–10 ns
🔵 RAM GB · Separate chip · ~50–100 ns
🟢 SSD Hundreds of GB to TB · ~0.05–0.1 ms
⚫ HDD TB · Mechanical · ~5–10 ms · Cheapest
← FASTER · MORE EXPENSIVE · SMALLER SLOWER · CHEAPER · LARGER →

What Actually Happens When You Open an App

Flowchart — App Launch Lifecycle
flowchart LR A["📁 App file\n(on SSD/HDD)"] -->|"You double-click"| B["OS copies app\nfrom SSD → RAM"] B --> C["CPU reads\nfrom RAM"] C --> D["App runs\non screen"] D -->|"You close app"| E["RAM cleared\n(data gone)"] A -->|"Still safely stored"| A style A fill:#2a4cc7,color:#fff,stroke:#1a3399 style B fill:#c85a00,color:#fff,stroke:#a04600 style C fill:#1a1a2e,color:#fff,stroke:#f6821f style D fill:#1a7a44,color:#fff,stroke:#155e35 style E fill:#b51c1c,color:#fff,stroke:#8b1414

This is why apps take a moment to open — that's the time copying from storage into RAM. Once loaded, everything runs fast because the CPU is reading from RAM, not the disk.

🍳 Analogy — The Chef's Kitchen
  • Registers/Cache = Ingredients in the chef's hands right now — instant access, tiny amount
  • RAM = Ingredients on the countertop — grab in seconds, limited space
  • SSD = Ingredients in the fridge — walk over and get it, takes a moment
  • HDD = Ingredients in the warehouse next door — slow to fetch, huge capacity

A smart chef keeps active ingredients on the counter (RAM). They'd never walk to the warehouse for every single pinch of salt — just as a CPU never reads every byte directly from a hard drive.

⚠️ Common Misconceptions
  • "RAM and storage are the same thing" — Completely different. RAM = temporary working space. SSD/HDD = permanent files. Confusing these is extremely common.
  • "SSD data disappears when power off" — That's RAM, not SSD. SSDs are non-volatile. SSD data persists without power.
  • "More RAM makes everything faster" — RAM prevents slowdowns from running out of working space. It won't make a slow app suddenly fast — that depends on the CPU and storage speed.
  • "Restarting permanently fixes problems" — It fixes problems caused by bad data filling RAM. Problems from corrupted files on disk persist through restarts.

Module 1 · Topic 1.4

How Computers Process Data

The CPU — Brain of the Computer

CPU stands for Central Processing Unit. It is the component that actually executes instructions — it does all the thinking. Everything else — RAM, storage, keyboard, screen — exists either to feed data to the CPU or receive results from it.

CPU's Role — Everything Flows Through It
INPUT keyboard, network CPU Central Processing Unit OUTPUT screen, storage, network RAM ↕ working data

The Fetch–Decode–Execute Cycle

This is the fundamental loop every CPU runs, billions of times per second. Everything a computer does — from loading a webpage to running a video game — is just this cycle repeating at incredible speed.

The CPU Cycle — Runs Billions of Times Per Second
flowchart LR A["🔽 FETCH\nGet next instruction\nfrom RAM"] --> B["🔍 DECODE\nFigure out what\nthe instruction means"] B --> C["⚡ EXECUTE\nCarry out the\noperation"] C -->|"repeat forever"| A style A fill:#1a1a2e,color:#fff,stroke:#f6821f,stroke-width:2px style B fill:#c85a00,color:#fff,stroke:#a04600,stroke-width:2px style C fill:#1a7a44,color:#fff,stroke:#155e35,stroke-width:2px
1. Fetch
CPU goes to RAM and picks up the next instruction. Instructions are things like "add these two numbers" or "move this data to the screen."
2. Decode
CPU interprets the instruction. What operation is this? What data does it need? It translates binary into an action plan.
3. Execute
CPU carries out the operation — add, subtract, compare, move data. Result goes back to RAM or a register.

What's Inside a CPU

1. Cores

A core is one complete fetch-decode-execute unit. One core = one thing at a time. Multiple cores = multiple things simultaneously.

Inside a Multi-Core CPU Chip
CPU Chip Core 1 F→D→E Core 2 F→D→E Core 3 F→D→E Core 4 F→D→E Shared Cache (L3) — Ultra-fast memory shared between all cores
DeviceTypical CoresUsed For
Budget laptop4 coresEveryday tasks
High-end laptop8–12 coresDevelopment, video editing
Desktop workstation16–32 coresHeavy computation
Server32–128 coresRunning many applications simultaneously
2. Clock Speed

The CPU has an internal clock — a crystal that oscillates at a fixed frequency, setting the rhythm for every operation. Every tick of the clock = one cycle. Operations complete in one or more cycles.

1 Hz
1 cycle per second.
Impossibly slow for a CPU.
1 GHz
1,000,000,000 cycles per second.
1 billion ticks every second.
3–5 GHz
Typical modern CPU.
3–5 billion cycles per second.
💡 Cores vs Clock Speed

Higher clock speed = each core does things faster. More cores = more things done simultaneously. A 4-core 3GHz CPU is often better than a 2-core 5GHz CPU for server workloads — because servers run many tasks at once, not one task very fast.

3. CPU Cache

We learned about the memory hierarchy in Topic 1.3. The CPU has its own tiny, ultra-fast memory built directly onto the chip called cache. It stores copies of data the CPU uses most frequently so it doesn't have to go all the way to RAM every time.

L1 Cache — per core ~32KB · ~0.3 ns · Fastest possible
L2 Cache — per core ~256KB · ~1 ns
L3 Cache — shared across cores ~8–32MB · ~10 ns
RAM 8–64GB · ~50–100 ns

How This All Connects — Running a Program

From Storage to Execution — Full Flow
sequenceDiagram participant D as 💾 SSD/HDD participant R as 🧠 RAM participant C as ⚡ CPU Cache participant P as 🔴 CPU Core D->>R: OS loads program into RAM R->>C: CPU pulls needed instructions into cache C->>P: CPU fetches instruction from cache P->>P: Decode instruction P->>P: Execute instruction P->>R: Write result back to RAM Note over P: Repeats billions of times per second
🏭 Analogy — The Factory Assembly Line
  • SSD/HDD = Raw materials warehouse — stores everything long term
  • RAM = Factory floor — active work in progress
  • CPU Cache = Worker's immediate toolbox — most-used items within arm's reach
  • CPU Core = The worker — actually does the assembly, one instruction at a time
  • Multiple Cores = Multiple workers on the same assembly line — more throughput
  • Clock Speed = How fast each worker moves
⚠️ Common Misconceptions
  • "More cores always means faster" — Only if the software is written to use multiple cores. A single-threaded program runs on one core regardless of how many exist.
  • "GHz is the only measure of CPU speed" — Architecture matters more. A modern 3GHz CPU easily outperforms an older 5GHz CPU because it does more work per cycle.
  • "The CPU stores data" — The CPU processes data. Storage is RAM and disk. The CPU itself holds only tiny amounts in registers and cache.

Module 1 · Topic 1.5

Clients vs Servers

The Most Fundamental Relationship in Networking

Everything on the internet is built on one simple relationship — one device asks for something, another device provides it. The one that asks is the client. The one that provides is the server.

The Client–Server Model
CLIENT Makes requests e.g. your browser REQUEST RESPONSE SERVER Responds to requests e.g. google.com host The client always initiates. The server always waits and responds.

What is a Client?

A client is any device or application that initiates a request to get something — a webpage, a file, data, a video stream.

The word "client" doesn't refer to a type of hardware. It refers to a role. Your laptop is a client when you browse the web. Your phone is a client when you open Instagram. Even a server can act as a client when it requests data from another server.

Common Client Examples
• Web browser (Chrome, Safari)
• Mobile app (Instagram, Slack)
• Email client (Outlook, Gmail app)
• Video player (Netflix app)
• Command line tools (curl, wget)
• One server requesting from another
What Clients Do
• Initiate the conversation
• Send a request to a server
• Wait for a response
• Process and display the response
• Can connect to many servers
• Don't need a fixed address

What is a Server?

A server is any device or application that listens for incoming requests and responds to them. The word comes from "to serve" — it serves data to whoever asks.

Again — "server" is a role, not a type of hardware. A server is usually a powerful computer in a data center running 24/7, but technically any computer can act as a server.

Common Server Examples
• Web server (serves HTML pages)
• Database server (stores/retrieves data)
• File server (stores/serves files)
• Mail server (sends/receives email)
• DNS server (answers name lookups)
• API server (serves data to apps)
What Servers Do
• Listen constantly on specific ports
• Wait for incoming requests
• Process the request
• Send back a response
• Serve thousands of clients at once
• Always have a fixed address (IP)

The Key Difference — Who Starts the Conversation

The most important distinction: clients always initiate, servers always wait.

A server never randomly reaches out to a client. It sits there listening until a client knocks. When a client sends a request, the server wakes up, processes it, responds, and goes back to waiting. This is called a request–response model.

💡 Ports — How Servers Listen

Servers listen on specific port numbers — numbered doors on a machine. A web server listens on port 80 (HTTP) and port 443 (HTTPS). A mail server listens on port 25. When a client connects, it specifies both the IP address and the port. Think of the IP as the building address and the port as the specific door inside the building.

One Machine Can Be Both

Client and server are roles, not fixed identities. A single machine can play both roles simultaneously:

A Machine Can Be Client AND Server at the Same Time
Your Browser App Server Acts as SERVER (to your browser) AND Acts as CLIENT (to the database) Database Server client only server + client server only

This is how almost every web application works — your browser talks to an app server, which in turn talks to a database server. The app server is simultaneously a server (to you) and a client (to the database).

Client vs Server — Full Comparison

PropertyClientServer
RoleRequests data or servicesProvides data or services
Who initiatesAlways starts the conversationNever initiates — always waits
Fixed address needed?No — IP can changeYes — needs a known, stable IP or domain
Runs 24/7?No — used as neededYes — must always be available
Serves many at once?No — one userYes — thousands simultaneously
HardwareLaptop, phone, tabletPowerful computer in a data center
ExamplesChrome browser, mobile appgoogle.com host, API backend, DNS server

How a Server Handles Thousands of Clients at Once

When you visit google.com, millions of other people are doing the same thing at that exact moment. How does one server handle all of them?

The answer is that it's never really just "one server." Large-scale services use:

Multiple Servers
Google has hundreds of thousands of servers globally. Requests are distributed across them. No single machine handles everything.
Load Balancers
A device that sits in front of all servers and distributes incoming requests evenly. One of the core Cloudflare products you'll learn later.
Concurrency
Each server handles many requests simultaneously using multiple CPU cores and threads — not one at a time.
🍽️ Analogy — Restaurant

Think of a restaurant:

  • Customers = clients — they walk in, place an order, wait for food
  • Kitchen = server — it waits for orders, prepares food, sends it out
  • Waiter = network — carries requests to the kitchen, brings responses back
  • Multiple chefs = multiple CPU cores handling requests concurrently
  • Multiple restaurant branches = multiple servers behind a load balancer

The kitchen never walks out to a random customer's house and starts cooking. It waits. Customers come to it. That's the client–server model.

⚠️ Common Misconceptions
  • "A server is a special type of computer" — Any computer can be a server. Your laptop could technically be a server. "Server" is a role, not hardware. In practice, servers are powerful machines in data centers because they need to run 24/7 at scale.
  • "The server and client must be different physical machines" — Not necessarily. During development, engineers often run a server and connect to it as a client on the same laptop. This is called localhost.
  • "Once something is a server it can't be a client" — Wrong. As shown above, most servers in the real world also act as clients to other servers (databases, APIs, etc.).
💡 Cloudflare Is Both — A Reverse Proxy

When a user visits a Cloudflare-protected website, Cloudflare plays both roles simultaneously:

  • Server to the user — receives the HTTP request, applies WAF/DDoS/cache, sends a response
  • Client to the origin — forwards clean traffic to the customer's server, receives the response back

This pattern is called a reverse proxy — the foundation of every Cloudflare App/API Security product.


Module 1 · Topic 1.6

Operating Systems

What is an Operating System?

An Operating System (OS) is software that acts as the middleman between hardware and applications. Every computer — laptop, phone, server — needs an OS. Without it, hardware is just silicon and metal with no idea what to do.

Think of the OS as the manager of a building. The hardware is the building itself (floors, electricity, elevators). Applications are the tenants. The OS manages everything in between — allocating resources, handling requests, making sure tenants don't interfere with each other.

Where the OS Sits — Between Hardware and Applications
APPLICATIONS Browser · Email · Database · Web Server · Games OPERATING SYSTEM Windows · macOS · Linux · Android · iOS HARDWARE CPU · RAM · SSD · Network Card · Screen

What Does the OS Actually Do?

The OS has six core jobs it performs constantly behind the scenes:

1. Process Management
Decides which application gets CPU time and when. Runs multiple apps "simultaneously" by switching between them thousands of times per second — so fast it feels instant.
2. Memory Management
Allocates RAM to each running application. Makes sure one app can't read or corrupt another app's memory. Manages swap space when RAM is full.
3. Storage Management
Manages the file system — organising files into folders, reading/writing to disk, handling permissions (who can access what file).
4. Device Management
Communicates with hardware via drivers. When you plug in a keyboard or network card, the OS loads the right driver so applications can use it without needing to know the hardware details.
5. Networking
Manages network connections — assigns IP addresses, opens and closes ports, sends and receives packets. Applications ask the OS to "open a connection" — they don't talk to the network card directly.
6. Security & Access Control
Manages users, permissions, and isolation. Ensures applications can't access resources they're not allowed to. Enforces which user can run which program.

The Kernel — The Core of the OS

Inside every OS is a component called the kernel — the innermost, most privileged piece of software. The kernel runs directly on the hardware and has total control.

The Kernel — Innermost Layer of the OS
User Applications (browser, editor, server software) OS Services (file system, networking, UI) KERNEL Hardware control ↓ Hardware (CPU, RAM, Disk, Network) ↓

Applications never talk directly to hardware. They make requests to the OS via an interface called system calls (syscalls). The OS then carries out the action on their behalf. This is a critical security boundary — it prevents badly written or malicious apps from corrupting the system.

The Three OS Families You Need to Know

In networking and Cloudflare conversations, you'll encounter three OS families constantly:

OS FamilyExamplesWhere You'll See It
LinuxUbuntu, Debian, CentOS, Amazon LinuxAlmost every server on the internet. Cloudflare runs Linux. AWS, GCP, Azure run Linux. Your customers' servers run Linux.
WindowsWindows Server 2019/2022Enterprise environments — especially companies running Microsoft Active Directory, IIS web servers, .NET applications.
macOSmacOS Ventura, SonomaDeveloper laptops. Rarely on servers.
💡 Why Linux Dominates Servers

Linux is free and open source — no licensing costs. It's extremely stable (servers run for years without rebooting). It's highly configurable and efficient. It runs on everything from a tiny Raspberry Pi to a 128-core server. Every major cloud provider, every CDN, every web host runs Linux. When you SSH into a customer's server or a Cloudflare system — it's Linux.

OS Relevance to Networking

The OS plays a direct role in every network connection. When your browser wants to load a webpage, here's what actually happens at the OS level:

How an App Makes a Network Connection — Apps Never Touch Hardware Directly
① Browser App "I need data from 142.250.80.46:443" asks OS ② Operating System Creates socket Assigns local port e.g. :51234 via driver ③ Network Card Converts packets → signals electrical / radio ④ Internet Packets travel to server, response returns REQUEST RESPONSE The browser never touches the network card. The OS is always in the middle.

This is why networking concepts like ports, sockets, and IP addresses are OS-level concepts — not just application concepts. The OS manages all of this on behalf of every application running on the machine.

🏢 Analogy — Office Building Manager
  • Building = Hardware (CPU, RAM, disk, network)
  • Building Manager (OS) = Allocates offices, controls electricity, manages security
  • Tenants (Applications) = Use the building but go through the manager for everything
  • Kernel = The manager's private office — total control, restricted access
  • System calls = Submitting a formal request to the manager ("I need more office space," "I need internet access")

Tenants never wire their own electricity or dig network cables. They request it through the manager. Applications never talk to hardware directly — they request it through the OS.

⚠️ Common Misconceptions
  • "The OS is just the desktop UI" — The UI (what you see on screen) is just one component. The vast majority of the OS runs invisibly — process scheduling, memory management, networking — all happening with no visible interface. Linux servers often have no UI at all.
  • "Applications talk directly to hardware" — Never. All hardware access goes through the OS kernel. This is a fundamental security and stability principle.
  • "Windows is more common on servers" — Not on the internet. Linux dominates server infrastructure by a wide margin. Windows Server exists but is primarily in corporate internal environments.

Module 1 · Topic 1.7

Processes & Ports

What is a Process?

When you run a program — a browser, a web server, a database — the OS doesn't just "run" it as a static thing. It creates a process — a live, running instance of that program, with its own slice of CPU time, its own chunk of RAM, and its own identity on the system.

The key distinction: a program is a file sitting on disk (like chrome.exe). A process is that program actively running in memory, doing work.

Program
A static file on disk.
Instructions waiting to be run.

Like a recipe written in a book.
Does nothing on its own.
Process
A program actively running.
Loaded into RAM, using CPU.

Like a chef actively cooking
using that recipe right now.

You can run the same program multiple times — each instance becomes a separate process. Open three browser windows? That might be three separate processes, each with its own memory.

Process IDs (PIDs)

Every process gets a unique number from the OS called a PID (Process ID). The OS uses this to track and manage processes — to kill one, prioritise one, or monitor its resource use.

$ ps aux | head -5 ← list running processes on Linux USER PID %CPU %MEM COMMAND root 1 0.0 0.1 /sbin/init root 412 0.0 0.2 /usr/sbin/sshd www 891 0.4 1.2 nginx: master process mysql 1024 1.1 3.5 /usr/sbin/mysqld

On this server: the web server (nginx) has PID 891, the database (MySQL) has PID 1024. The OS tracks them separately, gives each their own RAM allocation, and can kill either independently.

Threads — Processes Within a Process

A process can spawn multiple threads — lightweight sub-units of execution that share the same memory but can run concurrently on different CPU cores.

Process vs Threads
PROCESS (e.g. Web Server — PID 891) Shared memory space · Own RAM allocation · Own PID Thread 1 Handle request from User A Thread 2 Handle request from User B Thread 3 Handle request from User C All threads share same memory — run concurrently on different CPU cores

This is how a web server handles thousands of simultaneous visitors — one process, many threads, each handling one request at a time.

What is a Port?

Now here's the bridge between processes and networking.

A server machine has one IP address. But it might be running dozens of processes simultaneously — a web server, a database, an SSH server, a mail server. When a network packet arrives at that IP address, how does the OS know which process it's meant for?

The answer is ports.

A port is a numbered endpoint — a logical channel — that a process listens on. When a packet arrives, the OS reads the port number and routes it to the correct process.

One IP Address, Many Ports — Traffic Routed to the Right Process
Incoming Traffic 104.21.5.10 OS reads port number, routes to right process :443 → HTTPS Web Server (nginx process) :80 → HTTP Web Server (nginx process) :22 → SSH Server (sshd process) :3306 → Database (mysqld process)

The Most Important Port Numbers

Ports range from 0 to 65,535. They're divided into three ranges:

RangeNameDescription
0 – 1023Well-Known PortsReserved for standard services. Assigned by IANA. Require root/admin to use.
1024 – 49151Registered PortsUsed by applications. Less strict, registered with IANA by convention.
49152 – 65535Ephemeral PortsTemporary ports assigned by the OS to clients making outbound connections.

Well-Known Ports You Must Know

PortProtocolWhat it does
20 / 21FTPFile Transfer Protocol — transferring files
22SSHSecure Shell — encrypted remote login to servers
25SMTPSimple Mail Transfer Protocol — sending email
53DNSDomain Name System — name to IP lookups
80HTTPHyperText Transfer Protocol — unencrypted web traffic
443HTTPSHTTP Secure — encrypted web traffic (TLS)
3306MySQLMySQL database connections
5432PostgreSQLPostgreSQL database connections
6379RedisRedis in-memory data store
8080HTTP altCommon alternative HTTP port for dev/testing

Sockets — IP + Port Together

A port alone doesn't identify a unique connection. What uniquely identifies a connection is the combination of IP address + port on both ends — called a socket.

A Socket — The Full Address of a Network Connection
Client Socket 192.168.1.5 : 54231 connection Server Socket 142.250.80.46 : 443 ephemeral port (assigned by OS) well-known port (HTTPS)

The four values together — client IP, client port, server IP, server port — uniquely identify every network connection on the internet. The OS tracks millions of these simultaneously.

Ephemeral Ports — The Client Side

You know servers listen on well-known ports (80, 443, etc.). But what port does the client use?

When your browser opens a connection to a website, the OS automatically assigns a temporary random port (between 49152–65535) to that connection. This is an ephemeral port — it exists only for the duration of that connection and is released when it closes.

Your browser opens three tabs simultaneously: Tab 1 → google.com:443 using local ephemeral port 51234 Tab 2 → github.com:443 using local ephemeral port 51235 Tab 3 → cloudflare.com:443 using local ephemeral port 51236 All go out from the same IP, different ports → OS tracks each separately
💡 Building + Door Analogy

Think of an IP address as a building address and a port as a specific door in that building. Sending to 142.250.80.46:443 means: go to that building, use door 443 (HTTPS). Door 22 leads to SSH. Door 3306 leads to the database. Same building, completely different destinations.

How a Server Listens on a Port

When a server process wants to accept connections, it goes through these steps with the OS:

1
Create a socket

Process asks OS to create a socket — a communication endpoint.

2
Bind to a port

Process tells OS: "I want to own port 443." OS registers this — no other process can use 443 while this one has it.

3
Listen

Process tells OS it's ready to accept connections. OS starts queuing incoming connection attempts.

4
Accept

For each incoming connection, OS hands it to the process. Process spins up a thread to handle it while continuing to listen for new ones.

📞 Analogy — Office Phone System
  • IP address = The company's main phone number
  • Port = The extension number (press 1 for sales, press 2 for support)
  • Process = The person sitting at that extension, waiting for calls
  • Ephemeral port = The temporary line number assigned to your outgoing call
  • Socket = The active call — your line + their extension, both identified
⚠️ Common Misconceptions
  • "A server can only use one port" — A server can listen on many ports simultaneously. nginx commonly listens on both 80 and 443 at the same time.
  • "Port 80 and 443 are always web servers" — By convention, yes. But any process can listen on any port. You could technically run a database on port 443 (though that would be very confusing).
  • "Clients don't have ports" — They do — ephemeral ports assigned by the OS for each outgoing connection. You just don't configure them manually.
  • "Firewall blocking a port stops the process" — No. The process keeps running and listening. The firewall just drops packets before they reach it. The process has no idea — it never sees the blocked traffic.
💡 Cloudflare's Proxied Ports

Cloudflare only proxies traffic on specific ports. When a customer's domain is proxied (orange cloud), only these ports are accepted at Cloudflare's edge:

HTTP portsHTTPS ports
80, 8080, 8880, 2052, 2082, 2086, 2095443, 2053, 2083, 2087, 2096, 8443

Traffic on any other port is not proxied — it goes directly to the origin, bypassing Cloudflare entirely. This is a common gotcha when customers have services running on non-standard ports.


Module 1 · Key Takeaways

Important to Remember

Everything in Module 1 is foundation. Before moving to Module 2 — Physical Networking — make sure these concepts are solid. You will see every single one of them again throughout this curriculum.

🧱 1.1 — What is Data?
  • Everything a computer stores or transmits is ultimately 1s and 0s (binary)
  • A bit is a single 0 or 1. A byte is 8 bits
  • Internet speeds are in bits (Mbps) — divide by 8 to get bytes (MB/s)
  • Bits travel as electrical signals (copper), light pulses (fiber), or radio waves (WiFi)
🔢 1.2 — Number Systems
  • Decimal (base 10) — human use. Binary (base 2) — how computers work. Hex (base 16) — compact binary for humans
  • One hex digit = exactly 4 binary bits
  • FF hex = 255 decimal = 11111111 binary = max value of one byte
  • This is why IPv4 octets max out at 255 — one byte per octet
  • You will see hex in MAC addresses (00:1A:2B:3C:4D:5E) and IPv6 addresses
💾 1.3 — How Computers Store Data
  • RAM = fast, temporary, volatile — lost when power goes off. Where active work lives
  • SSD = fast, permanent, no moving parts. Where files/OS live
  • HDD = slower, permanent, mechanical. Cheap bulk storage
  • Memory hierarchy: Registers → Cache → RAM → SSD → HDD (fastest to slowest, smallest to largest)
  • When you open an app: file copies from SSD → RAM → CPU reads from RAM
⚡ 1.4 — How Computers Process Data
  • CPU runs one loop forever: Fetch → Decode → Execute
  • Cores = how many things can run simultaneously. Clock speed = how fast each core works
  • CPU has its own ultra-fast memory: L1/L2/L3 cache — checked before going to RAM
  • More cores matters more than clock speed for servers — they handle many requests at once
🖥️ 1.5 — Clients vs Servers
  • Client = initiates requests. Server = waits and responds. Client always starts the conversation
  • Client and server are roles, not hardware types. Any machine can play either role
  • One machine can be both simultaneously — an app server is a server to your browser and a client to its database
  • Servers listen 24/7, need fixed IPs, serve thousands of clients concurrently
⚙️ 1.6 — Operating Systems
  • OS sits between hardware and applications — apps never touch hardware directly
  • Core jobs: process management, memory management, storage, device drivers, networking, security
  • The kernel is the innermost part — has total hardware control
  • Linux runs almost every server on the internet. If you SSH into a server, it's Linux
  • All networking (sockets, ports, connections) is managed by the OS on behalf of applications
🔌 1.7 — Processes & Ports
  • A process is a running instance of a program — has its own PID, RAM, CPU time
  • A port is a numbered endpoint (0–65535) that a process listens on
  • Ports you must know: 22 SSH · 53 DNS · 80 HTTP · 443 HTTPS
  • IP address = building address. Port = specific door in that building
  • A socket = client IP + client port + server IP + server port — uniquely identifies every connection
  • Ephemeral ports (49152–65535) are temporarily assigned by the OS to outgoing client connections
  • Firewall blocking a port does not stop the process — it just drops packets before they arrive
Module 2 of 10

Physical Networking

How bits physically travel between devices — the cables, signals, and hardware that make all networking possible.

Module 2 · Topic 2.1

How Bits Travel — Electrical (Copper)

Before Anything Can Be Networked — Bits Must Travel

In Module 1 we learned that all data is ultimately 1s and 0s. But how do those 1s and 0s actually move from one device to another? They need a physical medium to travel through. The oldest and most common medium is copper wire — carrying bits as electrical signals.

How Electricity Carries Bits

Copper wire conducts electricity. By varying the voltage (the strength of the electrical signal) on a wire, we can encode binary data:

Encoding Bits as Electrical Signals on a Copper Wire
0V High V 0 1 0 0 0 0 0 1 High voltage = 1 · Low/no voltage = 0 · This is the letter "A" (01000001 = 65)

The sender raises voltage for a 1 and drops it for a 0, in rapid pulses. The receiver reads these voltage changes and reconstructs the binary data. This is the essence of electrical communication.

What is an Ethernet Cable?

The most common copper networking cable is an Ethernet cable — the cable with the plastic clip you plug into a laptop or router. It looks simple from outside but has a precise internal structure:

Inside an Ethernet Cable — Cross Section
Outer plastic jacket P1 P2 P3 P4 Pair 1 — Orange Pair 2 — Green Pair 3 — Blue Pair 4 — Brown 8 wires total 4 twisted pairs Wires are twisted together in pairs

Inside every Ethernet cable are 8 copper wires arranged in 4 twisted pairs. The twisting is not decorative — it serves a critical purpose.

Why Are the Wires Twisted?

When electrical current flows through a wire, it creates a small magnetic field around it. This magnetic field can interfere with neighbouring wires — causing errors in the signal. This interference is called crosstalk.

Twisting the two wires of each pair together causes their magnetic fields to cancel each other out. The interference from one wire is neutralised by its twisted partner. The result: a much cleaner signal with far fewer errors.

💡 Why This Matters

This is why you can't just use any wire as a network cable. The precise twist ratio per pair is engineered to specific electromagnetic tolerances. This is also why bending or crushing an Ethernet cable can degrade performance — it disrupts the twist geometry.

Signal Degradation — Why Distance Matters

Electrical signals weaken as they travel along copper wire. This is called signal attenuation. The longer the cable, the weaker the signal arrives at the other end. Beyond a certain distance, the signal is too weak to reliably read — errors occur.

Signal Attenuation — Signal Weakens Over Distance
Start Strong ~50m Weaker ~100m Too weak → signal travels →

This is why Ethernet has a maximum distance of ~100 metres per cable segment. Beyond that, the signal needs to be regenerated by a switch or repeater. In large buildings, you'll find network closets every 100 metres or so for exactly this reason.

Ethernet Cable Categories (Cat Standards)

Not all Ethernet cables are equal. They come in categories (Cat) that define their maximum speed and bandwidth capacity:

CategoryMax SpeedMax FrequencyCommon Use
Cat5e1 Gbps100 MHzOlder office networks — still common
Cat61 Gbps (10Gbps up to 55m)250 MHzModern office and home networks
Cat6a10 Gbps500 MHzData centers, high-performance networks
Cat710 Gbps600 MHzData centers, shielded environments
Cat825–40 Gbps2000 MHzData center server connections

The higher the category, the tighter the twist, the better the shielding, and the higher the frequency the cable can handle — all translating to higher speeds.

The RJ45 Connector

The plastic clip at the end of every Ethernet cable is called an RJ45 connector. It has 8 pins — one for each of the 8 wires inside. When you plug it in, each pin makes contact with a corresponding port on the device, completing the electrical circuit.

RJ45 Connector — 8 Pins, One Per Wire
1 2 3 4 5 6 7 8 8 pins — one per wire RJ45 Connector

Full Path — Bits Travelling Over Copper

End-to-End — How a Bit Travels From One Device to Another Over Copper
flowchart LR A["💻 Device A\nGenerates data\n(1s and 0s)"] --> B["🔌 NIC\nConverts bits to\nvoltage pulses"] B --> C["🔶 Copper Wire\nElectrical signals\ntravel at ~2/3 speed of light"] C --> D["🔌 NIC\nReads voltage pulses\nConverts back to bits"] D --> E["💻 Device B\nReceives data\n(1s and 0s)"] style A fill:#1a1a2e,color:#fff,stroke:#f6821f style B fill:#c85a00,color:#fff,stroke:#a04600 style C fill:#f6821f,color:#fff,stroke:#c85a00 style D fill:#c85a00,color:#fff,stroke:#a04600 style E fill:#1a7a44,color:#fff,stroke:#155e35

The NIC (Network Interface Card) is the hardware component that does the conversion between binary data and electrical signals. We'll cover NICs in depth in Topic 2.4.

Real Example — Your Laptop Sending a Request to a Web Server

You open your laptop, plug in an Ethernet cable, and type cloudflare.com in your browser. Here's exactly what happens at the copper wire level:

Scenario

Laptop 192.168.1.5 → Cloudflare Server 104.21.5.10 over a Cat6 Ethernet cable

1
Browser generates data

Browser creates an HTTP request: GET / HTTP/1.1 Host: cloudflare.com
This text is converted to binary: 01000111 01000101 01010100 ...

2
OS packages it into a packet

OS wraps the data in TCP, IP, then Ethernet headers.
Final structure: [Ethernet header][IP header][TCP header][HTTP data]

3
NIC converts bits to electrical signals

Laptop's NIC takes the binary packet and converts each bit:
1 → high voltage pulse (~2.5V)  |  0 → low voltage (~0V)
Firing at 1 billion pulses per second on a 1 Gbps link.

4
Signals travel through the Cat6 cable

Voltage pulses travel through 4 twisted copper pairs at ~200,000 km/s — reaching the router 3 metres away in nanoseconds.

5
Router's NIC receives and reconstructs

Router's NIC reads the voltage changes, converts them back to bits, and reconstructs the packet. Router reads the destination IP 104.21.5.10 and forwards it toward the internet.

6
Same process repeats at every hop

Cable → NIC → router → cable → NIC → router ... all the way until the packet reaches Cloudflare's server.

💡 Key Insight

The copper cable's job is tiny but critical — it faithfully carries voltage pulses from one NIC to the next. It has no idea what those pulses mean (HTTP request, video stream, email — all looks identical to the wire). The intelligence lives in the devices at each end, not the cable itself.

📡 Analogy — Morse Code on a Wire

Think of Ethernet signalling like Morse code on a telegraph wire. Morse code uses short and long signals (dots and dashes) to represent letters. Ethernet uses high and low voltage to represent 1s and 0s. Same concept — different encoding. Both are just patterns on a wire that the receiver translates back into information.

⚠️ Common Misconceptions
  • "Ethernet cable is just a wire" — It's precisely engineered. The twist ratios, shielding, and conductor quality all matter and directly affect speed and reliability.
  • "Longer cable = slower speed" — Not exactly. Up to 100 metres, speed is the same. Beyond 100 metres, signal degrades and errors occur — that's the limit, not a gradual slowdown.
  • "Cat6 is always better than Cat5e" — For most home/office use, Cat5e's 1 Gbps is more than enough. Cat6 only matters if you need 10 Gbps speeds over short distances.
  • "The cable determines the network speed" — The cable, NIC, and switch all need to support the same speed. A Cat6a cable plugged into a 100 Mbps switch will only run at 100 Mbps.

Module 2 · Topic 2.2

How Bits Travel — Light (Fiber Optic)

Why Fiber?

Copper cable works well up to 100 metres. But what about connecting buildings across a city, countries across continents, or continents across oceans? Electrical signals can't travel thousands of kilometres — they degrade too quickly and can't practically cross oceans.

The solution: use light instead of electricity. Light travels at roughly 200,000 km/second through glass — fast enough to cross an ocean in under 100ms. This is fiber optic technology.

How Fiber Optic Works

A fiber optic cable carries bits as pulses of light:

Light pulse present
💡
= 1
No light pulse
🌑
= 0

At the sending end, a laser or LED converts electrical signals from the NIC into pulses of light. At the receiving end, a photodetector converts those light pulses back into electrical signals. The glass strand in between just carries the light.

Total Internal Reflection — Why Light Stays in the Cable

The most important concept in fiber optics is total internal reflection. Without it, light would just leak out the sides of the glass strand and disappear.

Total Internal Reflection — How Light Bounces Along a Fiber
Cladding (lower refractive index) Core (glass) Cladding (lower refractive index) Light bounces off the cladding boundary and stays inside the core — never escaping laser

The fiber has two layers — a glass core where light travels, and a glass cladding surrounding it with a slightly lower refractive index. When light hits the boundary between core and cladding at a shallow enough angle, it reflects completely back into the core. It never escapes — it just keeps bouncing its way along the cable, even around gentle bends, until it reaches the other end.

Anatomy of a Fiber Optic Cable

Cross-Section of a Single Fiber Strand
Core (glass) ~8–62μm Light travels here Cladding (glass) ~125μm Reflects light inward Buffer coating Protects from moisture Outer jacket Physical protection μm = micrometers. Human hair is ~70μm.

Single-Mode vs Multi-Mode Fiber

There are two types of fiber, and they're used in different contexts:

PropertySingle-Mode (SMF)Multi-Mode (MMF)
Core size~8–10 μm (tiny)~50–62 μm (larger)
Light sourceLaserLED
DistanceUp to 100+ kmUp to ~2 km
Speed100 Gbps+Up to 100 Gbps (short range)
CostMore expensiveCheaper
Used forLong distance — submarine cables, ISP backbone, between citiesShort distance — inside data centers, between buildings

Submarine Cables — Fiber Crossing Oceans

The internet's backbone is built on submarine fiber optic cables laid on the ocean floor. This is not metaphor — these are real physical cables running under the Atlantic, Pacific, and Indian Oceans carrying the vast majority of international internet traffic.

Submarine Cable — Cross Section (Engineered for Ocean Floor)
fibers Outer jacket (polyethylene) Mylar tape Polyethylene insulation Copper (powers amplifiers) Steel strength wires Optical fiber bundle About the width of a garden hose — yet carries terabits per second across oceans

Key things to note about submarine cables:

Copper vs Fiber — Full Comparison

PropertyCopper (Ethernet)Fiber Optic
Signal typeElectrical voltageLight pulses
Max distance~100 metres100+ km (single-mode)
SpeedUp to 10 Gbps100 Gbps to Tbps
InterferenceAffected by EMI, crosstalkImmune to electromagnetic interference
WeightHeavierMuch lighter
CostCheapMore expensive
Typical useLast metre — device to wall socketEverything beyond — building to building, city to city, continent to continent
🔦 Analogy — Flashlight in a Mirror Tunnel

Imagine a long tunnel lined entirely with mirrors. You shine a flashlight in one end. The light bounces off the mirrored walls thousands of times but keeps going until it reaches the other end — perfectly intact. That's exactly what total internal reflection does inside a fiber optic strand. The glass core walls act as perfect mirrors for the light.

⚠️ Common Misconceptions
  • "Fiber is fragile" — Modern fiber cables are extremely well-engineered with multiple protective layers. Submarine cables survive ocean floor pressures. Data center fiber handles heavy traffic 24/7.
  • "Fiber means WiFi" — No. Fiber is a physical cable. "Fiber internet" at home means fiber runs to your building — the last connection to your device is usually still WiFi or Ethernet.
  • "Light travels at full speed of light in fiber" — Not quite. Light slows to about 2/3 the speed of light when passing through glass. Still extremely fast — ~200,000 km/s.

Module 2 · Topic 2.3

How Bits Travel — Radio Waves (WiFi)

Wireless — No Cable Needed

Copper and fiber both require a physical cable between devices. WiFi eliminates the cable by transmitting bits through the air as radio waves — the same physical phenomenon used by FM radio, TV broadcasts, and mobile phones, just at different frequencies.

How Radio Waves Carry Bits

A radio wave is an electromagnetic wave that oscillates (vibrates) at a specific frequency. WiFi encodes 1s and 0s by varying properties of these waves — such as their amplitude, frequency, or phase. The receiving device's antenna picks up these variations and decodes them back into bits.

WiFi Signal — Bits Encoded in Radio Waves Through the Air
WiFi Router Radio waves carry encoded bits Laptop NIC No cable — bits travel as electromagnetic waves through air

WiFi Frequencies — 2.4 GHz vs 5 GHz vs 6 GHz

WiFi operates on specific radio frequency bands. Each has different characteristics — understanding these explains why WiFi behaves differently in different situations.

BandFrequencyRangeSpeedWall penetrationBest for
2.4 GHz2.4 GHz~45m indoorsUp to ~600 Mbps✅ Good — longer wavelengthLarge areas, many walls, IoT devices
5 GHz5 GHz~25m indoorsUp to ~3.5 Gbps⚠️ ModerateFast speeds, fewer walls, modern devices
6 GHz6 GHz~15m indoorsUp to ~9.6 Gbps❌ Poor — shorter wavelengthHigh-density, short range, WiFi 6E
💡 Why Higher Frequency = Shorter Range

Higher frequency waves carry more data (more oscillations per second = more bits encoded) but are absorbed more easily by walls, furniture, and even water molecules in the air. Lower frequency waves pass through obstacles more easily but carry less data. It's always a tradeoff — speed vs range vs penetration.

WiFi Standards — The 802.11 Family

WiFi versions are defined by the IEEE 802.11 standard. Each new generation improves speed, capacity, and efficiency:

StandardMarketing NameYearMax SpeedFrequencies
802.11nWiFi 42009600 Mbps2.4 + 5 GHz
802.11acWiFi 520133.5 Gbps5 GHz
802.11axWiFi 620199.6 Gbps2.4 + 5 GHz
802.11axWiFi 6E20219.6 Gbps2.4 + 5 + 6 GHz
802.11beWiFi 7202446 Gbps2.4 + 5 + 6 GHz

How a WiFi Connection Works

WiFi Association Process — How Your Device Joins a Network
💻 Your Device (laptop/phone) 📡 Access Point (WiFi router) ① Probe request — "any networks here?" ② Beacon — "I am HomeNetwork, WPA2" ③ Authentication request + password ④ Authentication accepted ✓ ⑤ Association request — "join me" ⑥ You're connected ✓ ⑦ DHCP — "give me an IP address" ⑧ IP assigned: 192.168.1.5 ✓ ✅ Device can now send/receive data

Key WiFi Concepts

SSID
Service Set Identifier — the name of a WiFi network (e.g. "Home_Network"). The access point broadcasts it so devices can find and identify it.
Access Point (AP)
The hardware that broadcasts the WiFi signal and connects wireless devices to the wired network. Your home WiFi router contains a built-in access point.
Channels
Each frequency band is divided into channels (like lanes on a highway). Multiple networks in an area use different channels to avoid interfering with each other.

WiFi vs Ethernet vs Fiber — Where Each Fits

Where Each Medium is Used in a Typical Network Path
Your Laptop WiFi Router Ethernet ISP Modem Fiber (ISP backbone) ISP Network Submarine Fiber Origin Server WiFi handles the last few metres. Fiber handles everything beyond.
📻 Analogy — FM Radio

WiFi works on exactly the same physical principle as FM radio. A radio station transmits audio by encoding it into radio waves at a specific frequency (e.g. 98.5 MHz). Your car radio's antenna picks up those waves and decodes the audio. WiFi does the same thing — just at higher frequencies (2.4–6 GHz), shorter range, and encoding binary data instead of audio. The physics is identical.

⚠️ Common Misconceptions
  • "WiFi is a different kind of internet" — No. WiFi is just a wireless way to connect to the same network. Once your data leaves the access point, it travels over the same cables (Ethernet, fiber) as any wired connection.
  • "5 GHz WiFi is always better" — Faster but shorter range and worse wall penetration. In a large house or office, 2.4 GHz often provides more reliable coverage even though it's slower.
  • "WiFi signals travel at the speed of light" — The radio waves do travel at light speed, but WiFi latency is still higher than wired Ethernet because of encoding/decoding overhead, contention between devices, and retransmission of errors — all of which add milliseconds.

Module 2 · Topic 2.4

Hub vs Switch

The Problem — Multiple Devices on One Network

Once you have more than two devices that need to communicate, you need a central piece of hardware to connect them all together. Historically there were two options: a hub or a switch. Understanding the difference explains why switches completely replaced hubs — and why it matters for how networks work today.

The Hub — Broadcast Everything

A hub is the simplest possible network device. When a packet arrives on any port, the hub does one thing: copy it out to every single other port simultaneously. No intelligence, no selectivity — everyone gets everything.

Hub — Every Packet Sent to Every Device
HUB dumb repeater Device A sends packet Device B Device C Device D unwanted copy unwanted unwanted Hub sends every packet to every port — even unintended recipients

This causes three serious problems:

🔒 No Privacy
Every device sees every other device's traffic. Anyone on the network can read packets not meant for them. A major security problem.
⚡ Collisions
If two devices send at the same time, their signals collide on the shared wire. Both packets are corrupted. Both must retransmit. Slows everything down.
📉 Poor Performance
All devices share the same bandwidth. A 100 Mbps hub with 10 devices gives each device effectively 10 Mbps — bandwidth is divided, not dedicated.

The Switch — Send Only Where Needed

A switch solves all three problems with one key capability: it learns which device is on which port and sends packets only to the correct destination port.

Switch — Packet Sent Only to the Intended Device
SWITCH knows MAC → port Device A → to B Device B ✓ only to B Device C not sent Device D not sent Switch sends packet only to Device B — C and D never see it

How a Switch Learns — The MAC Address Table

A switch doesn't come pre-programmed with device locations. It learns them dynamically by observing traffic:

1
Packet arrives on Port 1 from Device A

Switch reads the source MAC address from the packet and records: "MAC AA:AA:AA:AA:AA:AA is on Port 1." This is added to the MAC address table.

2
Switch looks up destination MAC

If the destination MAC is already in the table, send only to that port. If not yet known — flood to all ports temporarily until it learns the location.

3
Table builds up over time

After a few seconds of normal traffic, the switch has learned where every device is. From then on, all traffic is perfectly directed — no more flooding.

MAC Address Table — Inside a Switch
PORT MAC ADDRESS DEVICE 1 AA:AA:AA:AA:AA:AA Laptop (Device A) 2 BB:BB:BB:BB:BB:BB Phone (Device B) 3 CC:CC:CC:CC:CC:CC Printer (Device C) 4 DD:DD:DD:DD:DD:DD Server (Device D) Switch learned these by observing which MAC address sent traffic on each port

Hub vs Switch — Full Comparison

PropertyHubSwitch
IntelligenceNone — dumb repeaterSmart — learns MAC addresses
Packet deliveryBroadcasts to all portsSends only to correct port
Privacy❌ None — all devices see all traffic✅ Traffic isolated per port
Collisions❌ Common — shared medium✅ None — each port is isolated
BandwidthShared across all devicesDedicated per port
SpeedSlow under loadFull speed per port
Still used?❌ Obsolete since ~2000✅ Universal — in every network
📢 Analogy — Megaphone vs Walkie-Talkie

A hub is like someone using a megaphone in a room — everyone hears everything, whether it was meant for them or not. A switch is like giving everyone a dedicated walkie-talkie channel — you talk directly to one person and nobody else hears it.

⚠️ Common Misconception
  • "Hubs and switches are the same thing" — They look identical from the outside but work completely differently. You will never find a hub in a modern network — they've been completely replaced by switches. If someone says "hub" in a modern context they almost certainly mean switch.

Module 2 · Topic 2.5

Switch — Deep Dive

Beyond the Basics

In Topic 2.4 we covered what a switch does — directs traffic only to the correct port using a MAC address table. Now let's go deeper into exactly how that works, what happens in edge cases, and the concepts you'll encounter in real network conversations.

The MAC Address Table — In Detail

The MAC address table (also called the CAM table — Content Addressable Memory) is the switch's lookup database. Every entry has three pieces of information:

MAC Address Table (CAM Table) — Inside a Switch
PORT MAC ADDRESS DEVICE AGE 1 AA:AA:AA:AA:AA:AA Laptop (Device A) 45s 2 BB:BB:BB:BB:BB:BB Phone (Device B) 12s 3 CC:CC:CC:CC:CC:CC Printer (Device C) 98s 4 DD:DD:DD:DD:DD:DD Server (Device D) 3s ⚠ Entries expire after ~300 seconds of inactivity — removed when device disconnects

The Age column is important — entries don't stay forever. If a device stops sending traffic, its entry ages out and is removed. This prevents stale entries from clogging the table when devices disconnect or move to different ports.

What Happens When the Switch Doesn't Know Where to Send?

Three scenarios cause a switch to flood — send a packet out every port except the one it arrived on:

Unknown Unicast
Destination MAC is not in the table yet. Switch floods all ports until the destination responds and its location is learned.
Broadcast
Destination MAC is FF:FF:FF:FF:FF:FF — the broadcast address. Switch always floods this to every port by design. Used by ARP and DHCP.
Multicast
Traffic meant for a group of devices. Switch floods to all ports unless specifically configured to track multicast group membership (IGMP snooping).

Full Packet Forwarding Decision Flow

How a Switch Decides What to Do With Every Incoming Packet
flowchart TD A["📦 Packet arrives on Port X"] --> B["Record source MAC → Port X in table"] B --> C{"Destination MAC\n= FF:FF:FF:FF:FF:FF?"} C -->|Yes - Broadcast| D["🔊 Flood to ALL ports except X"] C -->|No| E{"Destination MAC\nin table?"} E -->|No - Unknown| D E -->|Yes| F{"Destination port\n= source port X?"} F -->|Yes - Same port| G["🗑️ Drop packet\n(same segment)"] F -->|No| H["✅ Forward ONLY to\ncorrect destination port"] style A fill:#1a1a2e,color:#fff,stroke:#f6821f style D fill:#c85a00,color:#fff,stroke:#a04600 style G fill:#b51c1c,color:#fff,stroke:#8b1414 style H fill:#1a7a44,color:#fff,stroke:#155e35

VLANs — Virtual LANs

A VLAN (Virtual Local Area Network) lets you logically divide one physical switch into multiple isolated networks. Devices on different VLANs cannot communicate directly — even if they're plugged into the same physical switch.

VLANs — One Physical Switch, Two Isolated Networks
Physical Switch Ports 1-4: VLAN 10 | Ports 5-8: VLAN 20 PC-1 VLAN10 PC-2 VLAN10 PC-3 VLAN20 PC-4 VLAN20 🚫 VLAN10 cannot reach VLAN20 without going through a router VLAN 10 (e.g. HR dept) VLAN 20 (e.g. Finance dept)

VLANs are widely used in enterprise networks to:

Managed vs Unmanaged Switches

TypeConfigurationVLANsUsed For
UnmanagedNone — plug and playHome networks, small offices
ManagedWeb UI or CLI (Cisco IOS etc.)Enterprise networks, data centers
💡 Cloudflare Relevance — Why Switches Matter

Cloudflare's 330+ PoP data centers are full of managed switches connecting servers, routers, and network equipment. When you learn about Magic Transit or Cloudflare's network interconnects, the underlying infrastructure is switches and routers working exactly as described here. Also — when customers ask about on-premise network design to integrate with Cloudflare, VLANs and switch configuration often come up.

⚠️ Common Misconceptions
  • "A switch and a router are the same thing" — Completely different. A switch connects devices within the same network using MAC addresses. A router connects different networks using IP addresses. Coming up next in 2.6.
  • "VLANs provide complete security isolation" — VLANs prevent direct Layer 2 communication. But misconfigured switches, VLAN hopping attacks, or a compromised router can still allow cross-VLAN traffic. VLANs are a tool, not a complete security solution.

Module 2 · Topic 2.6

Router — Deep Dive

Switch vs Router — The Fundamental Difference

A switch connects devices within the same network using MAC addresses. A router connects different networks together using IP addresses. This is the most important distinction in networking.

Switch
Operates at Layer 2
Uses MAC addresses
Connects devices within one network
Fast — hardware-level forwarding
Router
Operates at Layer 3
Uses IP addresses
Connects different networks together
Makes intelligent path decisions

What a Router Actually Does

A router receives a packet, reads the destination IP address, consults its routing table, and forwards the packet toward its destination — one hop at a time. The packet may pass through 15–20 routers before reaching its destination.

A Packet Hopping Through Multiple Routers to Reach Its Destination
flowchart LR A["💻 Your Device\n192.168.1.5"] -->|"packet to\n142.250.80.46"| B["🏠 Home Router\n192.168.1.1"] B -->|"hop 1"| C["🌐 ISP Router\n10.0.0.1"] C -->|"hop 2"| D["🌐 Backbone Router"] D -->|"hop 3...n"| E["🖥️ Google Server\n142.250.80.46"] style A fill:#1a1a2e,color:#fff,stroke:#f6821f style B fill:#c85a00,color:#fff,stroke:#a04600 style C fill:#2a4cc7,color:#fff,stroke:#1a3399 style D fill:#2a4cc7,color:#fff,stroke:#1a3399 style E fill:#1a7a44,color:#fff,stroke:#155e35

The Routing Table

Every router has a routing table — a list of known network destinations and which direction (next hop) to send traffic for each. This is the router's decision-making engine.

Destination Network Subnet Mask Next Hop Interface
192.168.1.0 255.255.255.0 Directly connected eth0 (LAN)
10.0.0.0 255.255.255.0 Directly connected eth1 (WAN)
172.16.5.0 255.255.255.0 10.0.0.5 eth1
0.0.0.0 0.0.0.0 10.0.0.1 eth1  ← default route

When a packet arrives, the router compares the destination IP against every route in the table and picks the most specific match (longest prefix match). The last entry — 0.0.0.0/0 — is the default route: "if nothing else matches, send it here." This is typically the ISP gateway — the on-ramp to the internet.

Static vs Dynamic Routing

TypeHow Routes are AddedProsCons
StaticManually configured by adminPredictable, simple, secureDoesn't adapt to failures, doesn't scale
DynamicLearned automatically via routing protocols (BGP, OSPF)Adapts to failures, scales to millions of routesMore complex, slight overhead

The internet runs on dynamic routing — specifically BGP (Border Gateway Protocol), which we'll cover in Module 4. Your home router uses a simple static default route pointing to your ISP.

NAT — What the Home Router Also Does

Your home router does something critical beyond just routing: NAT (Network Address Translation). Your ISP gives you one public IP address. But you have many devices. NAT lets all of them share that one IP.

NAT — How One Public IP Serves Many Devices
Private Network (LAN) Laptop: 192.168.1.5 Phone: 192.168.1.6 TV: 192.168.1.7 Router NAT translates private ↔ public Internet Only sees one IP: 76.102.45.8 All 3 devices share one public IP — NAT keeps track of which response goes where

TTL — Time to Live

Every IP packet has a field called TTL (Time to Live) — a counter that starts at 64 or 128 and decrements by 1 at each router hop. When TTL reaches 0, the router discards the packet and sends an error back to the sender.

This prevents packets from looping forever if there's a routing mistake. It's also what makes traceroute work — it sends packets with TTL=1, then TTL=2, etc., and maps each hop by watching where the "TTL expired" errors come from.

traceroute google.com — Each Hop is One Router
HOP IP ADDRESS DEVICE LATENCY 1 192.168.1.1 Your home router 1ms 2 10.0.0.1 ISP router 5ms 3 72.14.204.81 Backbone router 12ms 4 142.250.80.46 Google server ✓ destination 18ms Each hop = one router. TTL increments by 1 each step to reveal each router in the path.
🗺️ Analogy — GPS Navigation

A router is like a GPS system at every intersection on the internet. Your packet is a car. At each router (intersection), the GPS (routing table) says "turn left toward this next router" — moving the packet one hop closer to its destination. The packet doesn't know the full path upfront — it just follows instructions one hop at a time until it arrives.

⚠️ Common Misconceptions
  • "Your home router is just a WiFi box" — It's actually a router + switch + WiFi access point + NAT device + DHCP server all in one box. ISPs bundle these into a single unit for simplicity.
  • "Packets always take the same path" — Not necessarily. Dynamic routing can send different packets from the same session through different routers if one path becomes congested or fails. This is one reason the internet is so resilient.
  • "A router sees the full path to the destination" — No. Each router only knows the next hop. The full path is discovered hop by hop. No single router has a complete map of the internet.

Module 2 · Topic 2.7

MAC Addresses

What is a MAC Address?

Every network interface card (NIC) — whether in a laptop, phone, server, or router — is permanently assigned a unique identifier at the factory called a MAC address (Media Access Control address).

It looks like this: 00:1A:2B:3C:4D:5E

Six pairs of hexadecimal digits separated by colons. 48 bits total. Globally unique — no two network interfaces in the world share the same MAC address.

MAC Address Structure

MAC Address Anatomy — 6 Bytes, 48 Bits Total
00 : 1A : 2B OUI — Manufacturer ID 3C : 4D : 5E NIC-specific — Device ID First 24 bits assigned to manufacturer e.g. 00:1A:2B = Intel Corp Last 24 bits unique per device assigned by manufacturer at factory

The first half (OUI — Organizationally Unique Identifier) identifies the manufacturer. The second half uniquely identifies the specific device. This is how 00:1A:2B always means Intel, F4:5C:89 always means Apple, etc.

MAC Address vs IP Address

PropertyMAC AddressIP Address
What it identifiesThe physical hardware (NIC)The device's location on a network
Assigned byManufacturer — burned in at factoryNetwork/ISP/DHCP — can change
Changes?Permanent (can be spoofed in software)Changes when you move networks
ScopeLocal network onlyWorks across the internet
Used bySwitches (Layer 2)Routers (Layer 3)
Format00:1A:2B:3C:4D:5E192.168.1.5
AnalogyYour permanent national ID numberYour current home address

Why MAC Addresses Only Work Locally

MAC addresses are a Layer 2 concept — they only have meaning on a local network segment. When your packet leaves your local network through a router, the router strips the Ethernet frame (which contains the MAC address) and creates a new one for the next hop. The MAC address changes at every router hop — the IP address does not.

MAC Changes at Every Router Hop — IP Stays the Same
Laptop MAC: AA:AA IP: 192.168.1.5 Hop 1 Frame Src MAC: AA:AA Dst MAC: BB:BB Src IP: 192.168.1.5 Dst IP: 104.21.5.10 Router 1 MAC: BB:BB Hop 2 Frame Src MAC: CC:CC Dst MAC: DD:DD Src IP: 192.168.1.5 Dst IP: 104.21.5.10 Router 2 MAC: DD:DD CF Server MAC: EE:EE IP: 104.21.5.10 MAC changes ↑ MAC changes ↑ IP address stays the same end-to-end ✓

Real Example — Your Laptop to Cloudflare

When your laptop sends a request to cloudflare.com:

MAC Addresses in Security

MAC addresses appear in security contexts you'll encounter as a Cloudflare SE:

MAC Filtering
Network admins can configure switches/APs to only allow devices with specific MAC addresses to connect. A basic access control mechanism — easily bypassed by MAC spoofing.
MAC Spoofing
Software can override the hardware MAC address. Attackers use this to impersonate trusted devices or bypass MAC filtering. This is why MAC-based security alone is insufficient.
Firewall Rules
Layer 2 firewalls (like Magic Firewall) can filter traffic based on MAC addresses within a local network segment — useful for blocking specific devices.
⚠️ Common Misconceptions
  • "MAC addresses are used to route traffic across the internet" — No. MACs are stripped at every router hop. Only IP addresses travel end-to-end. MACs are strictly local.
  • "MAC addresses can't be changed" — The hardware MAC is burned in, but operating systems allow software override (MAC spoofing). This is used legitimately for privacy and maliciously for attacks.

Module 2 · Topic 2.8

ARP — Address Resolution Protocol

The Problem ARP Solves

We now know switches use MAC addresses and routers use IP addresses. But here's the gap: when your laptop wants to send a packet to your router at IP 192.168.1.1 — how does it know the router's MAC address to put in the Ethernet frame?

It doesn't — until it asks. That asking process is ARP.

How ARP Works

ARP — Finding a MAC Address from an IP Address
💻 Laptop 192.168.1.5 📢 Network broadcast 🌐 Router 192.168.1.1 ① ARP Request (broadcast) "Who has 192.168.1.1?" Sent to FF:FF:FF:FF:FF:FF every device on LAN receives this ② ARP Reply (unicast to laptop) "192.168.1.1 is at BB:BB:BB:BB:BB:BB" ③ Cache result in ARP table ④ Real packet sent with correct MAC ✓

The ARP Cache

Once your laptop learns a MAC address via ARP, it stores it locally in an ARP cache (ARP table) so it doesn't have to ask again for every packet:

ARP Cache — Stored on Your Laptop
IP ADDRESS MAC ADDRESS AGE 192.168.1.1 BB:BB:BB:BB:BB:BB 45s ← router 192.168.1.10 CC:CC:CC:CC:CC:CC 12s ← phone ⚠ Entries expire after ~60–120 seconds and are refreshed automatically as needed

ARP in the Real World

Every time your laptop connects to a new network — at home, at a coffee shop, at a customer's office — the first thing it does before sending any real traffic is ARP for the default gateway (router) to learn its MAC address. This happens automatically and invisibly in milliseconds.

💡 ARP Spoofing — Security Relevance

ARP has no authentication — any device can respond to an ARP request claiming to be any IP address. ARP spoofing (or ARP poisoning) is an attack where a malicious device responds to ARP requests with its own MAC, tricking devices into sending traffic to the attacker instead of the real destination. This is a man-in-the-middle attack at Layer 2 — one reason why Zero Trust (never trust the local network) matters.

⚠️ Key Limitation

ARP only works within a local network segment. You cannot ARP for a device on the other side of the internet — that's what DNS and routing are for. ARP is purely a Layer 2 / local network mechanism.


Module 2 · Key Takeaways

Important to Remember

Module 2 covered how bits physically travel across networks. These concepts underpin every product conversation involving network architecture, traffic flow, and security.

🔌 2.1 — Copper / Ethernet
  • Bits travel as high/low voltage pulses on copper wire
  • Ethernet cables have 8 wires in 4 twisted pairs — twisting cancels electromagnetic interference
  • Max distance: 100 metres per cable segment before signal degrades
  • Cat5e/Cat6 (1 Gbps) is most common; Cat6a/Cat7 for 10 Gbps; Cat8 for data centers
  • RJ45 connector = 8 pins, one per wire
💡 2.2 — Fiber Optic
  • Bits travel as light pulses — 1 = light on, 0 = light off
  • Total internal reflection keeps light inside the glass core
  • Single-mode (laser, 100+ km) for long distance; multi-mode (LED, ~2km) for short distance
  • Submarine cables cross oceans — copper layer powers repeaters every ~100km
  • 400+ submarine cable systems carry most of the world's internet traffic
  • Immune to electromagnetic interference — unlike copper
📡 2.3 — WiFi
  • Bits travel as radio waves — same physics as FM radio, just higher frequency
  • 2.4 GHz = longer range, better wall penetration, slower
  • 5 GHz = shorter range, faster. 6 GHz = very short range, fastest
  • WiFi is just the last hop — beyond the access point, traffic travels over copper/fiber exactly like wired
🔀 2.4 — Hub vs Switch
  • Hub = dumb, broadcasts to all ports, no privacy, causes collisions — obsolete
  • Switch = smart, learns MAC addresses, sends only to correct port, dedicated bandwidth per port
  • Switch builds a MAC address table by observing traffic — entries expire after ~300 seconds
  • Unknown destination, broadcast, or multicast → switch floods all ports
🔁 2.5 — Switch Deep Dive
  • MAC address table (CAM table) maps MAC → port with an age timer
  • Broadcast address FF:FF:FF:FF:FF:FF always floods — used by ARP and DHCP
  • VLANs logically divide one physical switch into isolated networks — departments can't see each other's traffic without going through a router
  • Managed switches support VLANs and CLI config; unmanaged are plug-and-play
🗺️ 2.6 — Router Deep Dive
  • Routers connect different networks using IP addresses (Layer 3)
  • Routing table = list of destinations and which direction (next hop) to send each
  • Default route 0.0.0.0/0 = "send everything else to the ISP" — the internet on-ramp
  • Packets hop through 15–20 routers to reach their destination — each router only knows the next hop
  • NAT lets all home devices share one public IP address
  • TTL prevents packets looping forever — decrements at each hop, discarded at 0
🏷️ 2.7 — MAC Addresses
  • 48-bit hardware address burned into every NIC at factory — globally unique
  • First 24 bits = manufacturer (OUI), last 24 bits = device-specific
  • MAC addresses are local only — stripped and replaced at every router hop
  • IP addresses travel end-to-end; MAC addresses only survive one network segment
  • Can be spoofed in software — MAC filtering alone is not sufficient security
📋 2.8 — ARP
  • ARP translates IP addresses → MAC addresses on a local network
  • Works by broadcasting "who has this IP?" — the owner replies with its MAC
  • Results cached in ARP table for ~60–120 seconds
  • ARP spoofing = attacker claims a false MAC, intercepts traffic — a Layer 2 man-in-the-middle attack
  • ARP is local only — cannot work across routers or the internet
Module 3 of 10

Network Concepts

The rules and addressing systems that govern how networks are organised, addressed, and managed.

Module 3 · Topic 3.1

Types of Networks — LAN, WAN, MAN, Internet

Why Network Types Matter

Not all networks are the same size or scope. The type of network determines who owns it, how fast it is, what hardware it uses, and how it connects to other networks. In Module 2 we already used "LAN" and "internet" — now let's define all of them properly.

LAN — Local Area Network

A network confined to a single physical location — a home, an office floor, a building. You own it and control it entirely.

Characteristics
• Single location
• High speed (1–100 Gbps)
• Low latency (~0.1ms)
• Private — you own everything
• Uses switches and WiFi APs
Examples
• Your home WiFi network
• A single office floor
• A university computer lab
• A data center server room
• A coffee shop network

MAN — Metropolitan Area Network

A network spanning a city or campus — larger than a LAN but smaller than a WAN. Often owned by a city government, university, or ISP.

Characteristics
• City or campus scale
• Medium speed (1–10 Gbps)
• Often uses fiber optic
• Partially owned/leased
• Connects multiple LANs
Examples
• A university campus network
• City government network
• Hospital network across buildings
• Cable TV network in a city
• Metro fiber network

WAN — Wide Area Network

A network spanning multiple cities, countries, or continents. No single organization owns the whole thing — it's built by leasing infrastructure from ISPs and telecom providers.

Characteristics
• Spans cities/countries
• Slower than LAN (~100Mbps–10Gbps)
• Higher latency (10–150ms)
• Leased infrastructure
• Uses routers + BGP
Examples
• A company connecting offices in NY, London, Tokyo
• An ISP's network
• MPLS networks
• Cloudflare's private backbone
• A bank's global network
💡 Cloudflare's Network is a WAN

Cloudflare operates a private WAN connecting 330+ PoPs across the globe. When traffic enters Cloudflare in Mumbai, it travels over Cloudflare's own WAN backbone to reach an origin server in London — bypassing the public internet entirely. This is faster and more reliable than the traffic taking a public internet path.

The Internet

The internet is not one network — it's a network of networks. Millions of LANs, MANs, and WANs owned by different organizations, all interconnected using agreed-upon protocols (primarily TCP/IP and BGP).

No single entity owns the internet. Your ISP owns the last mile to your home. Backbone providers own transcontinental fiber. IXPs (covered in Module 4) are the physical meeting points where these networks exchange traffic.

How They Nest Together

Network Types — How They Nest and Connect
INTERNET — Network of all Networks WAN — ISP network / Cloudflare backbone / Corporate global network MAN — City / Campus LAN Office Floor 1 devices LAN Office Floor 2 devices LAN — Data Center Server rack 1 Server rack 2 Cloudflare PoP / AWS / Google data centers ARE large LANs internally connected by switches

Full Comparison

TypeScaleSpeedLatencyOwnershipHardware
LANRoom / building1–100 Gbps~0.1msYou own it allSwitches, WiFi APs
MANCity / campus1–10 Gbps~1–5msPartially leasedFiber, routers
WANCountry / global100Mbps–10Gbps10–150msLeased from ISP/telcoRouters, BGP, MPLS
InternetGlobalVariesVariesNobody — decentralisedAll of the above
⚠️ Common Misconceptions
  • "The internet is one big network" — It's millions of independent networks interconnected. Each ISP, company, and cloud provider runs its own network that connects to others at IXPs via BGP.
  • "LAN means WiFi" — LAN is about scope (local/single location), not the medium. A LAN can use Ethernet cables, WiFi, or both. Your office switch-based network is a LAN even if it has no WiFi at all.
  • "WAN = internet" — Not quite. A company's private global network connecting offices worldwide is a WAN — but it's not the public internet. Cloudflare's backbone is a WAN. They're separate things that often connect to each other.

Module 3 · Topic 3.2

IPv4 Addressing

What is an IP Address?

An IP address is the logical address assigned to a device on a network. Unlike a MAC address (burned into hardware), an IP address is assigned by the network and can change. It tells routers where to deliver packets — globally.

IPv4 Structure

An IPv4 address is a 32-bit number, written as four decimal numbers (called octets) separated by dots. Each octet is 8 bits, so ranges from 0 to 255.

IPv4 Address Structure — 32 bits, 4 Octets
192 168 1 5 11000000 10101000 00000001 00000101 . . . Octet 1 (8 bits) Octet 2 (8 bits) Octet 3 (8 bits) Octet 4 (8 bits) Total: 32 bits = 2³² = ~4.3 billion possible addresses Each octet: 0–255 (because 2⁸ = 256, max value = 255)

Network Part vs Host Part

Every IP address has two parts — the network part (which network is this?) and the host part (which device on that network?). A subnet mask tells you where the split is. We'll go deep on this in Topic 3.7.

IP Address = Network Part + Host Part
NETWORK PART 192.168.1 HOST PART .5 All devices on this network share this Unique per device

IPv4 Address Classes (Historical)

Originally IPv4 addresses were divided into classes. You don't configure these today — modern networking uses CIDR — but you'll hear the terms, so know them:

ClassRangeDefault Network BitsHosts per NetworkDesigned For
A1.0.0.0 – 126.255.255.2558 bits16.7 millionHuge organisations (governments, large ISPs)
B128.0.0.0 – 191.255.255.25516 bits65,534Medium-large organisations
C192.0.0.0 – 223.255.255.25524 bits254Small networks (offices, home)
D224.0.0.0 – 239.255.255.255Multicast (not assigned to hosts)
E240.0.0.0 – 255.255.255.255Reserved / experimental

IPv4 Exhaustion

With only ~4.3 billion possible addresses and billions of devices, IPv4 addresses ran out. The last blocks were allocated around 2011. Solutions:

NAT (Short-term fix)
Multiple devices share one public IP using NAT. Your home has one public IP but 10+ devices. Bought time but adds complexity. Covered in Topic 3.10.
IPv6 (Long-term solution)
128-bit addresses = 340 undecillion possible addresses. Enough for every atom on Earth's surface to have an IP. Covered next in Topic 3.4.

Module 3 · Topic 3.3

IPv6 — Deep Dive

Why IPv6?

IPv4 gave us ~4.3 billion addresses. The internet has billions of devices — phones, laptops, servers, IoT sensors, smart TVs. We ran out. IPv6 was designed to solve this permanently.

IPv6 Structure

An IPv6 address is 128 bits — written as 8 groups of 4 hexadecimal digits separated by colons:

2606 : 4700 : 4700 : 0000 : 0000 : 0000 : 0000 : 1111

8 groups × 16 bits = 128 bits total
Shortened: 2606:4700:4700::1111  (:: replaces consecutive zero groups)
2¹²⁸ = 340 undecillion possible addresses

IPv6 Shorthand Rules

Full IPv6 addresses are long. Two rules shorten them:

Rule 1 — Drop Leading Zeros
004242
00000

Each group's leading zeros can be removed.
Rule 2 — :: for Zero Groups
0000:0000:0000::

One consecutive run of all-zero groups can be replaced with ::. Only once per address.
Full AddressShortened
2606:4700:4700:0000:0000:0000:0000:11112606:4700:4700::1111
0000:0000:0000:0000:0000:0000:0000:0001::1 (loopback)
fe80:0000:0000:0000:0a00:27ff:fe4e:66a1fe80::a00:27ff:fe4e:66a1

IPv4 vs IPv6 — Comparison

PropertyIPv4IPv6
Length32 bits128 bits
FormatDotted decimal: 192.168.1.5Hex groups: 2606:4700::1
Addresses~4.3 billion340 undecillion
NAT needed?Yes — addresses are scarceNo — every device gets a real global IP
Header sizeVariable (20–60 bytes)Fixed (40 bytes) — faster routing
SecurityOptional (IPSec)Built-in IPSec support
Adoption todayStill dominant~40–50% of traffic (growing fast)
💡 Cloudflare & IPv6

Cloudflare fully supports IPv6 and actually provides free IPv6 connectivity to customers who only have IPv4 origins — called IPv6 compatibility mode. When a user visits a site over IPv6, Cloudflare translates it to IPv4 when talking to the origin. This is one example of Cloudflare operating at the network layer on behalf of customers.


Module 3 · Topic 3.4

IP Address Types

Public IP Addresses

A public IP is globally unique and routable on the internet. When your browser connects to 104.21.5.10 (Cloudflare), that's a public IP. Any device on the internet can theoretically reach it.

Public IPs are assigned and managed by IANA (Internet Assigned Numbers Authority) → regional registries (ARIN, RIPE, APNIC) → ISPs → you.

Private IP Addresses

Private IPs are reserved ranges that are not routable on the internet. Routers on the public internet drop packets destined for private IPs. They are used only within local networks.

RangeCIDRAddresses AvailableTypical Use
10.0.0.0 – 10.255.255.25510.0.0.0/816.7 millionLarge enterprises, cloud VPCs
172.16.0.0 – 172.31.255.255172.16.0.0/121 millionMedium networks
192.168.0.0 – 192.168.255.255192.168.0.0/1665,536Home and small office networks
💡 Why 192.168.x.x is on every home router

Your home router assigns private IPs from the 192.168.0.0/16 range because it's the smallest private block — just right for home networks. The router's LAN interface gets 192.168.1.1 (or similar), and your devices get 192.168.1.2 through 192.168.1.254 via DHCP.

AddressNameWhat it does
127.0.0.1Loopback"This device itself." Traffic sent here never leaves the machine. Used to test local services. ping 127.0.0.1 tests your own network stack.
localhostLoopback hostnameDNS name for 127.0.0.1. When developers run a web server locally and visit http://localhost:3000 — they're connecting to themselves.
0.0.0.0Any / UnspecifiedMeans "all interfaces" when a server binds to it. In routing tables, means "default route" (anywhere).
255.255.255.255Limited BroadcastSend to every device on the local network. Used by DHCP — a device with no IP sends to this to find a DHCP server.
169.254.0.0/16APIPA / Link-LocalAuto-assigned when DHCP fails. If you see a 169.254.x.x address on your machine — it couldn't reach a DHCP server. Usually means WiFi/network problem.
224.0.0.0/4MulticastSend to a group of devices simultaneously. Used by routing protocols and streaming. Not routed normally on internet.
::1IPv6 LoopbackIPv6 equivalent of 127.0.0.1.
💡 Real Example — 169.254.x.x in Customer Conversations

If a customer says their server has address 169.254.x.x and can't reach the internet, you immediately know: their DHCP server is unreachable. The server self-assigned an APIPA address. Check DHCP server, network connectivity, and VLAN config. This is a common troubleshooting signal.


Module 3 · Topic 3.5

Subnetting & CIDR

Why Subnetting?

Imagine a company with 1,000 employees in 5 departments. If they put everyone on one flat network:

Subnetting solves this by dividing one large network into smaller sub-networks. Each department gets its own subnet — isolated, manageable, and secure.

Subnet Masks

A subnet mask is a 32-bit number that tells you which part of an IP address is the network and which part is the host. It always has a block of 1s followed by a block of 0s:

Subnet Mask — 1s Mark the Network, 0s Mark the Host
IP Address: 192 168 1 5 . . . Subnet Mask: 255 255 255 0 . . . Binary: 11111111.11111111.11111111 . 00000000 ← Network part (24 bits = first 3 octets) → Host (8 bits)

Wherever the mask has 255 (all 1s in binary) = network part. Wherever 0 (all 0s in binary) = host part. So 255.255.255.0 means: first 3 octets are network, last octet is host.

CIDR Notation

Writing out full subnet masks is verbose. CIDR (Classless Inter-Domain Routing) notation replaces them with a slash and a number — the number of 1-bits in the mask:

Subnet MaskCIDRNetwork BitsHost BitsUsable Hosts
255.0.0.0/882416,777,214
255.255.0.0/16161665,534
255.255.255.0/24248254
255.255.255.128/25257126
255.255.255.252/303022
255.255.255.255/323201 (host route)
💡 Usable Hosts = 2ⁿ - 2

With 8 host bits you get 2⁸ = 256 addresses. But two are reserved — the network address (all host bits = 0, e.g. 192.168.1.0) and the broadcast address (all host bits = 1, e.g. 192.168.1.255). So usable hosts = 256 - 2 = 254.

Practical Subnetting Example

A company has the network 10.0.0.0/8 and wants to create separate subnets for 4 departments:

DepartmentSubnetRangeMax Hosts
Engineering10.1.0.0/2410.1.0.1 – 10.1.0.254254
HR10.2.0.0/2410.2.0.1 – 10.2.0.254254
Finance10.3.0.0/2410.3.0.1 – 10.3.0.254254
Management10.4.0.0/2410.4.0.1 – 10.4.0.254254

Each department is now on its own subnet. Without VLANs and routing rules between them, they cannot directly communicate — exactly like the HR/Finance VLAN example from Module 2.

CIDR in the Real World

CIDR isn't just for internal networks — it's how IP blocks are allocated on the internet:

💡 Cloudflare Firewall Rules Use CIDR

When you write a Cloudflare WAF rule to block a range of IPs — say block all traffic from 203.0.113.0/24 — you're using CIDR notation. Understanding this means you'll immediately know that rule blocks 254 specific IPs, not just one. This comes up constantly when building IP allowlists/blocklists in WAF, Magic Firewall, and Access policies.


Module 3 · Topic 3.6

NAT — Network Address Translation

The Problem NAT Solves

Your ISP gives you one public IP address. But you have 10 devices at home — laptop, phone, tablet, smart TV, gaming console. All need internet access simultaneously. NAT makes this possible by letting all devices share that one public IP.

How NAT Works — Step by Step

1
Your laptop (192.168.1.5) sends a request to cloudflare.com (104.21.5.10)

Packet: Source IP = 192.168.1.5, Source Port = 52341, Dest IP = 104.21.5.10, Dest Port = 443

2
Router intercepts and translates the source

Router rewrites: Source IP = 76.102.45.8 (your public IP), Source Port = 40001 (mapped port). Records this in its NAT table.

3
Cloudflare responds to your public IP

Response goes to 76.102.45.8:40001 — your public IP and the mapped port.

4
Router translates back using NAT table

Router looks up port 40001 → maps back to 192.168.1.5:52341. Delivers to your laptop.

The NAT Table

NAT Translation Table — Inside Your Router
PRIVATE (inside) PUBLIC (outside) 192.168.1.5 : 52341 76.102.45.8 : 40001 192.168.1.6 : 44201 76.102.45.8 : 40002 192.168.1.7 : 61234 76.102.45.8 : 40003 All 3 devices share public IP 76.102.45.8 — differentiated by unique mapped port numbers

Types of NAT

TypeHow it worksUsed for
PAT / NAT OverloadMany private IPs → one public IP, differentiated by port. What your home router does.Home networks, small offices
Static NATOne private IP maps permanently to one public IP. 1:1 mapping.Servers that need a fixed public IP
Dynamic NATPool of public IPs shared across private IPs. No port translation.Enterprises with multiple public IPs

NAT and Cloudflare

When Cloudflare sees traffic from a customer's website visitor, the source IP is the visitor's public IP after NAT — not their private home IP. This is what Cloudflare uses for:

This also means all devices behind a home NAT look like the same IP to Cloudflare — which is why rate limiting by IP can sometimes inadvertently affect multiple users sharing one public IP (e.g. a corporate office).


Module 3 · Topic 3.7

DHCP — Dynamic Host Configuration Protocol

The Problem DHCP Solves

Every device on a network needs four pieces of configuration to communicate:

IP Address
e.g. 192.168.1.5
The device's address
Subnet Mask
e.g. 255.255.255.0
Defines the network
Default Gateway
e.g. 192.168.1.1
The router's address
DNS Server
e.g. 1.1.1.1
For name resolution

Without DHCP, every device would need manual configuration. DHCP automates this entirely — you plug in a device and it gets all four automatically within seconds.

The DORA Process — How DHCP Works

DHCP DORA — 4 Steps From No IP to Fully Configured
sequenceDiagram participant D as 💻 New Device (no IP yet) participant S as 🖥️ DHCP Server D->>S: DISCOVER — broadcast to 255.255.255.255: "Any DHCP servers?" S->>D: OFFER — "I can give you 192.168.1.50, take it?" D->>S: REQUEST — broadcast: "Yes, I want 192.168.1.50" S->>D: ACK — "Confirmed. IP: 192.168.1.50, Mask: /24, GW: 192.168.1.1, DNS: 1.1.1.1"

The acronym DORA: Discover → Offer → Request → Acknowledge. After ACK, the device is fully configured and can communicate on the network.

DHCP Lease

IPs assigned by DHCP are not permanent — they're leases with an expiry time (typically 24 hours for home networks, 8 hours for corporate). Before expiry, the device renews the lease. If not renewed (device left the network), the IP goes back into the pool and can be reassigned to another device.

ConceptWhat it means
Lease timeHow long the IP is valid. Short = faster IP recycling. Long = stable IPs but slower pool turnover.
IP poolThe range of IPs the DHCP server can assign. e.g. 192.168.1.100 – 192.168.1.200
DHCP reservationAssign a fixed IP to a specific MAC address. The device always gets the same IP — but still via DHCP, not manual config.
Rogue DHCP serverAn unauthorised device responding to DHCP requests with bad config (wrong gateway → traffic goes to attacker). A real attack vector.
💡 Where DHCP Runs

At home: your WiFi router is the DHCP server. In enterprises: a dedicated Windows Server or Linux server runs DHCP. In cloud: AWS/GCP/Azure automatically assign private IPs to VMs via their own DHCP infrastructure. In Cloudflare's WARP/Zero Trust: Cloudflare's DHCP assigns IPs to connected devices in the virtual network.


Module 3 · Topic 3.8

Gateways & Routing Tables

Default Gateway — The Way Out

When your laptop wants to send a packet somewhere, it first checks: is the destination on my local network or somewhere else?

The default gateway is your router's LAN IP address — typically 192.168.1.1. It's the "exit door" off your local network. Every device gets it automatically via DHCP.

💡 How Your Device Decides — Same Network or Not?

Your device applies the subnet mask to both its own IP and the destination IP. If the network parts match — same network, send directly. If not — different network, send to default gateway. Example: you're on 192.168.1.5/24. Destination 192.168.1.20: same network (192.168.1.x). Destination 104.21.5.10: different network → goes to gateway.

Routing Tables — Deep Dive

We touched on routing tables in Topic 2.6. Now let's go deeper. Every router — from your home router to a Cloudflare backbone router — makes every forwarding decision based on its routing table.

Longest Prefix Match

When multiple routes match a destination, the router picks the most specific one — the one with the most network bits (longest prefix):

Longest Prefix Match — Router Picks the Most Specific Route
Routing Table 10.0.0.0/8 → via Router A 10.1.0.0/16 → via Router B 10.1.2.0/24 → via Router C ✓ WINNER 0.0.0.0/0 → default (ISP) Packet to: 10.1.2.55 All three top routes match 10.1.2.55 — but /24 is most specific, so Router C wins
Static vs Dynamic Routing — Expanded
PropertyStatic RoutingDynamic Routing (BGP/OSPF)
SetupAdmin manually adds each routeRouters learn routes automatically from neighbours
Adapts to failures?No — if a link dies, traffic stopsYes — reroutes automatically within seconds
ScaleOnly works for small, simple networksPowers the entire internet (BGP handles millions of routes)
Used byHome routers, small office edge casesISPs, Cloudflare, enterprise networks, cloud providers

Module 3 · Topic 3.9

Network Troubleshooting Basics

Why This Matters for an SE

As a Cloudflare SE, you'll regularly need to diagnose connectivity issues — is the problem at the DNS layer? Is it routing? Is it the origin server? Is it within Cloudflare? These three commands will be your first tools every time.

ping — Is the Host Reachable?

ping sends ICMP Echo Request packets to a destination and waits for a reply. It tests basic connectivity and measures round-trip latency.

ping 104.21.5.10 — Sample Output
$ ping 104.21.5.10 PING 104.21.5.10 — 56 data bytes 64 bytes from 104.21.5.10: icmp_seq=0 ttl=55 time=12.4 ms 64 bytes from 104.21.5.10: icmp_seq=1 ttl=55 time=11.8 ms 64 bytes from 104.21.5.10: icmp_seq=2 ttl=55 time=12.1 ms --- 104.21.5.10 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss round-trip min/avg/max = 11.8/12.1/12.4 ms ← 64-55=9 hops ← clean path ← ~12ms RTT
What to readWhat it tells you
time=12.4msRound-trip latency — how long packets take to reach and return
ttl=55TTL remaining — started at 64 or 128, decremented per hop. 64-55=9 hops to reach destination
0% packet lossNo packets dropped — path is clean
No reply / 100% lossHost unreachable, firewall blocking ICMP, or host is down

traceroute — Where is the Problem?

traceroute (Mac/Linux) or tracert (Windows) reveals every router hop between you and the destination. Invaluable for diagnosing where in the path things break.

traceroute cloudflare.com — Sample Output
$ traceroute cloudflare.com 1 192.168.1.1 1ms ← your home router 2 10.0.0.1 4ms ← ISP router 3 72.14.204.81 11ms ← backbone router 4 104.21.5.10 13ms ← Cloudflare PoP ✓ * * * ← router not responding (ICMP blocked) High latency or * * * at a hop = investigate that router. Fast before CF, slow at CF = Cloudflare edge or origin issue.

When a hop shows high latency or * * *, that's where to investigate. If all hops before Cloudflare are fast but Cloudflare's hop is slow — the issue may be at Cloudflare's edge or the origin.

nslookup / dig — Is DNS Working?

These tools query DNS servers directly. Essential for diagnosing whether a domain resolves correctly and which IP it resolves to.

nslookup cloudflare.com — Sample Output
$ nslookup cloudflare.com Server: 1.1.1.1 ← DNS resolver that answered Address: 1.1.1.1#53 ← port 53 = DNS port Name: cloudflare.com Address: 104.21.5.10 ← resolved IP Address: 172.67.68.228 ← second IP (Anycast, multiple PoPs)
dig cloudflare.com — Sample Output
$ dig cloudflare.com ;; ANSWER SECTION: cloudflare.com. 300 IN A 104.21.5.10 ← TTL 300s, A record cloudflare.com. 300 IN A 172.67.68.228 ← second Anycast IP ;; Query time: 12 msec ← DNS lookup took 12ms ;; SERVER: 1.1.1.1#53 ← Cloudflare's DNS resolver answered dig gives more detail than nslookup — preferred by engineers for troubleshooting
CommandBest forPlatform
ping <IP or domain>Basic connectivity test, latency checkAll platforms
traceroute / tracertPath discovery, locating where failure occursMac/Linux / Windows
nslookup <domain>Quick DNS lookup, available everywhereAll platforms
dig <domain>Detailed DNS output — preferred by engineersMac/Linux (install on Windows)
curl -I <url>Test HTTP response headers from command lineMac/Linux

Systematic Troubleshooting Approach

When a customer says "my site isn't working," work from bottom to top of the stack:

1
DNS resolving?

Run nslookup domain.com — does it return an IP? Is it Cloudflare's IP or the origin directly?

2
Network reachable?

Run ping <IP> — is the IP responding? Any packet loss?

3
Where is the break?

Run traceroute <domain> — at which hop does it fail or go slow?

4
HTTP working?

Run curl -I https://domain.com — what HTTP status code comes back? 200 = OK, 5xx = origin error, 4xx = client/Cloudflare issue.

💡 Cloudflare's Own Diagnostic Tools

As a Cloudflare SE, these are tools you'll use constantly when troubleshooting customer issues:

ToolWhat it does
1.1.1.1/helpTests if Cloudflare's DNS resolver is working from your location
cloudflare.com/cdn-cgi/traceShows which Cloudflare PoP you're hitting, your IP, HTTP version
dig @1.1.1.1 domain.comDNS lookup via Cloudflare's resolver — tests if DNS resolves correctly
curl -I https://domain.comHTTP response headers — look for cf-ray to confirm CF is proxying
speed.cloudflare.comMeasures latency and throughput to the nearest Cloudflare PoP

The cf-ray header in any HTTP response uniquely identifies the request and PoP — e.g. cf-ray: 7a1b2c3d4e5f-DFW where DFW = Dallas Fort Worth. First thing to check when debugging a customer issue.


Module 3 · Key Takeaways

Important to Remember

🌐 3.1 — Types of Networks
  • LAN = single location, you own it, high speed (~1–100 Gbps)
  • MAN = city/campus scale, partially leased
  • WAN = multi-city/country, leased infrastructure, uses BGP. Cloudflare's backbone is a private WAN
  • Internet = network of all networks, no single owner, decentralised
🔢 3.2 — IPv4 Addressing
  • IPv4 = 32 bits, 4 octets, each 0–255
  • Every IP address has a network part (which network) and host part (which device)
  • ~4.3 billion total IPv4 addresses — exhausted around 2011. NAT and IPv6 are the solutions
🔷 3.3 — IPv6
  • 128 bits = 340 undecillion addresses — essentially unlimited
  • Written in hex groups: 2606:4700:4700::1111
  • :: replaces consecutive zero groups. ::1 = loopback (like 127.0.0.1)
  • Cloudflare provides free IPv6 compatibility for IPv4-only origins
🔒 3.4 — IP Address Types
  • Private ranges: 10.x.x.x, 172.16.x.x, 192.168.x.x — not routable on internet
  • 127.0.0.1 = loopback (yourself). localhost = same thing
  • 169.254.x.x = DHCP failed — device auto-assigned. Signal of a network problem
  • 255.255.255.255 = limited broadcast (entire local network)
📐 3.5 — Subnetting & CIDR
  • Subnet mask defines where network ends and host begins — 255.255.255.0 = first 3 octets are network
  • CIDR shorthand: /24 = 24 network bits = 255.255.255.0 = 254 usable hosts
  • Usable hosts = 2ⁿ - 2 (n = host bits). Subtract 2 for network and broadcast addresses
  • /32 = single host. /0 = default route (entire internet)
  • Cloudflare WAF firewall rules use CIDR to block IP ranges — 203.0.113.0/24 = 254 IPs blocked
🔄 3.6 — NAT
  • NAT lets multiple private IPs share one public IP using port mapping
  • DNAT table: private IP:port ⇄ public IP:mapped port
  • All devices behind a home NAT appear as the same IP to Cloudflare — affects rate limiting and IP-based rules
  • Static NAT = 1:1 mapping (server with fixed public IP)
📡 3.7 — DHCP
  • DHCP automatically assigns: IP address, subnet mask, default gateway, DNS server
  • DORA: Discover → Offer → Request → Acknowledge
  • IPs are leased (not permanent) — renewed before expiry, returned to pool if device disconnects
  • 169.254.x.x = DHCP failed, device self-assigned — indicates network problem
🗺️ 3.8 — Gateways & Routing Tables
  • Default gateway = the router's LAN IP — where your device sends packets destined outside the local network
  • Routing table = router's decision engine. Longest prefix match wins
  • 0.0.0.0/0 = default route — "send everything else to the ISP"
  • Dynamic routing (BGP) powers the internet — routers learn and share routes automatically
🔧 3.9 — Network Troubleshooting
  • ping — basic reachability + latency test
  • traceroute / tracert — reveals every hop, locates where failures occur
  • nslookup / dig — DNS resolution check
  • curl -I — HTTP response code check
  • Order: DNS → ping → traceroute → curl — work bottom-up through the stack
Module 4 of 10

How the Internet is Built

The physical and logical infrastructure that connects the world — ISPs, submarine cables, data centers, BGP, Anycast, and CDNs.

Module 4 · Topic 4.1

ISPs & The Last Mile

What is an ISP?

An ISP (Internet Service Provider) is the company that gives you access to the internet — AT&T, Comcast, Verizon, BT, Jio. They own the physical infrastructure (cables, routers, data centers) that connects you to the global internet and charge you for access.

ISP Tiers — How They're Organised

ISPs aren't all equal. They're organised in a hierarchy based on how they connect to the rest of the internet:

ISP Tier Hierarchy — How the Internet's Infrastructure is Owned
Tier 1 ISPs AT&T, NTT, Lumen, Telia — own global backbone fiber Tier 2 ISPs National/regional ISPs — lease backbone from Tier 1, sell to Tier 3 Tier 3 ISPs Local ISPs — last mile providers, directly serve homes and businesses You → Tier 3 → Tier 2 → Tier 1 → destination
TierWho they areHow they connectExamples
Tier 1Own the global backbone — transcontinental fiber, submarine cablesFree peering with other Tier 1s (no money changes hands)AT&T, NTT, Lumen, Telia, Cogent
Tier 2Regional/national networksPeer for free where possible, pay Tier 1 for global reachBT, Deutsche Telekom, Comcast backbone
Tier 3Local "last mile" providersPay Tier 2 for transit to the internetLocal cable companies, small ISPs

Peering vs Transit

Peering
Two networks agree to exchange traffic directly — for free. "You send me your customers' traffic, I'll send you mine." Happens at IXPs. Faster and cheaper than transit.
Transit
Smaller network pays a larger one to carry its traffic to the rest of the internet. Like paying for a highway on-ramp. All Tier 3 ISPs pay for transit.

The Last Mile

The last mile is the final connection between your ISP's network and your home or office. It's called "last mile" because it's literally the last segment of delivery — often the most expensive and slowest part of the entire internet path.

TechnologyMediumSpeedLatencyCommon in
Fiber to the Home (FTTH)Fiber optic all the way to premises1–10 GbpsVery low (~1ms)New deployments, urban areas
Cable (DOCSIS)Coaxial cable100Mbps–1Gbps~5–15msUS (Comcast/Xfinity)
DSLExisting phone copper5–100Mbps~10–30msOlder areas, rural
Fixed WirelessRadio waves from tower10–300Mbps~5–20msRural, 5G home internet
Satellite (Starlink)LEO satellite signals50–200Mbps~20–40msRemote areas, maritime
💡 Cloudflare Relevance

Cloudflare peers directly with Tier 1 and Tier 2 ISPs at 300+ IXPs globally. When a customer's user is on Comcast (Tier 3), their traffic reaches Comcast's backbone (Tier 2), which peers with Cloudflare at an IXP — often just one hop away. This is why Cloudflare can deliver content so fast — it's not travelling through multiple transit providers, it's going directly peer-to-peer.


Module 4 · Topic 4.2

Internet Backbone & Submarine Cables

The Internet Backbone

The internet backbone is the collection of high-speed, high-capacity data routes that carry the majority of the internet's traffic across long distances — between cities, countries, and continents. It's owned by Tier 1 ISPs and large network operators.

The backbone consists of:

Submarine Cables — The Physical Internet

Most people imagine the internet as wireless. The reality: ~99% of international internet traffic travels through submarine cables. Satellites (even Starlink) handle only a tiny fraction of global internet traffic.

Submarine Cable — Cross Section (Garden Hose-Sized, Terabits Per Second)
fibers Polyethylene jacket High-tensile steel wires Mylar tape Polyethylene insulation Copper power conductor Steel wire armor Optical fiber bundle ~25mm diameter — the width of a garden hose Carries terabits per second across oceans

Key Facts About Submarine Cables

Scale
400+ submarine cable systems. 1.3 million km of cable on the ocean floor. Enough to circle Earth 30+ times.
Speed
Modern cables carry 200–400 Tbps. A single fiber pair can carry ~70 Tbps. Each cable has multiple pairs.
Repeaters
Signal amplifiers placed every ~100km on the ocean floor. Powered by the copper conductor in the cable — electricity travels the full length.

Who Owns Submarine Cables?

Historically: Tier 1 ISPs and telecom companies (AT&T, NTT, Orange). Today: tech giants are building their own:

What Happens When a Cable is Cut?

The most common cause: ship anchors dragging across the ocean floor. It happens several times per year. The consequence depends on redundancy:

Cable repair ships are a real profession — specialist vessels with underwater robots that physically splice broken cables on the ocean floor.


Module 4 · Topic 4.3

IXPs — Internet Exchange Points

What is an IXP?

An IXP (Internet Exchange Point) is a physical location — usually a data center — where multiple networks (ISPs, CDNs, cloud providers, content companies) connect directly to each other and exchange traffic.

Without IXPs, traffic between two ISPs would have to travel through a third-party transit provider (expensive, slower). At an IXP, they plug directly into the same switch and exchange traffic for free — or at much lower cost.

IXP — Multiple Networks Meeting at One Point
IXP Switch shared peering fabric ISP A (AT&T) ISP B (Comcast) ISP C (BT) Cloudflare Google/YouTube Netflix All exchange traffic directly — no transit provider needed

Why IXPs Matter

Speed
Traffic between two peered networks at an IXP may only travel a few metres of cable. Instead of routing through multiple networks, it's a direct hop.
Cost
Peering at IXPs is free or very cheap. Both networks benefit — no transit fees. This is why content is cheaper to deliver when peering exists.
Resilience
More connections = more redundant paths. If one network has issues, traffic can reroute through another IXP peer.

Major IXPs Globally

IXPLocationParticipantsPeak Traffic
DE-CIX FrankfurtFrankfurt, Germany1,000+~15 Tbps
AMS-IXAmsterdam, Netherlands900+~10 Tbps
LINXLondon, UK900+~7 Tbps
Equinix IXGlobal (50+ locations)ThousandsVaries
💡 Cloudflare & IXPs

Cloudflare is present at 300+ IXPs globally — more than almost any other network. This is a key competitive advantage. When your ISP peers with Cloudflare at a local IXP, your traffic to any Cloudflare-protected site stays within that local exchange rather than traversing the global internet. Lower latency, higher reliability, lower cost.


Module 4 · Topic 4.4

Data Centers

What is a Data Center?

A data center is a purpose-built facility housing computing infrastructure — servers, networking equipment, storage — operated 24/7. Every website, app, and cloud service runs out of a data center somewhere.

What's Inside a Data Center

Inside a Data Center — Key Components
Data Center Rack servers Rack ⚡ Power Dual feeds + UPS + diesel generators ❄️ Cooling A/C + hot/cold aisle containment 🌐 Networking Multiple ISP fiber feeds IXP peering connections 🔒 Physical Security Biometric access, CCTV mantrap entries, guards Everything is redundant — dual power, dual network, dual cooling

Data Center Tiers

TierRedundancyUptimeDowntime/yearUsed for
Tier 1None — single path99.671%~28 hoursSmall companies, dev environments
Tier 2Partial99.741%~22 hoursMid-size businesses
Tier 3N+1 redundancy, concurrent maintenance99.982%~1.6 hoursEnterprise, most cloud providers
Tier 4Full fault-tolerant, 2N redundancy99.995%~26 minutesFinancial systems, critical infrastructure

Colocation vs Cloud

Colocation (Colo)
Company owns their own servers but rents space, power, and network in someone else's data center. Pay for rack space + power + bandwidth. Full control of hardware.
Cloud
Rent compute, storage, and networking from AWS/Azure/GCP. No hardware to manage. Pay per use. The cloud provider runs the data center and all hardware.
💡 Cloudflare's Data Center Strategy

Cloudflare primarily uses colocation — they own their own servers but place them in third-party data centers globally. This lets them put hardware in 330+ cities without building their own buildings everywhere. Each Cloudflare PoP is a colo cage in an existing data center, connected directly to local ISPs and IXPs.


Module 4 · Topic 4.5

Autonomous Systems & BGP

Autonomous Systems (AS)

The internet is not one big network — it's tens of thousands of individual networks operated by different organisations. Each of these independently managed networks is called an Autonomous System (AS).

Every AS is assigned a unique ASN (Autonomous System Number) by IANA. Examples:

OrganisationASN
CloudflareAS13335
GoogleAS15169
AT&TAS7018
Amazon (AWS)AS16509
ComcastAS7922

An AS announces to the world: "I own these IP address ranges." For example, Cloudflare announces it owns 104.16.0.0/12. This is how the rest of the internet knows where to send traffic destined for Cloudflare IPs.

BGP — Border Gateway Protocol

BGP (Border Gateway Protocol) is the routing protocol that connects all autonomous systems together. It is the protocol that makes the internet work as a cohesive whole. Without BGP, individual networks would have no way to know how to reach each other.

BGP's job: exchange routing information between ASes — "I know how to reach these networks, you should send traffic for them to me."

BGP — How Networks Announce Reachability to Each Other
flowchart LR A["AS13335 Cloudflare 104.16.0.0/12"] -->|"BGP: I own 104.16.0.0/12"| B["AS7018 AT&T"] B -->|"BGP: to reach 104.16.0.0/12, go via Cloudflare"| C["AS7922 Comcast"] C -->|"BGP: to reach 104.16.0.0/12, go via AT&T"| D["Your ISP"] style A fill:#f6821f,color:#fff,stroke:#c85a00 style B fill:#2a4cc7,color:#fff,stroke:#1a3399 style C fill:#1a7a44,color:#fff,stroke:#155e35 style D fill:#1a1a2e,color:#fff,stroke:#f6821f

How BGP Works

1
BGP Peering

Two ASes establish a BGP session — a TCP connection between their border routers. They agree to share routing information with each other.

2
Route Announcements

Each AS announces its own IP prefixes: "I own 104.16.0.0/12." It also re-announces routes it learned from others, building a path through the network.

3
Best Path Selection

When multiple paths exist to the same prefix, BGP selects the best one using a set of attributes (AS path length, local preference, etc.). Shortest AS path usually wins.

4
Route Propagation

The selected routes propagate across the internet. Within minutes of a new network connecting via BGP, the entire internet knows how to reach it.

BGP Hijacking

BGP has no built-in authentication — any AS can announce ownership of any IP prefix. BGP hijacking is when a malicious (or misconfigured) AS announces prefixes it doesn't own, redirecting traffic intended for another network.

Famous examples: in 2010, China Telecom briefly announced ~40,000 IP prefixes it didn't own — briefly rerouting 15% of global internet traffic through China. In 2019, a misconfigured ISP in Nigeria accidentally rerouted Google traffic through China Telecom.

Modern mitigation: RPKI (Resource Public Key Infrastructure) — cryptographically verifies that an AS is authorised to announce a given IP prefix. Cloudflare was one of the first to deploy RPKI broadly.

💡 Magic Transit Uses BGP

Cloudflare's Magic Transit product works by having customers advertise their IP ranges to Cloudflare via BGP. Cloudflare then announces these prefixes globally, attracting the customer's traffic through Cloudflare's network first (for DDoS scrubbing) before forwarding clean traffic to the customer's origin. The whole product depends on BGP.


Module 4 · Topic 4.6

How Packets Route Across the Internet

Putting It All Together

You now know about routers, BGP, ISPs, and IXPs. Let's trace exactly what happens when you send a packet from your laptop in Texas to a Cloudflare server.

1
Your laptop → Home router

Packet leaves your laptop, reaches your home router (default gateway) via WiFi or Ethernet. Router checks its routing table — destination 104.21.5.10 is not local, so it sends to the ISP.

2
Home router → ISP (last mile)

Packet travels over your last mile connection (cable/fiber) to your ISP's nearest POP. Your ISP's router checks its BGP routing table — Cloudflare's prefix 104.16.0.0/12 is via a peering session at a local IXP.

3
ISP → Cloudflare at IXP

ISP forwards packet to the IXP switch. Cloudflare is also connected to that IXP. Packet crosses from ISP's AS to Cloudflare's AS (AS13335) — one physical hop inside the exchange.

4
Cloudflare PoP processes it

Cloudflare's nearest PoP (Dallas, Texas in this case) receives the packet. WAF, DDoS protection, caching all run here. If the content is cached — response goes back immediately. If not — Cloudflare forwards to origin over its private backbone.

Full Packet Journey — Texas Laptop to Cloudflare
💻 Laptop Texas WiFi 🏠 Router home cable 📡 ISP AT&T/Comcast peering 🔀 IXP Dallas direct ☁️ CF PoP Dallas if needed Origin server Total: ~10–20ms from Texas to Cloudflare PoP. ~5 router hops.

TTL in Action

Each router hop decrements the TTL by 1. A packet from your laptop starts at TTL=64. After 5 hops through routers, TTL=59 when it reaches Cloudflare. Running traceroute cloudflare.com from Texas would show exactly these hops.

The Full Internet Architecture — How It All Fits Together

Every concept from Modules 2, 3, and 4 connects into this single picture:

The Internet — Full Architecture From Your Device to a Cloudflare-Protected Origin
YOUR HOME (LAN) Laptop Phone Home Router NAT + DHCP Modem Last Mile fiber / cable / DSL Tier 3 ISP local cable company Tier 2 ISP regional network peering IXP Internet Exchange Point networks meet physically direct peer Cloudflare PoP Anycast IP — nearest to user DDoS Protection WAF CDN Cache Bot Management TLS Termination Cache HIT → responds here Cache MISS → forwards to origin via private backbone CF private backbone Origin Server AWS / VPS / on-prem app + database Tier 1 Backbone — Terrestrial Fiber + Submarine Cables AT&T · NTT · Lumen — connects Tier 2 ISPs and IXPs across continents Submarine Cables — fiber on ocean floor · 400+ systems · BGP reroutes automatically if cut Before all of this: DNS resolves domain to Cloudflare Anycast IP · OS builds packet · ARP finds router MAC

Module 4 · Topic 4.7

Latency & Bandwidth

Latency — How Fast a Packet Travels

Latency is the time it takes for a packet to travel from source to destination. Measured in milliseconds (ms). Also called round-trip time (RTT) when measuring the full there-and-back journey.

What Causes Latency?

TypeWhat it isExample
Propagation delayTime for signal to physically travel the distance. Physics — can't be beaten.NY → London = ~70ms minimum (speed of light through fiber)
Processing delayTime routers take to read headers and make forwarding decisions~microseconds per router hop
Queuing delayTime packets spend waiting in a router's queue during congestionAdds ms–100ms during network congestion
Transmission delayTime to push all bits of a packet onto the wire1,500 byte packet on 1 Gbps link = 0.012ms

Real-World Latency Numbers

RouteApproximate Latency
Your laptop → home router~1ms
Your laptop → local Cloudflare PoP~5–15ms
New York → London~70ms
New York → Tokyo~150ms
London → Sydney~250ms
LEO satellite (Starlink)~20–40ms
Geostationary satellite (old)~600ms

Bandwidth — How Much Data Flows

Bandwidth is the maximum capacity of a network link — how much data can flow through it simultaneously. Measured in bits per second (Mbps, Gbps, Tbps).

🛣️ Analogy — Highway vs Speed of Light

Think of data travelling like cars on a highway:

  • Latency = how fast each car travels (speed). Physics sets the limit.
  • Bandwidth = how many lanes the highway has. More lanes = more cars simultaneously, but each car still travels at the same speed.
  • A 10-lane highway (high bandwidth) doesn't make cars faster — it just lets more travel at once.

Bandwidth vs Throughput

Throughput is the actual data transferred per second — always less than or equal to bandwidth. Bandwidth is the pipe size; throughput is what actually flows through it.

ConceptWhat it meansAnalogy
BandwidthMaximum capacity of the linkHighway with 10 lanes
ThroughputActual data transferred (always ≤ bandwidth)Actual cars on the highway right now
LatencyTime for one packet to travelSpeed each car travels
💡 Why Cloudflare Reduces Latency

Cloudflare's 330+ PoPs mean your traffic hits a Cloudflare server physically close to you — minimising propagation delay. Cloudflare also uses its own private backbone (not the public internet) to carry traffic between PoPs, avoiding congested public internet paths. The combination reduces latency for users compared to going directly to a distant origin server.


Module 4 · Topic 4.8

Anycast

What is Anycast?

Anycast is a network addressing method where the same IP address is advertised from multiple locations simultaneously. When a packet is sent to an anycast IP, the internet's routing (BGP) automatically delivers it to the nearest location advertising that IP.

Compare the four addressing types:

TypeHow it worksExample
UnicastOne source, one destination — standard IP routingYour laptop → one specific server
BroadcastOne source → all devices on local networkARP request to 255.255.255.255
MulticastOne source → a group of subscribed receiversVideo streaming to multiple subscribers
AnycastOne IP → many locations, traffic goes to nearest oneCloudflare's 1.1.1.1 — hits nearest PoP

How Anycast Works with BGP

Cloudflare runs servers in 330+ cities. All of them advertise the same IP prefix (e.g. 104.16.0.0/12) via BGP. When your packet is destined for 104.21.5.10:

Anycast — Same IP Announced From Multiple PoPs, Traffic Goes to Nearest
Internet (BGP routing) CF Dallas PoP 104.21.5.10 ← CF London PoP 104.21.5.10 ← CF Tokyo PoP 104.21.5.10 ← CF Sydney PoP 104.21.5.10 ← User in Texas → routed to Dallas (nearest PoP)

Why Anycast is Powerful

Automatic Proximity
Users automatically hit the nearest PoP — no DNS tricks or load balancing needed. BGP routes them there based on network topology.
Automatic Failover
If a PoP goes down, BGP withdraws its route announcement. Traffic automatically reroutes to the next nearest PoP — no manual intervention.
DDoS Absorption
Attack traffic targeting one IP gets spread across all PoPs globally. A 1 Tbps attack gets distributed — no single location receives the full volume.

Real Example — Cloudflare's 1.1.1.1 DNS

Cloudflare's public DNS resolver 1.1.1.1 is anycast. That single IP is advertised from all 330+ Cloudflare PoPs simultaneously. When your laptop queries 1.1.1.1, BGP routes the packet to the nearest Cloudflare PoP — could be 5ms away. This is how it became the world's fastest DNS resolver.

💡 Anycast is Foundational to Cloudflare

Every Cloudflare product relies on Anycast. When a customer puts their domain on Cloudflare, all traffic to that domain is handled by Cloudflare IPs — which are Anycast. Users worldwide automatically hit their nearest PoP. This is the foundation of Cloudflare's performance and resilience story.


Module 4 · Topic 4.9

CDN Concept

The Problem CDNs Solve

Imagine a company based in New York with a single origin server there. A user in Singapore visits their website:

Without CDN vs With CDN
❌ Without CDN Singapore user ~250ms New York origin ✅ With CDN Singapore user ~5ms CF PoP Singapore NY Full round trip every request Origin handles all load Served from nearby cache Origin only hit on cache miss

How a CDN Works

1
First request — cache miss

Singapore user requests example.com/logo.png. Nearest Cloudflare PoP (Singapore) has no cached copy. It fetches from the New York origin (~250ms).

2
CDN caches the response

Cloudflare stores the logo in its Singapore PoP cache. Cache duration depends on Cache-Control headers from the origin (we'll cover this in Module 7).

3
All subsequent requests — cache hit

Next Singapore user requesting the same logo gets it from the local cache in ~5ms. Origin server never involved. This is called a cache hit.

What Can Be Cached?

✅ Cacheable
Images, CSS, JavaScript, fonts, videos, PDFs, HTML pages (static), API responses (if configured)
❌ Not Cacheable by Default
Personalised content, shopping carts, logged-in pages, POST requests, anything with session cookies

CDN Benefits Beyond Speed


Module 4 · Topic 4.10

Cloud Computing Basics

What is Cloud Computing?

Cloud computing means accessing computing resources — servers, storage, databases, networking — on-demand over the internet rather than owning physical hardware. You pay for what you use, like a utility bill.

The Three Cloud Service Models

IaaS vs PaaS vs SaaS — What You Manage vs What They Manage
IaaS PaaS SaaS Application Runtime Middleware OS Virtualisation Hardware You manage Provider manages
ModelWhat you getWhat you manageExamples
IaaS
Infrastructure as a Service
Raw VMs, storage, networkingOS, runtime, apps — everything above the virtualisation layerAWS EC2, Azure VMs, Google Compute Engine
PaaS
Platform as a Service
Managed platform to deploy codeOnly your application code and dataHeroku, Google App Engine, Cloudflare Workers
SaaS
Software as a Service
Ready-to-use softwareNothing — just configure and useGmail, Salesforce, Cloudflare Dashboard

Public vs Private vs Hybrid Cloud

Public Cloud
Infrastructure shared with other customers (AWS, Azure, GCP). Cheapest, most scalable. Data stored in provider's facilities.
Private Cloud
Dedicated infrastructure in your own data center or colocation. Full control. Expensive. Used by banks, governments, regulated industries.
Hybrid Cloud
Mix of both. Sensitive data on-premise, general workloads in public cloud. Most enterprises operate this way today.
💡 Why This Matters for Cloudflare Conversations

Cloudflare customers run workloads everywhere — AWS, Azure, GCP, on-premise, hybrid. Cloudflare sits in front of all of it. A customer might have their origin in AWS (public cloud) and their internal tools on-premise (private). Cloudflare protects both. Understanding these models helps you understand where the customer's origin server actually lives when designing a solution.


Module 4 · Topic 4.11

VPNs — Virtual Private Networks

What Problem Does a VPN Solve?

Before VPNs: a company with offices in New York and London needed a dedicated private leased line between them (MPLS or similar) — expensive, inflexible. Employees working from home couldn't access internal systems at all.

VPNs solved this by creating an encrypted tunnel over the public internet, making it behave like a private network — without the dedicated hardware.

How a VPN Works

1
Client connects to VPN server

Your laptop runs VPN software. It establishes an encrypted tunnel to a VPN server (usually at your company's HQ or a VPN provider's server).

2
All traffic routed through tunnel

Your device's traffic is wrapped (encapsulated) in an encrypted packet and sent through the tunnel. Your device acts as if it's physically on the corporate network.

3
VPN server decrypts and forwards

The VPN server unwraps your packet, decrypts it, and sends it to the actual destination on your behalf. Replies come back the same way.

VPN Tunnel — Encrypted Traffic Over the Public Internet
💻 Laptop home 🔒 Encrypted VPN Tunnel Public internet — but nobody can read the contents VPN Server company HQ Assigned internal IP e.g. 10.0.0.55 Decrypts & forwards to internal systems

VPN Limitations — Why Zero Trust Replaces Them

Traditional VPNs work but have serious problems at scale:

ProblemWhat it means
Network-level accessOnce connected, user is on the full internal network. Compromised VPN credentials = attacker has access to everything.
HairpinningAll traffic routes through the VPN server — even traffic to the internet. Slows everything down and overloads HQ bandwidth.
Doesn't scaleVPN concentrators are hardware devices. Scaling for 10,000 remote workers is expensive and complex.
No per-app controlTraditional VPN grants access to the network, not specific applications. Can't say "this user can access the HR portal but not the finance system."
💡 This is the Setup for Cloudflare One

Cloudflare Access (ZTNA) replaces the VPN model entirely. Instead of connecting users to a network, Access grants users access to specific applications based on identity. No VPN client, no network-level access, no hairpinning. This is the "VPN replacement" story you'll use in every Cloudflare One conversation — and it only makes sense if you understand what VPNs do and why they're painful.


Module 4 · Key Takeaways

Important to Remember

🌐 4.1 — ISPs & The Last Mile
  • Tier 1 = own global backbone, free peering. Tier 2 = regional, pay for global transit. Tier 3 = last mile to homes/offices
  • Peering = free direct exchange between networks. Transit = paying to route through another network
  • Last mile technologies: FTTH (fastest), cable, DSL, fixed wireless, Starlink
  • Cloudflare peers directly with ISPs at 300+ IXPs — traffic stays local, not through transit
🔌 4.2 — Internet Backbone & Submarine Cables
  • ~99% of international internet traffic travels through submarine fiber cables, not satellites
  • 400+ cable systems, 1.3 million km on ocean floor
  • Copper conductor in cable powers repeaters every ~100km
  • Cable cuts are handled automatically by BGP rerouting — except in regions with very few cables
  • Google, Meta, Microsoft now own their own submarine cables
🔀 4.3 — IXPs
  • Physical location where multiple networks connect directly and exchange traffic
  • Peering at IXPs = faster, cheaper than transit routing
  • Cloudflare is at 300+ IXPs globally — largest footprint of any network
  • DE-CIX Frankfurt, AMS-IX Amsterdam, LINX London are the largest IXPs
🏢 4.4 — Data Centers
  • Purpose-built facilities for servers — redundant power, cooling, physical security, multiple network feeds
  • Tier 1–4 classification (4 = highest availability, ~26 min downtime/year)
  • Colocation = own servers, rent space. Cloud = rent everything from AWS/Azure/GCP
  • Cloudflare uses colocation — owns servers, places them in 330+ third-party facilities globally
📡 4.5 — Autonomous Systems & BGP
  • Every independently managed network = an AS with a unique ASN. Cloudflare = AS13335
  • BGP is the protocol that connects all ASes — "I own these IPs, send traffic for them to me"
  • BGP hijacking = malicious/accidental announcement of wrong prefixes. RPKI prevents this
  • Magic Transit is built on BGP — customers advertise their IPs through Cloudflare
🗺️ 4.6 — How Packets Route
  • Packets hop router by router — each router only knows the next hop, not the full path
  • TTL decrements by 1 per hop — prevents infinite routing loops
  • From Texas to Cloudflare: Laptop → Home Router → ISP → IXP → Cloudflare Dallas PoP (~10–15ms)
⚡ 4.7 — Latency & Bandwidth
  • Latency = time for packet to travel (ms). Propagation delay is the physical limit — speed of light
  • Bandwidth = capacity of the link (Mbps/Gbps). Throughput = actual data flowing (always ≤ bandwidth)
  • NY → London = ~70ms min. NY → Tokyo = ~150ms min. Local CF PoP = ~5–15ms
  • Cloudflare reduces latency by being physically close to users + using private backbone
🌍 4.8 — Anycast
  • Same IP advertised from multiple locations — BGP routes traffic to the nearest one
  • Benefits: automatic proximity routing, automatic failover, DDoS traffic distribution
  • Cloudflare's entire network runs on Anycast — 1.1.1.1, all customer IPs are anycast
  • This is the technical foundation of every Cloudflare performance claim
📦 4.9 — CDN Concept
  • CDN caches content at edge PoPs close to users — serving from cache = ~5ms vs ~250ms from distant origin
  • Cache hit = served from edge. Cache miss = fetched from origin and then cached
  • Benefits: speed, origin offload, DDoS resilience, global availability
  • Static content (images, CSS, JS) caches well. Personalised/dynamic content does not
☁️ 4.10 — Cloud Computing
  • IaaS = rent raw VMs (EC2). PaaS = managed platform (Workers, Heroku). SaaS = ready-made software (Gmail)
  • Public = shared infra (AWS). Private = your own DC. Hybrid = both
  • Most enterprise customers use hybrid — origin in AWS/Azure + on-premise. Cloudflare protects both
🔒 4.11 — VPNs
  • VPNs create encrypted tunnels over public internet — make remote users act as if on corporate network
  • Problems: network-level access (too broad), hairpinning (slow), doesn't scale, no per-app control
  • Cloudflare Access (ZTNA) replaces VPN — identity-aware, per-app access, no network tunnel needed
  • Understanding VPN pain is essential for the Cloudflare One sales conversation
Module 5 of 10

Protocols & The OSI Model

The agreed-upon rules that govern all network communication — and the layered model that organises them.

Module 5 · Topic 5.1

Protocols & The OSI Model

What is a Protocol?

A protocol is a set of agreed-upon rules that define how two devices communicate. Without protocols, every manufacturer would invent their own communication method and devices from different vendors would never be able to talk to each other.

Think of it like human language — English works because both speakers agree on the same grammar and vocabulary. Protocols are the "language" computers agree to use.

Protocols define:

Format
How data is structured — what bytes mean what, where headers go, what fields are required
Order
Which side speaks first, how a connection starts, how it ends — the sequence of messages
Error handling
What happens when something goes wrong — retransmit? Ignore? Send an error message?

The OSI Model — Why It Exists

Networking is complex. A single web request involves dozens of different technologies — WiFi, IP routing, TCP connections, TLS encryption, HTTP. Without a framework, it would be chaos.

The OSI Model (Open Systems Interconnection) was created by the ISO in 1984 as a conceptual framework that divides all networking functions into 7 distinct layers, each with a specific job. Each layer only talks to the layer directly above or below it.

The OSI model doesn't describe actual protocols in use — it's a reference model for understanding and categorising network behaviour. Its value: when something breaks, you can immediately narrow down which layer has the problem.

The 7 Layers

OSI Model — 7 Layers, From Physical to Application
L7 L6 L5 L4 L3 L2 L1 Application Presentation Session Transport Network Data Link Physical HTTP, DNS, SMTP, FTP What the user/app interacts with TLS/SSL, compression, encoding Encryption, format translation Session establishment & teardown Manages ongoing conversations TCP, UDP — ports, reliability End-to-end data delivery IP, ICMP, routing Logical addressing, routing across networks Ethernet, WiFi, MAC addresses, switches Node-to-node delivery on same network Cables, radio waves, voltage pulses Bits on the wire ↓ DATA FLOWS DOWN — SENDING ↑ DATA FLOWS UP — RECEIVING

The Layers You'll Use Most in Cloudflare Context

LayerWhy it matters for Cloudflare
L7 — ApplicationWAF, Bot Management, Rate Limiting, CDN — all operate here. Inspect and act on HTTP requests.
L6 — PresentationTLS termination — Cloudflare decrypts HTTPS at the edge here before inspecting the HTTP beneath it.
L4 — TransportTCP/UDP — Cloudflare's Spectrum product proxies at L4. Magic Firewall filters here.
L3 — NetworkMagic Transit operates at L3 — filters IP packets before they reach the application layer.
💡 L3/L4 vs L7 DDoS — The Key Distinction

When customers talk about DDoS, the layer matters enormously:

  • L3/L4 DDoS — Volumetric packet floods. UDP amplification, SYN floods. Measured in Gbps/Tbps. Cloudflare handles via Magic Transit and network-level rules.
  • L7 DDoS — HTTP floods, slow POST attacks. Look like legitimate traffic. Harder to detect. Cloudflare handles via WAF rules and HTTP DDoS managed rulesets.

A "100 Gbps DDoS attack" is L3/L4. A "10 million requests per second HTTP flood" is L7. Completely different defence mechanisms.


Module 5 · Topic 5.2

TCP/IP Model

The Practical Model

The OSI model is a conceptual framework. The TCP/IP model is the practical one — it's what the internet actually runs on. It was developed by DARPA in the 1970s and has 4 layers instead of 7, collapsing some of the OSI layers that are rarely distinct in practice.

TCP/IP Model vs OSI Model — How They Map
TCP/IP Model (practical) Application HTTP, DNS, SMTP, TLS Transport TCP, UDP Internet IP, ICMP, routing Network Access Ethernet, WiFi, cables OSI Model (reference) L7 — Application L6 — Presentation L5 — Session L4 — Transport L3 — Network L2 — Data Link L1 — Physical TCP/IP Application = OSI L5 + L6 + L7 combined

Key Difference — Why TCP/IP Collapsed L5/L6/L7

In the OSI model, Session (L5), Presentation (L6), and Application (L7) are theoretically separate. In practice, most protocols handle all three — HTTP handles session management and TLS handles presentation (encryption). So TCP/IP just calls it all "Application."

In Cloudflare conversations, people use both models interchangeably. The most common reference is OSI — specifically L3, L4, and L7. You'll rarely hear "L1" or "L6" in a product conversation.

What Travels at Each Layer

TCP/IP LayerOSI LayersData unit nameWhat it contains
ApplicationL5/L6/L7Data / MessageHTTP request, DNS query, email — actual content
TransportL4Segment (TCP) / Datagram (UDP)Application data + TCP/UDP header (ports, sequence numbers)
InternetL3PacketSegment + IP header (source IP, destination IP, TTL)
Network AccessL1/L2FramePacket + Ethernet header (source MAC, destination MAC)

Module 5 · Topic 5.3

Encapsulation & Decapsulation

How Data Gets Wrapped as It Travels Down the Stack

As data moves from the Application layer down to the Physical layer, each layer wraps the data with its own header — adding addressing and control information needed at that layer. This process is called encapsulation. At the receiving end, each layer strips off its header — this is decapsulation.

Encapsulation — Each Layer Adds Its Own Header on the Way Down
L7 Application: HTTP DATA — "GET /index.html HTTP/1.1" L4 Transport: TCP header HTTP DATA ports, sequence num, flags L3 Network: IP header TCP hdr HTTP DATA src/dst IP, TTL, protocol L2 Data Link: ETH header IP hdr TCP hdr HTTP DATA FCS checksum src/dst MAC L1 Physical: 010110001101001010001... (bits on the wire) S E N D I N G Decapsulation (Receiving End — Reverse Process) L1 reads bits → L2 strips Ethernet header → L3 strips IP header → L4 strips TCP header → L7 reads HTTP data Each layer only reads ITS OWN header — passes the rest up

Why This Matters for Cloudflare

Cloudflare sits in the path of every request and operates at multiple layers simultaneously:

This is why Cloudflare can inspect a WAF rule on User-Agent header (L7) while simultaneously enforcing an IP block (L3) and a rate limit by port (L4) — all on the same packet, in the same PoP, in microseconds.


Module 5 · Topic 5.4

TCP — Transmission Control Protocol

What TCP Does

TCP is the reliable delivery protocol at Layer 4. When your browser loads a webpage, it uses TCP to make sure every byte of the HTML, CSS, and images arrives correctly — in order, without gaps, without corruption.

TCP provides three guarantees: ordered delivery (packets arrive in sequence), reliable delivery (lost packets are retransmitted), and error checking (corrupted data is detected and discarded).

The Three-Way Handshake — How TCP Connections Start

Before any data is exchanged, TCP establishes a connection with a 3-step process:

TCP 3-Way Handshake — Connection Establishment
💻 Client your browser 🖥️ Server cloudflare.com ① SYN — "I want to connect, seq=100" "Synchronise" ② SYN-ACK — "OK, seq=200, ack=101" "I'm ready too" ③ ACK — "Acknowledged, ack=201" "Got it" ✅ Connection Established — Data can flow

Only after the handshake completes does the browser send the HTTP request. This is why the first connection to a website takes slightly longer — the handshake adds one round-trip of latency before any data flows.

💡 SYN Flood — A Real Attack

A SYN flood is a DDoS attack that exploits the TCP handshake. The attacker sends millions of SYN packets but never completes the handshake (never sends the final ACK). The server allocates memory for each half-open connection, waiting for the ACK that never comes — eventually exhausting resources and crashing. Cloudflare's L4 DDoS protection detects and drops SYN floods before they reach the origin.

Key TCP Concepts

ConceptWhat it does
Sequence numbersEach byte gets a sequence number so the receiver can reassemble packets in order even if they arrive out of sequence
Acknowledgements (ACK)Receiver tells sender which bytes were received. If no ACK comes, sender retransmits.
Flow controlReceiver tells sender how much data it can handle at once (window size). Prevents overwhelming a slow receiver.
Congestion controlTCP slows down when it detects packet loss — a sign of network congestion. Gradually speeds up when the path is clear.
Connection teardownFIN → ACK → FIN → ACK. 4 steps: client sends FIN, server ACKs, server sends FIN, client ACKs. Both sides confirm they are done sending before closing.

Sockets — How Applications Use TCP

Applications don't talk to TCP directly — they use the OS abstraction called a socket. A socket is the combination of an IP address and a port that uniquely identifies one end of a connection. A full TCP connection is identified by 4 values:

A TCP Connection — Uniquely Identified by 4 Values
Client Socket 192.168.1.5 : 52341 TCP Server Socket 104.21.5.10 : 443 ephemeral port (OS-assigned) well-known port (HTTPS)

The OS tracks thousands of simultaneous socket connections — each identified by this unique 4-tuple. This is how your browser can have 10 tabs open to different sites while keeping all their data streams separate.


Module 5 · Topic 5.5

UDP & ICMP

UDP — User Datagram Protocol

UDP is TCP's counterpart at Layer 4 — but with the opposite philosophy. Where TCP prioritises reliability, UDP prioritises speed. It sends packets and doesn't care if they arrive.

No handshake
UDP just sends. No connection established first. Saves one round-trip of latency before data flows.
No acknowledgements
Sender doesn't wait for confirmation. No retransmission if a packet is lost. Application must handle this itself if needed.
No ordering
Packets may arrive out of order. Application decides whether order matters.

TCP vs UDP — When to Use Which

PropertyTCPUDP
Reliability✅ Guaranteed delivery, retransmission❌ Fire and forget
Order✅ Always in sequence❌ May arrive out of order
SpeedSlower (overhead of acknowledgements)Faster (no handshake, no ACKs)
ConnectionConnection-oriented (3-way handshake)Connectionless (just send)
Use casesHTTP/HTTPS, email, file downloads, SSHDNS, video streaming, VoIP, gaming, QUIC

Why UDP for Streaming and Gaming?

If you're watching a live video stream and a packet is lost — there's no point retransmitting it. By the time it arrives, that frame is already 500ms in the past. Better to just show a slightly glitchy frame and keep playing. TCP's retransmission would cause freezing. UDP's "accept the loss" approach is better for real-time media.

💡 HTTP/3 Uses UDP — Not TCP

HTTP/3 (the latest version of HTTP) is built on QUIC — a protocol that runs over UDP instead of TCP. QUIC gets the reliability features of TCP (retransmission, ordering) but implements them at the application layer, avoiding TCP's head-of-line blocking problem. Cloudflare was one of the first CDNs to support HTTP/3 and QUIC globally. This comes up in Module 7 when we cover HTTP versions.

UDP DDoS — Why UDP is Exploited

UDP has no handshake — so an attacker can send packets with a spoofed source IP (fake sender address). This enables amplification attacks:

Common amplification targets: DNS (up to 50x amplification), NTP (up to 556x), Memcached (up to 51,000x). Cloudflare blocks these at L3/L4 before they reach customers.

ICMP — Internet Control Message Protocol

ICMP is not a data transfer protocol — it's a diagnostic and error-reporting protocol. It operates at Layer 3 alongside IP and is used by routers and hosts to communicate network conditions.

ICMP UseWhat it doesTool that uses it
Echo Request/ReplyTest if a host is reachable and measure RTTping
TTL ExceededRouter tells sender "TTL hit 0, packet discarded"traceroute
Destination UnreachableRouter can't forward packet — no route to host, port closedAppears as error messages
RedirectRouter tells sender to use a different gatewayRouting optimisation

Many firewalls block ICMP — which is why you sometimes see * * * in traceroute output even when the path is working fine.


Module 5 · Key Takeaways

Important to Remember

📋 5.1 — Protocols & The OSI Model
  • A protocol = agreed-upon rules for communication (format, order, error handling)
  • OSI = 7-layer reference model: L1 Physical → L2 Data Link → L3 Network → L4 Transport → L5 Session → L6 Presentation → L7 Application
  • L3 = IP/routing, L4 = TCP/UDP/ports, L7 = HTTP/application content — these three layers are referenced constantly in Cloudflare
  • L7 DDoS = HTTP floods. L3/L4 DDoS = packet floods. Different products defend each.
  • TLS operates at L6 (Presentation) — Cloudflare terminates TLS here to inspect L7 content
📐 5.2 — TCP/IP Model
  • TCP/IP has 4 layers vs OSI's 7 — collapses L5/L6/L7 into "Application"
  • Data units: Message (L7) → Segment/Datagram (L4) → Packet (L3) → Frame (L2) → Bits (L1)
  • In practice, people use OSI layer numbers (L3, L4, L7) even though the internet runs TCP/IP
📦 5.3 — Encapsulation & Decapsulation
  • Sending: each layer wraps data with its own header (Application → Transport → Network → Data Link → Physical)
  • Receiving: each layer strips its own header in reverse
  • Cloudflare operates at L3 (IP), L4 (TCP/UDP), L6 (TLS), and L7 (HTTP) simultaneously on every request
  • WAF rules can check HTTP headers (L7) while IP blocks work at L3 — same packet, same time
🔗 5.4 — TCP
  • TCP = reliable, ordered, connection-oriented. Used for HTTP/HTTPS, email, file downloads
  • 3-way handshake: SYN → SYN-ACK → ACK before any data flows
  • Handshake adds one round-trip of latency — why first connections are slower
  • SYN flood = DDoS attack exploiting the handshake. Cloudflare blocks at L4.
  • Socket = IP + Port (both sides). 4-tuple (client IP, client port, server IP, server port) uniquely identifies every TCP connection
⚡ 5.5 — UDP & ICMP
  • UDP = fast, connectionless, no reliability. Fire and forget.
  • Used for DNS, video streaming, VoIP, gaming, and HTTP/3 (QUIC)
  • UDP has no handshake → source IP can be spoofed → enables amplification DDoS attacks
  • ICMP = diagnostic protocol. ping uses Echo Request/Reply. traceroute uses TTL Exceeded messages.
  • * * * in traceroute = that router blocks ICMP, not necessarily that the path is broken
Module 6 of 10

DNS — Domain Name System

The phonebook of the internet — how domain names get translated into IP addresses, and why it's the first thing that happens on every single web request.

Module 6 · Topic 6.1

What is DNS & Why it Exists

The Problem DNS Solves

Computers communicate using IP addresses — 104.21.5.10. Humans remember names — cloudflare.com. DNS is the system that bridges this gap: it translates human-readable domain names into machine-readable IP addresses.

Without DNS, you'd need to memorise IP addresses for every website you visit. With DNS, you type a name and the internet figures out the address for you — automatically, in milliseconds.

DNS — The Internet's Phonebook
cloudflare.com human-readable DNS translates 104.21.5.10 machine-readable what you type what the computer connects to

Why DNS is Critical Infrastructure

DNS is the very first step of every internet connection. Before your browser can connect to any website, it must resolve the domain name to an IP address. If DNS fails — nothing works. Not email, not websites, not apps. DNS is often described as the "phone directory of the internet" — without it, you know the name but can't find the number.

This is also why DNS is such a high-value attack target — taking down DNS takes down everything that depends on it.

💡 Cloudflare's DNS Products

Cloudflare has two distinct DNS products that often get confused:

  • Authoritative DNS — Cloudflare acts as the authoritative nameserver for a customer's domain. When anyone in the world asks "what's the IP for cloudflare.com?" — Cloudflare's DNS servers answer. This is the entry point for every Cloudflare customer.
  • 1.1.1.1 (Recursive Resolver) — A public DNS resolver that anyone can use instead of their ISP's resolver. Fastest DNS resolver in the world (Anycast). Privacy-focused — doesn't log queries.

These are different products solving different problems. A customer onboarding to Cloudflare uses Authoritative DNS. An employee using 1.1.1.1 on their laptop is using the resolver.


Module 6 · Topic 6.2

Domain Name Structure

Anatomy of a Domain Name

Domain names are read right to left — the most significant part is on the right. Each section separated by a dot is called a label.

Domain Name Anatomy — blog.cloudflare.com
blog . cloudflare . com TLD Top-Level Domain .com .org .net .io Second-Level Domain Registered domain cloudflare, google, apple Subdomain Optional prefix www, blog, api, mail . root (implied, invisible)

FQDN — Fully Qualified Domain Name

A FQDN is the complete domain name including the root dot (which is normally invisible). For example: blog.cloudflare.com. — note the trailing dot. The root (.) is the very top of the DNS hierarchy.

Common TLDs

TLD TypeExamplesManaged by
Generic (gTLD).com .org .net .io .devICANN-accredited registrars
Country (ccTLD).uk .de .in .jp .auCountry's designated authority
New gTLD.cloud .app .security .bankVarious operators (ICANN-approved)
Infrastructure.arpaIANA — used for reverse DNS
💡 Subdomains in Cloudflare

When a customer onboards to Cloudflare, they add a zone — typically their registered domain (e.g. example.com). Cloudflare then manages DNS records for that zone, including all subdomains. A customer can proxy www.example.com through Cloudflare (orange cloud) while leaving mail.example.com unproxied (grey cloud) — because email should not route through Cloudflare's HTTP proxy.


Module 6 · Topic 6.3

DNS Hierarchy & Resolvers

The DNS Hierarchy

DNS is not a single server or database — it's a distributed, hierarchical system spread across thousands of servers globally. No single server knows everything. Instead, each level knows about the next level down.

DNS Hierarchy — Three Levels of Authority
Root Nameservers 13 sets (a-m.root-servers.net)1000+ physical servers globally Know where TLD servers are. Nothing else. .com TLD server Managed by Verisign .org TLD server Managed by PIR .uk TLD server Managed by Nominet cloudflare.com NS ns1.cloudflare.com google.com NS ns1.google.com bbc.co.uk NS Authoritative for bbc.co.uk

The Three Server Types

Server TypeWhat it knowsWho runs it
Root NameserversWhere to find each TLD's nameserver. Nothing else.13 organisations (ICANN coordinates). Anycast — 1000+ physical servers globally.
TLD NameserversWhich authoritative nameserver is responsible for each domain under that TLD.Registry operators — Verisign (.com), PIR (.org), Nominet (.uk), etc.
Authoritative NameserversThe actual DNS records for a specific domain — A, MX, CNAME, TXT, etc.Domain owners — or their DNS provider (e.g. Cloudflare, Route53, GoDaddy)

DNS Resolvers — The Middlemen

A recursive resolver (also called a recursive nameserver or DNS resolver) is the server your device talks to when it needs to resolve a domain. It does the legwork of querying the hierarchy on your behalf — asking root, then TLD, then authoritative — and returns the final answer to you.

Your ISP's Resolver
Default for most users. Assigned automatically via DHCP. May cache aggressively, may log queries, variable performance.
Cloudflare 1.1.1.1
Public resolver. Anycast — hits nearest PoP. Privacy-first (no query logging). Fastest average response globally.
Google 8.8.8.8
Public resolver. Widely used. Good performance. Google uses data for analytics (unlike 1.1.1.1).

Module 6 · Topic 6.4

DNS Resolution — Step by Step

What Happens When You Type cloudflare.com

DNS resolution is a multi-step process. Most of the time it's instant because of caching — but understanding the full uncached flow is essential.

Full DNS Resolution — Uncached — From Browser to Answer
sequenceDiagram participant B as 💻 Browser participant O as 🖥️ OS Cache participant R as 🔄 Recursive Resolver (1.1.1.1) participant T as 🌐 Root Nameserver participant C as 📋 .com TLD Server participant A as ✅ Authoritative NS (Cloudflare) B->>O: cloudflare.com? O->>B: Not in cache B->>R: cloudflare.com? R->>T: cloudflare.com? (Root) T->>R: Ask .com TLD server R->>C: cloudflare.com? (.com TLD) C->>R: Ask ns1.cloudflare.com R->>A: cloudflare.com? (Authoritative) A->>R: 104.21.5.10 (TTL 300) R->>B: 104.21.5.10 Note over B,R: Browser now connects to 104.21.5.10

Where Caching Happens

The full recursive lookup above only happens when nothing is cached. In practice, most DNS queries are answered from cache at one of these levels:

1
Browser cache

Your browser caches DNS results. Chrome, Firefox, Safari all maintain their own DNS cache. Check with chrome://net-internals/#dns.

2
OS cache

Your operating system maintains a DNS cache. On Mac: sudo dscacheutil -flushcache. On Windows: ipconfig /flushdns.

3
Recursive resolver cache

Your resolver (1.1.1.1) caches results and serves them to all users who query the same domain. A popular domain may never trigger a full recursive lookup at this stage.

4
Full recursive lookup

Only happens if all caches are cold — root → TLD → authoritative. Even this takes only ~100ms globally.


Module 6 · Topic 6.5

DNS Caching & TTL

What is TTL?

TTL (Time to Live) is a value in seconds attached to every DNS record that tells resolvers how long they can cache the answer before they need to ask again. It's set by whoever manages the authoritative DNS for that domain.

TTL — How Long a DNS Answer Can Be Cached
Query made resolver caches answer + TTL TTL = 300s — served from cache TTL expires next query → authoritative cache refreshed Shorter TTL = fresher data, more queries. Longer TTL = stale risk, fewer queries. Best practice: lower to 300s before any DNS change, raise after stable.

TTL Tradeoffs

TTL ValueProsConsUse case
Short (60–300s)Changes propagate quicklyMore DNS queries, slightly higher latencyDuring migrations, incident response
Medium (300–3600s)Good balanceModerate propagation timeMost production sites
Long (86400s = 1 day)Fewer queries, fast for users, lower loadChanges take a full day to propagate globallyStable infrastructure that rarely changes

DNS Propagation

When you change a DNS record, the old answer is still cached at resolvers around the world for up to the TTL duration. This is why "DNS propagation" takes time — each resolver must wait for its cached copy to expire before fetching the new answer. With a 24-hour TTL, some users might see the old IP for up to 24 hours after you make a change.

💡 Cloudflare's TTL Recommendation

When onboarding a customer to Cloudflare, the standard advice is to lower TTL to 300 seconds (5 minutes) before changing nameservers. This ensures that if anything goes wrong, you can quickly roll back and the change will take effect within 5 minutes rather than waiting hours. After everything is stable, TTL can be raised back to normal. This is a real workflow you'll guide customers through.


Module 6 · Topic 6.6

DNS Record Types

The Most Important DNS Records

RecordFull NameWhat it doesExample
AAddressMaps domain → IPv4 address. Most common record.cloudflare.com → 104.21.5.10
AAAAIPv6 AddressMaps domain → IPv6 address.cloudflare.com → 2606:4700::1
CNAMECanonical NameMaps domain → another domain name (alias). The resolver then resolves the target domain.www.example.com → example.com
MXMail ExchangeSpecifies which server handles email for the domain. Has a priority number — lower = higher priority.example.com MX 10 mail.example.com
TXTTextStores arbitrary text. Used for domain verification, SPF (email anti-spoofing), DMARC, DKIM.v=spf1 include:cloudflare.com ~all
NSNameserverSpecifies which DNS servers are authoritative for the domain. Set when delegating to a DNS provider.ns1.cloudflare.com, ns2.cloudflare.com
SOAStart of AuthorityAdministrative info about the zone — which nameserver is primary, contact email, serial number.Auto-generated, rarely set manually
PTRPointerReverse DNS — maps IP → domain name. Used by mail servers to verify sender identity.10.5.21.104.in-addr.arpa → cloudflare.com
SRVServiceSpecifies host and port for a service (VoIP, XMPP, etc.)._sip._tcp.example.com SRV 10 60 5060 sip.example.com
CAACertification Authority AuthorizationSpecifies which CAs can issue SSL certs for the domain. Security control.example.com CAA 0 issue "letsencrypt.org"

CNAME vs A Record — Key Distinction

A Record
Points directly to an IP address.

example.com → 104.21.5.10

One resolution step. Fast. Can be used on root domain (example.com).
CNAME Record
Points to another domain name.

www.example.com → example.com → 104.21.5.10

Requires an extra resolution step. Cannot be used on root/apex domain by standard DNS rules.
💡 CNAME Flattening — A Cloudflare Feature

Standard DNS doesn't allow a CNAME on the root/apex domain (example.com) — only on subdomains. This is a problem for services like CDNs that require a CNAME. Cloudflare solves this with CNAME Flattening — internally resolving the CNAME chain and returning an A record at the root. This is unique to Cloudflare's DNS implementation and a real differentiator in customer conversations.


Module 6 · Topic 6.7

DNS in Cloudflare Context

How Customers Onboard to Cloudflare via DNS

When a customer signs up for Cloudflare, the first thing they do is point their domain's NS records to Cloudflare. This transfers authoritative control of their DNS to Cloudflare.

1
Customer adds domain to Cloudflare

Cloudflare scans existing DNS records and imports them automatically.

2
Customer updates NS records at registrar

At GoDaddy/Namecheap/Route53, customer changes nameservers to ns1.cloudflare.com and ns2.cloudflare.com.

3
DNS propagates (up to 48 hours)

The world's resolvers gradually learn that Cloudflare is now authoritative. After TTL expiry on old NS records, all queries go to Cloudflare.

4
Cloudflare controls DNS

All A/CNAME records are now managed in Cloudflare dashboard. Customer can proxy records through Cloudflare or leave them direct.

Orange Cloud vs Grey Cloud

In the Cloudflare dashboard, every DNS record has a cloud icon that controls whether traffic is proxied through Cloudflare or goes directly to the origin:

Orange Cloud vs Grey Cloud — The Most Important Toggle in Cloudflare
🟠 Orange Cloud (Proxied) Traffic routed through Cloudflare User → Cloudflare PoP → Origin ✅ WAF, DDoS, caching, bot mgmt ✅ Origin IP hidden from public ✅ SSL at edge ⚠️ Non-HTTP ports not proxied ⚠️ Email must be grey cloud ⚪ Grey Cloud (DNS Only) DNS resolves, traffic goes direct User → Origin (directly) ✅ Works with any port/protocol ✅ Required for email (MX, SMTP) ✅ SSH, FTP, custom protocols ❌ No WAF, DDoS, caching ❌ Origin IP exposed publicly

What Cloudflare's DNS Returns

When a record is orange cloud (proxied), Cloudflare's authoritative DNS does not return the origin's real IP — it returns Cloudflare's Anycast IP instead. The origin IP is never exposed to the public internet. This is a key security benefit — attackers can't bypass Cloudflare by finding and directly hitting the origin IP.

💡 Common Customer Mistake — Email on Orange Cloud

One of the most frequent support issues: a customer proxies their root domain (example.com) through Cloudflare and their email breaks. The reason: email uses SMTP on port 25, which Cloudflare's proxy doesn't handle. MX records and email-related DNS records must always be grey cloud. This is a gotcha you'll encounter on almost every onboarding conversation.


Module 6 · Topic 6.8

DNSSEC

The Problem DNSSEC Solves

Standard DNS has no authentication — a resolver has no way to verify that the answer it receives is genuine. An attacker who can intercept or tamper with DNS responses could redirect users to malicious servers — even though the domain name looks correct. This attack is called DNS spoofing or cache poisoning.

DNSSEC (DNS Security Extensions) adds cryptographic signatures to DNS records. Resolvers can verify these signatures to confirm the answer came from the legitimate authoritative server and hasn't been tampered with.

How DNSSEC Works

1
Zone signing

The domain owner signs all DNS records with a private key. Each record gets an RRSIG (Resource Record Signature) attached.

2
Public key published

The corresponding public key is published as a DNSKEY record in the zone. A hash of it (DS record) is published at the parent TLD — creating a chain of trust from root → TLD → authoritative.

3
Resolver verifies

A DNSSEC-validating resolver retrieves the record + RRSIG, fetches the DNSKEY, and cryptographically verifies the signature. If it doesn't match — the response is rejected as tampered.

Chain of Trust

DNSSEC Chain of Trust — Root to Authoritative
Root Zone Trust anchor Signed by ICANN Key hardcoded in resolvers DS record .com TLD Verified by root DS record cloudflare.com Authoritative — records signed Each level vouches for the next. Break the chain = DNSSEC validation fails.

DNSSEC Limitations

DNSSEC proves that a DNS answer is authentic — but it does not:

💡 Cloudflare & DNSSEC

Cloudflare supports DNSSEC for all authoritative DNS zones with one-click enablement in the dashboard. Cloudflare also validates DNSSEC on its 1.1.1.1 resolver — meaning queries resolved via 1.1.1.1 are protected against cache poisoning. About 30% of domains currently have DNSSEC enabled globally.


Module 6 · Topic 6.9

DNS over HTTPS & DNS over TLS

The Problem — Plain DNS is Unencrypted

Standard DNS queries travel in plaintext over UDP port 53. This means:

DNSSEC (Topic 6.8) prevents tampering but doesn't hide the query. DoH and DoT solve the privacy problem by encrypting the DNS query itself.

DoT — DNS over TLS

DNS queries wrapped in a TLS connection on port 853. Encrypts queries but uses a dedicated port — ISPs and firewalls can easily detect and block port 853, making it easy to enforce their own DNS.

DoH — DNS over HTTPS

DNS queries sent as HTTPS requests over port 443 — the same port as all other HTTPS web traffic. Completely indistinguishable from regular browser traffic. Much harder to block without breaking the entire HTTPS web.

PropertyStandard DNSDoTDoH
Port53 (UDP)853 (TCP)443 (TCP)
Encrypted?❌ No✅ Yes (TLS)✅ Yes (HTTPS)
Privacy❌ ISP sees all queries✅ Encrypted✅ Encrypted + hidden in HTTPS
Blockable?Easy — filter port 53Easy — filter port 853Very hard — would break all HTTPS
Supported byEverythingMobile OS, some browsersChrome, Firefox, Edge, iOS, Android
💡 Cloudflare 1.1.1.1 Supports Both

Cloudflare's 1.1.1.1 resolver supports both DoT (1.1.1.1:853) and DoH (https://cloudflare-dns.com/dns-query). This is also relevant to Cloudflare Gateway (the SWG product in Cloudflare One) — it intercepts DNS at the OS or browser level to enforce filtering policies, and uses DoH/DoT to do so securely.


Module 6 · Topic 6.10

DNS Attacks

Why DNS is a High-Value Attack Target

DNS is infrastructure — it underpins everything. Attacking DNS can redirect users, deny service, or intercept traffic at massive scale without ever touching the target's servers directly.

DNS Cache Poisoning

An attacker injects a false DNS record into a resolver's cache. Any user that resolver serves then gets the fake answer — redirecting them to a malicious server. Classic man-in-the-middle at the DNS layer.

Prevention: DNSSEC, randomised source ports and transaction IDs, filtering at the resolver level.

DNS Amplification DDoS

The most common UDP amplification attack. Attacker sends small DNS queries to open resolvers with the victim's IP spoofed as the source. Resolvers send large responses to the victim. Amplification factor up to 50x — a 1 Gbps attack becomes 50 Gbps.

Prevention: ISP-level BCP38 filtering (blocks spoofed source IPs), Cloudflare's network-level DDoS protection absorbs at the edge.

DNS Hijacking

Attacker compromises either the registrar account (changing NS records), the authoritative nameserver, or the resolver — redirecting all DNS queries for a domain to attacker-controlled servers. More targeted than cache poisoning — affects the entire domain, not just cached entries.

Prevention: Registrar lock (prevents unauthorised NS changes), multi-factor auth on registrar accounts, DNSSEC.

DNS Tunneling

Attacker encodes data inside DNS queries and responses to exfiltrate data or establish a covert command-and-control channel through firewalls that allow DNS traffic. DNS is often allowed through firewalls even when other protocols are blocked.

Prevention: Cloudflare Gateway inspects DNS query patterns and blocks anomalous tunneling behaviour.

DNS-based DDoS on Authoritative Servers

Flood of DNS queries targeting an authoritative nameserver — overwhelming it so it can't respond to legitimate queries. Effectively takes the domain offline for everyone.

Prevention: Cloudflare's authoritative DNS is Anycast — attack traffic is distributed across 330+ PoPs globally. No single server receives the full volume.

AttackWhat it doesCloudflare defence
Cache PoisoningInjects false DNS records into resolver cacheDNSSEC validation on 1.1.1.1
Amplification DDoSUses DNS to amplify traffic at victimL3/L4 DDoS protection, BCP38 advocacy
DNS HijackingRedirects entire domain at registrar/NS levelDNSSEC, registrar lock, 2FA guidance
DNS TunnelingExfiltrates data via DNS queriesGateway DNS filtering detects anomalous patterns
Auth NS DDoSOverwhelms authoritative nameserverAnycast distributes attack across all PoPs

Module 6 · Key Takeaways

Important to Remember

📖 6.1 — What is DNS
  • DNS translates human-readable domain names → machine-readable IP addresses
  • First step of every internet connection — if DNS fails, everything fails
  • Cloudflare has two DNS products: Authoritative DNS (for customer domains) and 1.1.1.1 (public recursive resolver)
🏷️ 6.2 — Domain Name Structure
  • Read right to left: blog.cloudflare.com = subdomain.SLD.TLD
  • TLD = .com, .org, .uk. SLD = registered name. Subdomain = prefix (www, api, mail)
  • Email records (MX) must always be grey cloud — email uses ports not proxied by Cloudflare
🌐 6.3 — DNS Hierarchy & Resolvers
  • Three levels: Root nameservers → TLD nameservers → Authoritative nameservers
  • Root servers: 13 sets, Anycast, managed by 13 organisations under ICANN
  • Resolver (1.1.1.1, 8.8.8.8) does the recursive lookup on your behalf
  • Cloudflare's 1.1.1.1 = fastest global resolver, privacy-first, Anycast
🔄 6.4 — DNS Resolution
  • Full lookup: Browser → OS cache → Resolver → Root → TLD → Authoritative → answer
  • Most queries answered from cache at resolver level — full lookup is rare in practice
  • Cache exists at browser, OS, and resolver levels
⏱️ 6.5 — DNS Caching & TTL
  • TTL = how long resolvers cache a DNS answer (in seconds)
  • Short TTL (300s) = changes propagate fast, more queries. Long TTL (86400s) = slow propagation, fewer queries
  • Before Cloudflare onboarding — lower TTL to 300s first. Raise after everything is stable.
  • "DNS propagation" = waiting for cached copies to expire globally
📋 6.6 — DNS Record Types
  • A → IPv4, AAAA → IPv6, CNAME → alias to another domain
  • MX → mail server, TXT → verification/SPF/DMARC, NS → nameservers
  • CNAME cannot be used on root/apex domain — Cloudflare solves this with CNAME Flattening
☁️ 6.7 — DNS in Cloudflare Context
  • Onboarding = customer points NS records to Cloudflare
  • Orange cloud = proxied through Cloudflare (WAF, DDoS, cache on). Origin IP hidden.
  • Grey cloud = DNS only, traffic goes direct. Required for email.
  • Proxied records return Cloudflare's Anycast IP — origin never exposed
🔐 6.8 — DNSSEC
  • Adds cryptographic signatures to DNS records — proves answer is genuine, not tampered
  • Chain of trust: Root → TLD → Authoritative, each level signed
  • Does NOT encrypt queries (that's DoH/DoT) — only prevents spoofing/tampering
  • Cloudflare supports one-click DNSSEC on all zones. 1.1.1.1 validates DNSSEC.
🔒 6.9 — DoH & DoT
  • Standard DNS = plaintext on port 53 — ISP can see every query
  • DoT = DNS over TLS on port 853. Encrypted but detectable and blockable.
  • DoH = DNS over HTTPS on port 443. Encrypted and hidden in normal HTTPS traffic.
  • Cloudflare 1.1.1.1 supports both. Gateway uses DoH/DoT for DNS filtering.
⚠️ 6.10 — DNS Attacks
  • Cache poisoning — fake records in resolver cache. DNSSEC prevents.
  • Amplification DDoS — UDP spoofing for 50x traffic amplification. Cloudflare L3/L4 protection absorbs.
  • DNS hijacking — NS records changed at registrar. Registrar lock + MFA + DNSSEC prevent.
  • DNS tunneling — data exfiltration via DNS. Gateway detects anomalous patterns.
  • Auth NS DDoS — overwhelm authoritative server. Cloudflare's Anycast distributes attack across 330+ PoPs.
Module 7 of 10

HTTP & The Web

The language browsers and servers use to communicate — the foundation of every web application, API, and Cloudflare security product.

Module 7 · Topic 7.1

What is HTTP? & URLs

What is HTTP?

HTTP (HyperText Transfer Protocol) is the protocol that browsers and servers use to exchange web content. It defines how a client requests a resource and how a server responds. Every webpage, API call, and file download you've ever made on the web used HTTP.

HTTP sits at Layer 7 (Application) of the OSI model — the very top. It doesn't care about how packets are routed or whether TCP or UDP delivers them — it just defines the format of requests and responses.

HTTP is Stateless

One of the most important properties of HTTP: every request is independent. The server has no memory of previous requests from the same client. Each request must contain all the information the server needs to respond.

This means if you load a webpage that has 50 images — that's 51 separate HTTP requests (1 for the HTML + 50 for images). The server treats each one independently, with no knowledge of the others.

This simplicity is why HTTP scaled to power the entire internet — but it also creates challenges for things like login sessions (solved by cookies, covered in 7.7).

HTTP vs HTTPS

HTTP
Plain text — unencrypted.
Port 80
Anyone on the network can read the request and response.

❌ Not safe for sensitive data
HTTPS
HTTP wrapped in TLS — encrypted.
Port 443
Encrypted end-to-end. The padlock icon in your browser.

✅ Required for any sensitive data

HTTPS is HTTP + TLS. The HTTP request/response format is identical — TLS just encrypts it in transit. We'll go deep on TLS in Module 8.

💡 Cloudflare Terminates TLS at the Edge

When a user visits an HTTPS site protected by Cloudflare, the TLS connection terminates at Cloudflare's PoP — not at the origin server. Cloudflare decrypts the request, inspects it (WAF, Bot Management, etc.), then re-encrypts it to forward to the origin. The user's browser shows a padlock, but the TLS certificate they see belongs to Cloudflare, not the origin. This is called TLS termination at the edge — and it's what enables every L7 security product.

Anatomy of a URL

Every web resource is identified by a URL (Uniform Resource Locator). URLs have a precise structure — each part serves a specific purpose:

URL Anatomy — https://blog.cloudflare.com/path/to/page?q=dns#section
https://blog.cloudflare.com/path/to/page?q=dns#section https Scheme http/https blog Subdomain optional cloudflare.com Domain via DNS /path/to/page Path resource ?q=dns Query String key=value #section Fragment browser-only Fragment (#) never reaches the server — browser use only
URL PartExamplePurpose
Schemehttps://Which protocol to use
Subdomainblog.Optional prefix — specific section of the site
Domaincloudflare.comThe registered domain — resolved via DNS
Port:443Usually omitted — browser assumes 80 for HTTP, 443 for HTTPS
Path/path/to/pageWhich resource on the server to fetch
Query string?q=dns&page=2Additional parameters. Multiple pairs with &
Fragment#sectionBrowser-side anchor. Never sent to the server.
💡 WAF Rules Use URL Parts

Cloudflare WAF rules can match on any part of a URL — path, query string, or even specific query parameters. For example: "block any request where the query string contains SELECT" (SQL injection detection). Understanding URL anatomy means you'll immediately understand what a WAF rule is targeting when you see it in the dashboard.


Module 7 · Topic 7.2

HTTP Methods

What are HTTP Methods?

An HTTP method (also called an HTTP verb) tells the server what action to perform on the requested resource. When your browser loads a page, it sends a GET request. When you submit a form, it sends a POST. When an API updates an existing record, it uses PUT (full replace) or PATCH (partial update).

Methods are fundamental to how web applications work — and they're used extensively in WAF rules, API security, and rate limiting.

The Core Methods

MethodActionHas Request Body?Typical Use
GETRetrieve a resourceNoLoading a webpage, fetching API data
POSTSubmit data to create somethingYesSubmitting a form, creating a new record via API
PUTReplace a resource entirelyYesUpdate a user profile — replaces all fields
PATCHPartially update a resourceYesUpdate just one field (e.g. change email only)
DELETEDelete a resourceSometimesDelete a record via API
HEADSame as GET but returns only headersNoCheck if a resource exists / get metadata without downloading body
OPTIONSAsk server what methods are supportedNoCORS preflight checks (browser sends this before cross-origin requests)

Safe vs Unsafe vs Idempotent

Methods have two important properties that affect how they're treated by caches, proxies, and security tools:

Safe Methods
Don't modify data. Read-only.

GET, HEAD, OPTIONS

Caches can store responses. Safe to retry automatically.
Idempotent Methods
Calling multiple times = same result as calling once.

GET, PUT, DELETE, HEAD, OPTIONS

Safe to retry if request fails — outcome is the same.
Non-Idempotent Methods
Each call may have a different effect.

POST, PATCH

Submitting a payment form twice = charged twice. Don't retry blindly.

Real Example — A Single Web Page Uses Multiple Methods

When you use a web app like a task manager:

HTTP Methods in Action — Task Management App
GET /tasks → Load the list of tasks POST /tasks → Create a new task (body contains task data) PATCH /tasks/42 → Mark task #42 as complete PUT /tasks/42 → Replace task #42 entirely with new data DELETE /tasks/42 → Delete task #42 OPTIONS /tasks → Preflight check before cross-origin request — required for CORS

Same URL, different methods = completely different operations

💡 Methods in Cloudflare WAF Rules

HTTP methods are a first-class field in Cloudflare WAF rules. Common use cases:

  • Block all DELETE requests to an API that shouldn't allow deletion from external sources
  • Rate limit POST requests to a login endpoint to prevent brute force attacks
  • Allow only GET and POST to a specific path and block everything else
  • Flag OPTIONS requests as potential CORS probing from unexpected origins

Module 7 · Topic 7.3

HTTP Request & Response Structure

The HTTP Request

When your browser wants a resource, it sends an HTTP request. Every HTTP request has the same structure: a request line, headers, an empty line, and an optional body.

HTTP Request Structure — GET Request to cloudflare.com
GET /blog HTTP/1.1 ← Request Line Host: cloudflare.com ← Headers User-Agent: Mozilla/5.0 (Mac; Intel Mac OS X 10_15_7) Accept: text/html,application/xhtml+xml Accept-Language: en-US,en;q=0.9 Accept-Encoding: gzip, deflate, br Connection: keep-alive ← Blank line (required) [No body — GET requests have no body]

The Request Line

The first line of every request has three parts: Method + Path + HTTP Version

Request Line — Three Parts
GET /blog HTTP/1.1 Method GET, POST, PUT, DELETE... Path resource location on server HTTP Version 1.1, 2, or 3

The HTTP Response

The server's reply follows the same structure: a status line, headers, and a body containing the actual content.

HTTP Response Structure — Server's Reply
HTTP/1.1 200 OK ← Status Line Content-Type: text/html; charset=UTF-8 ← Headers Content-Length: 24820 Cache-Control: max-age=3600 cf-ray: 7a1b2c3d-DFW server: cloudflare ← Body <!DOCTYPE html> <html lang="en"> <head>...</head><body>...actual webpage content...</body>

The Status Line

The first line of every response has: HTTP Version + Status Code + Reason Phrase

Status Line — Three Parts
HTTP/1.1 200 OK HTTP Version 1.1, 2, or 3 Status Code 200, 404, 500... Reason Phrase e.g. OK, Not Found, Forbidden

Request vs Response — Key Differences

PropertyRequestResponse
First lineMethod + Path + VersionVersion + Status Code + Reason
Sent byClient (browser)Server
BodyOptional (POST/PUT have bodies, GET does not)Usually present (HTML, JSON, image, etc.)
HeadersDescribe the request (what browser accepts, auth tokens, etc.)Describe the response (content type, cache rules, CF metadata)
💡 The cf-ray Header — Your First Cloudflare Debugging Tool

Every HTTP response proxied through Cloudflare contains a cf-ray header — a unique identifier for that specific request. For example: cf-ray: 7a1b2c3d-DFW. The suffix (DFW) tells you which Cloudflare PoP handled the request (Dallas Fort Worth in this case). When a customer reports an issue, the first thing to ask for is the cf-ray value — Cloudflare support can use it to pull the exact logs for that request.


Module 7 · Topic 7.4

HTTP Status Codes

What are Status Codes?

Every HTTP response includes a 3-digit status code that tells the client what happened with their request. Status codes are grouped into 5 classes based on the first digit:

HTTP Status Code Classes — What Each Range Means
1xx Informational in progress 2xx Success worked ✓ 3xx Redirection go elsewhere 4xx Client Error your fault 5xx Server Error server's fault

The Codes You Must Know

CodeNameMeaningCommon cause
200OKRequest succeeded. Response contains the requested content.Normal successful response
201CreatedResource successfully created.Successful POST to an API
204No ContentSuccess but no body to return.Successful DELETE
301Moved PermanentlyResource has permanently moved to a new URL. Browser should update bookmarks.HTTP → HTTPS redirect, domain change
302Found (Temporary Redirect)Resource temporarily at a different URL.Login redirects, A/B testing
304Not ModifiedCached version is still fresh — use it.Browser has cached content that hasn't changed
400Bad RequestServer can't understand the request — malformed syntax.Invalid JSON body, missing required field
401UnauthorizedAuthentication required. Not authenticated.Missing or invalid token/session
403ForbiddenAuthenticated but not permitted to access this resource.Cloudflare WAF block, IP block, Access denied
404Not FoundResource doesn't exist at this URL.Wrong URL, deleted page
429Too Many RequestsRate limit exceeded.Cloudflare Rate Limiting triggered
500Internal Server ErrorGeneric server-side error.Bug in application code, unhandled exception
502Bad GatewayProxy received an invalid response from the upstream server.Origin server crashed, returned garbage
503Service UnavailableServer temporarily unable to handle requests.Origin overloaded, maintenance mode
504Gateway TimeoutProxy timed out waiting for upstream server.Origin too slow to respond within timeout window
520–527Cloudflare-specific errorsCloudflare's own error codes for specific failure modes.Origin unreachable, SSL mismatch, Cloudflare-side issues

Cloudflare-Specific Status Codes

Cloudflare has its own set of error codes in the 5xx range that you'll encounter constantly in support conversations:

CodeMeaningWhere the problem is
520Unknown error from originOrigin returned an unexpected response
521Origin web server is downOrigin refused the connection
522Connection timed outOrigin didn't respond within 15 seconds
523Origin is unreachableCloudflare can't route to origin IP
524A timeout occurredOrigin connected but didn't respond in time
525SSL handshake failedTLS negotiation failed between Cloudflare and origin
526Invalid SSL certificateOrigin's certificate is invalid or self-signed without Cloudflare configured for it
💡 401 vs 403 — The Distinction That Matters

401 Unauthorized = "I don't know who you are — please log in." The word "unauthorized" is technically misleading — it really means unauthenticated.

403 Forbidden = "I know who you are, but you're not allowed here." This is what Cloudflare returns when a WAF rule blocks a request, when an IP is blocked, or when Cloudflare Access denies access. When a customer says "users are getting 403s," it almost always means something in Cloudflare is blocking them — not an origin issue.

💡 5xx Errors — Origin or Cloudflare?

When a customer reports 5xx errors, the first question is: is this Cloudflare or the origin?

  • 502/503/504 — usually origin issue (Cloudflare successfully reached the origin but origin is misbehaving)
  • 520–527 — Cloudflare-specific. Look at the specific code to diagnose (521 = origin down, 525/526 = SSL issue)
  • Check the cf-ray header to confirm Cloudflare is in the path. If there's no cf-ray, Cloudflare isn't involved.

Module 7 · Topic 7.5

HTTP Headers

What are HTTP Headers?

Headers are key-value metadata attached to every HTTP request and response. They tell the server and client important context about the communication — what format the content is in, how to cache it, who is making the request, what authentication is being used, and much more.

Headers are invisible to end users but are the primary thing Cloudflare's WAF, Bot Management, and other products inspect to make security decisions.

Request Headers — What the Client Sends

HeaderExample ValueWhat it tells the server
Hostcloudflare.comWhich domain is being requested (required in HTTP/1.1). Critical — allows one server to host multiple domains.
User-AgentMozilla/5.0 (Mac; Intel...)What browser/app is making the request. Bots often have distinctive or fake User-Agent strings.
Accepttext/html, application/jsonWhat content types the client can handle.
Accept-Encodinggzip, deflate, brWhat compression formats the client supports. Brotli (br) is the most efficient.
AuthorizationBearer eyJhbGciO...Authentication credentials — API tokens, JWT tokens, Basic auth.
Cookiesession=abc123; theme=darkSends stored cookies back to the server. How sessions are maintained.
Refererhttps://google.com/search?q=...Which page the user came from. Used for analytics and hotlink protection.
X-Forwarded-For203.0.113.5, 10.0.0.1Original client IP when request passes through a proxy. Cloudflare adds this when forwarding to origin.
CF-Connecting-IP203.0.113.5Cloudflare-specific header — the real visitor IP. More reliable than X-Forwarded-For.
Content-Typeapplication/jsonFormat of the request body (for POST/PUT requests).

Response Headers — What the Server Sends Back

HeaderExample ValueWhat it tells the client
Content-Typetext/html; charset=UTF-8Format of the response body — HTML, JSON, image, etc.
Content-Length24820Size of the response body in bytes.
Cache-Controlmax-age=3600, publicHow the response should be cached. Critical for CDN behaviour. Covered deeply in 7.9.
Set-Cookiesession=abc123; HttpOnly; SecureTells browser to store a cookie. HttpOnly = JS can't access it. Secure = HTTPS only.
Locationhttps://www.example.com/Where to redirect (used with 301/302 responses).
ETag"abc123def456"Unique identifier for this version of the resource. Used for cache validation.
Strict-Transport-Securitymax-age=31536000HSTS — forces HTTPS for this domain for 1 year. Covered in 7.11.
cf-ray7a1b2c3d-DFWCloudflare request ID + PoP. First thing to check when debugging.
cf-cache-statusHIT / MISS / BYPASSWhether Cloudflare served from cache or fetched from origin.
servercloudflareIdentifies Cloudflare as the server. Origin server header is hidden from the public.

Custom Headers

Beyond standard headers, applications and platforms define their own. Convention: custom headers are prefixed with X- (though this is no longer required by spec):

Custom HeaderExample ValuePurpose
X-Request-ID7a8b9c-abc123Unique ID for tracking this specific request through systems
X-RateLimit-Remaining47How many requests the client has left in the current rate limit window
X-Content-Type-OptionsnosniffSecurity header — prevents MIME-type sniffing by the browser
CF-Connecting-IP203.0.113.5Cloudflare-added header — real visitor IP before NAT/proxy
💡 Headers are the Primary WAF Inspection Target

Cloudflare WAF rules can match on any header in a request. The most commonly used in rules:

  • User-Agent — block known malicious bots, allow known good bots (Googlebot)
  • Referer — hotlink protection, block requests from suspicious referring domains
  • Authorization — detect credential stuffing patterns, enforce API key format
  • CF-Connecting-IP — block or rate limit by visitor IP (use this over X-Forwarded-For)
  • Host — rules targeting specific subdomains vs. the root domain

Module 7 · Topic 7.6

HTTP/1.1 → HTTP/2 → HTTP/3 & QUIC

The Evolution Problem

HTTP was designed in 1991 for a simple web of text documents. Modern websites load 50–200 resources (HTML, CSS, JS, images, fonts, API calls). Each version of HTTP was created to solve the performance bottlenecks of the previous one.

HTTP/1.1 — One Request at a Time

HTTP/1.1 (1997) was a major improvement over HTTP/1.0 — it introduced persistent connections (keep the TCP connection open for multiple requests instead of reopening it every time). But it had one critical flaw:

Head-of-Line Blocking: Within a single connection, requests must complete in order. If request #1 is slow, requests #2, #3, #4 all wait — even if the server is ready to serve them. The solution was to open multiple TCP connections (browsers open 6 per domain), but this is wasteful and still limited.

HTTP/1.1 vs HTTP/2 — Sequential vs Multiplexed Requests
HTTP/1.1 — Sequential Request 1 Request 2 Request 3 → waits for 1 and 2... One connection — requests queue up sequentially HTTP/2 — Multiplexed Single TCP connection Stream 1 Stream 2 (longer) Stream 3 All streams flow simultaneously — no waiting HTTP/3 — QUIC (UDP) Built on UDP — no TCP handshake TLS 1.3 built in — 0-RTT possible ✅ Multiplexing (like HTTP/2) ✅ No TCP head-of-line blocking ✅ Connection migration (change WiFi → 4G) ✅ Faster handshake (1-RTT or 0-RTT) Used by ~30% of internet traffic today

HTTP/2 — Multiplexing Over One Connection

HTTP/2 (2015) solved head-of-line blocking at the HTTP layer by introducing multiplexing — multiple requests and responses flow simultaneously over a single TCP connection as independent streams. No waiting in line.

HTTP/2 also introduced header compression (HPACK) — repeated headers (like User-Agent or Host) are sent once and referenced by index on subsequent requests, dramatically reducing overhead.

HTTP/3 & QUIC — Solving the Final Bottleneck

HTTP/2 multiplexed at the HTTP layer but still used TCP underneath. TCP itself has head-of-line blocking — if one TCP packet is lost, all streams wait for it to be retransmitted, even those that don't need that data.

QUIC is a new transport protocol built on UDP that reimplements TCP's reliability (retransmission, ordering) in userspace, with independent stream handling — a lost packet only blocks the stream it belongs to, not others. HTTP/3 runs on top of QUIC.

PropertyHTTP/1.1HTTP/2HTTP/3
TransportTCPTCPQUIC (UDP)
Multiplexing
Head-of-line blockingHTTP + TCPTCP only❌ None
TLSOptionalEffectively requiredBuilt-in (mandatory)
Header compression✅ HPACK✅ QPACK
Connection setupTCP 3-way + TLSTCP 3-way + TLS1-RTT (or 0-RTT for returning)
Connection migration✅ (WiFi → 4G seamlessly)
💡 Cloudflare & HTTP/3

Cloudflare was one of the first CDNs to support HTTP/3 and QUIC — enabled by default for all proxied zones. The 0-RTT feature means returning visitors skip the handshake entirely, reducing connection overhead. Cloudflare also supported QUIC before it was an IETF standard, influencing the protocol's development. When you're selling Cloudflare performance, HTTP/3 support is a real differentiator vs. older CDNs or origin-only architectures.


Module 7 · Topic 7.7

Cookies

Why Cookies Exist

HTTP is stateless — the server doesn't remember anything between requests. But real web applications need state: you log in once and stay logged in, your shopping cart persists across pages, your language preference is remembered.

Cookies are small pieces of data that a server asks the browser to store and send back with every subsequent request. They're how the web maintains state on top of a stateless protocol.

How Cookies Work

1
Server sets a cookie

Server response includes: Set-Cookie: session=abc123; HttpOnly; Secure; SameSite=Strict

2
Browser stores it

Browser saves the cookie locally, associated with the domain.

3
Browser sends it back automatically

Every subsequent request to that domain includes: Cookie: session=abc123

4
Server reads it

Server reads the session ID, looks it up in its database, and knows who this user is.

Cookie Attributes — Security Controls

AttributeWhat it doesWhy it matters
HttpOnlyJavaScript cannot access this cookiePrevents XSS attacks from stealing session cookies via document.cookie
SecureCookie only sent over HTTPSPrevents session hijacking on HTTP connections
SameSite=StrictCookie only sent for same-site requestsPrevents CSRF attacks — cookie won't be sent if request originates from another site
SameSite=LaxSent for same-site + top-level navigationBalances security and usability. Default in modern browsers.
SameSite=NoneSent for all requests including cross-siteRequired for third-party cookies (tracking, embeds). Must also have Secure.
Expires / Max-AgeWhen the cookie expiresSession cookies (no expiry) = deleted when browser closes. Persistent = survives browser restart.
DomainWhich domains receive the cookiee.g. Domain=.cloudflare.com — sent to all subdomains
PathWhich URL paths receive the cookiee.g. Path=/api — only sent with /api requests
💡 Cookies in Cloudflare Context

Cookies are critical in Cloudflare for two reasons:

  • Caching — by default, Cloudflare bypasses the cache for requests that contain cookies (because they likely indicate personalised/logged-in content that shouldn't be cached globally). Understanding this is essential when configuring cache rules.
  • Bot detection — Cloudflare's Bot Management uses cookies as one signal to verify that a client is a real browser (real browsers handle Set-Cookie correctly; simple bots often don't).

Module 7 · Topic 7.8

Sessions & Authentication

Sessions — Maintaining State Across Requests

A session is the server's way of tracking a user across multiple HTTP requests. Since HTTP is stateless, the server needs a mechanism to say "this request belongs to the same user as the last one."

The classic approach: the server assigns a random session ID, stores it with the user's data, and sends it to the browser as a cookie. The browser sends it back with every request, and the server looks it up.

Session-Based Authentication Flow
Browser your app Server + session store POST /login {user, password} creates session_id=xyz789 200 OK + Set-Cookie: sid=xyz789 GET /dashboard Cookie: sid=xyz789 looks up xyz789 → user is Alice 200 OK — Alice's dashboard

JWT — Token-Based Authentication

Modern APIs and Single Page Apps often use JWT (JSON Web Token) instead of session cookies. A JWT is a self-contained token that encodes the user's identity and claims — the server doesn't need to look it up in a database because the token itself contains the information, signed with a secret key.

JWT Structure — 3 Parts Separated by Dots
Part 1 — Header eyJhbGciOiJIUzI1NiJ9 Algorithm used {"alg": "HS256"} . Part 2 — Payload eyJ1c2VyIjoiYWxpY2UiLCJyb2xlIjoiYWRtaW4ifQ User data — readable by anyone {"user":"alice","role":"admin","exp":1234567890} . Part 3 — Signature SflKxwRJSMeKKF2Q... Server verifies this Signed with server's secret key ⚠️ Part 2 is NOT encrypted Anyone can decode and read the payload ✅ Part 3 proves authenticity Only the server with the secret key can create it Sent as: Authorization: Bearer eyJhbGci...SflKxw Server verifies signature → trusts payload → no database lookup needed

JWT is sent in the Authorization header: Authorization: Bearer <token>. The server verifies the signature — if it checks out, the token is genuine.

Session vs JWT — Key Differences

PropertySession CookieJWT
Where state livesServer (session store/database)Client (inside the token itself)
Server lookup needed?Yes — look up session ID every requestNo — verify signature, read payload directly
RevocationEasy — delete session from serverHard — can't invalidate a valid token before expiry
Scales well?Harder (need shared session store)Yes — any server can verify without DB lookup
Used forTraditional web appsAPIs, microservices, SPAs
💡 Cloudflare Access Uses JWT

Cloudflare Access (ZTNA product) issues a JWT to authenticated users. Every request to an Access-protected application carries this token. Cloudflare validates it at the edge — if the token is valid, the request is forwarded to the origin; if not, the user is redirected to authenticate. The origin doesn't need to implement its own authentication — Access handles it entirely. This JWT mechanism is a core part of the Zero Trust story.


Module 7 · Topic 7.9

Caching

What is HTTP Caching?

Caching stores a copy of a response so it can be served again without going back to the origin. Every layer of the web can cache — the browser, a CDN, a reverse proxy. The goal: serve content faster with less load on the origin.

Caching is controlled by HTTP headers — specifically Cache-Control. Understanding these headers is fundamental to Cloudflare CDN configuration.

Cache-Control — The Primary Caching Header

The server sets Cache-Control in the response to tell downstream caches (browsers, CDNs) what to do with the response.

DirectiveExampleMeaning
max-agemax-age=3600Cache for 3600 seconds (1 hour). Relative to time of response.
s-maxages-maxage=86400Cache for 86400 seconds — but only applies to shared caches (CDNs). Overrides max-age for CDNs.
publicCache-Control: publicAny cache (browser, CDN) may store this. Safe for shared caching.
privateCache-Control: privateOnly the browser can cache. CDN must not store (personalised content).
no-storeCache-Control: no-storeNever cache under any circumstances. For sensitive data.
no-cacheCache-Control: no-cacheMisleading name — can cache, but must revalidate with origin before serving. Always ask if still fresh.
must-revalidateCache-Control: must-revalidateOnce stale, must check with origin — cannot serve stale content even if origin is unreachable.
stale-while-revalidatestale-while-revalidate=60Serve stale for up to 60s while fetching fresh in background. Great for performance.

Cache Validation — ETag and Last-Modified

When a cached response expires, the cache doesn't have to discard it immediately. It can revalidate — ask the origin "has this changed?" If not, the origin responds with 304 Not Modified (no body), saving bandwidth.

ETag
Server returns: ETag: "abc123"

Cache asks: If-None-Match: "abc123"

If unchanged → 304 Not Modified
If changed → 200 OK with new content
Last-Modified
Server returns: Last-Modified: Wed, 6 Aug 2026 10:00:00 GMT

Cache asks: If-Modified-Since: Wed, 6 Aug...

If unchanged → 304
If changed → 200 with new content

What Cloudflare Caches — The cf-cache-status Header

Every response from Cloudflare includes a cf-cache-status header telling you exactly what the cache did:

ValueMeaning
HITServed from Cloudflare cache — origin not contacted
MISSNot in cache — fetched from origin, now cached for future requests
EXPIREDWas cached but TTL expired — fetched fresh from origin
BYPASSCache bypassed — usually because request had cookies or Cache-Control: no-store
DYNAMICContent is dynamic (e.g. API response) — Cloudflare determined it shouldn't be cached
REVALIDATEDCache revalidated with origin — returned 304 Not Modified, served from cache

What Cloudflare Caches by Default

Cloudflare caches based on file extension by default. Static assets are cached; dynamic content is not:

✅ Cached by Default
Images (.jpg, .png, .gif, .svg, .webp)
CSS (.css)
JavaScript (.js)
Fonts (.woff, .woff2, .ttf)
PDFs, videos, zip files
❌ Not Cached by Default
HTML pages (.html)
API responses (application/json)
Requests with cookies
POST requests
Responses with Cache-Control: no-store
💡 Cache Rules — Overriding Default Behaviour

Cloudflare's default caching is conservative. Customers use Cache Rules (previously Page Rules) to override behaviour for specific paths:

  • Cache HTML for a blog (static content even though it's .html)
  • Bypass cache for /api/* endpoints that must always be fresh
  • Set custom TTL for specific file types
  • Cache everything (even with cookies) for a specific path

This is one of the most common configuration tasks you'll do with customers during onboarding.


Module 7 · Topic 7.10

CORS — Cross-Origin Resource Sharing

The Same-Origin Policy

Browsers enforce a security rule called the Same-Origin Policy: a webpage can only make requests to the same origin it was loaded from. An origin is defined as the combination of scheme + domain + port.

Same Origin vs Cross Origin
✅ Same Origin From: https://app.cloudflare.com → https://app.cloudflare.com/api ✓ same scheme+domain+port → https://app.cloudflare.com:443/data ✓ same origin ❌ Cross Origin From: https://app.cloudflare.com → https://api.cloudflare.com ✗ different subdomain → http://app.cloudflare.com ✗ different scheme → https://cloudflare.com:8080 ✗ different port

Why CORS Exists

Modern web apps frequently need to call APIs on different origins — a frontend at app.example.com calling an API at api.example.com, or a single-page app calling a third-party payment API. The Same-Origin Policy would block all of these by default.

CORS is the mechanism that lets servers explicitly permit cross-origin requests. It's enforced by the browser — not the server.

The CORS Preflight Flow

For certain requests, the browser sends a preflight request first — an OPTIONS request asking "am I allowed to do this?" Preflight is triggered by:

Simple requests that do not trigger preflight: GET, HEAD, and form-based POST with standard content types.

CORS Preflight — Browser Asks Permission First, Then Makes Real Request
💻 Browser app.example.com 🖥️ API Server api.example.com ① OPTIONS /data (Preflight Request) Access-Control-Request-Method: PUT Browser asks: am I allowed to make a PUT request from app.example.com? ② 204 No Content (Preflight Response) Access-Control-Allow-Origin: https://app.example.com Server says: yes, PUT from app.example.com is allowed ✓ Browser checks ✓ allowed ③ PUT /data (Actual Request) Authorization: Bearer token123 ④ 200 OK + data Preflight is cached by browser — subsequent requests skip steps ① and ②

Key CORS Response Headers

HeaderExampleMeaning
Access-Control-Allow-Originhttps://app.example.com or *Which origins are allowed. * = any origin (open API). Cannot be * if credentials are included.
Access-Control-Allow-MethodsGET, POST, PUT, DELETEWhich HTTP methods are permitted cross-origin.
Access-Control-Allow-HeadersAuthorization, Content-TypeWhich request headers are allowed in the actual request.
Access-Control-Max-Age86400How long the browser can cache this preflight response (seconds). Reduces preflight overhead.
Access-Control-Allow-CredentialstrueWhether cookies/auth headers can be sent cross-origin. Requires specific origin (not *).
💡 CORS & Cloudflare WAF

A common customer issue: Cloudflare WAF blocks the OPTIONS preflight request (e.g. a WAF rule matching on certain headers fires on preflight). The frontend then shows a CORS error — which looks like a browser/origin issue but is actually Cloudflare blocking the OPTIONS request. The fix: create a WAF rule to skip checks for OPTIONS requests from trusted origins, or use Cloudflare's Transform Rules to add CORS headers. This comes up frequently in API security conversations.


Module 7 · Topic 7.11

Security Headers

What are Security Headers?

Security headers are HTTP response headers that instruct the browser to enforce specific security behaviours — restricting what content can load, preventing clickjacking, enforcing HTTPS, and more. They're a critical defence-in-depth layer for any web application.

Cloudflare can inject these automatically on behalf of customers without touching their origin — via Transform Rules and the Managed Headers feature.

The Key Security Headers

HeaderExample ValueWhat it does
Strict-Transport-Security (HSTS)max-age=31536000; includeSubDomains; preloadForces HTTPS for this domain for the specified duration. Browser will refuse to connect over HTTP. Prevents protocol downgrade attacks.
Content-Security-Policy (CSP)default-src 'self'; script-src 'self' cdn.example.comDefines which sources are allowed for scripts, styles, images, etc. Prevents XSS by blocking inline scripts and untrusted sources.
X-Frame-OptionsDENY or SAMEORIGINPrevents the page from being embedded in an iframe. Defends against clickjacking attacks where a malicious page overlays a transparent iframe.
X-Content-Type-OptionsnosniffPrevents the browser from MIME-sniffing (guessing content type). Forces browser to use declared Content-Type. Stops some XSS vectors.
Referrer-Policystrict-origin-when-cross-originControls how much Referer header information is sent with requests. Protects sensitive URL parameters from leaking to third parties.
Permissions-Policycamera=(), microphone=(), geolocation=()Controls which browser features the page can use (camera, mic, GPS). Limits attack surface if page is compromised.

HSTS in Detail — The Most Important Security Header

HSTS (HTTP Strict Transport Security) tells the browser: "For the next year, never connect to this domain over HTTP — always use HTTPS, even if the user types http://"

Without HSTS vs With HSTS — Preventing Protocol Downgrade
❌ Without HSTS Browser http:// 🕵️ Attacker reads traffic! User types http:// → unencrypted Attacker intercepts plaintext ✅ With HSTS Browser https:// Server Browser refuses HTTP entirely Upgrades to HTTPS automatically preload = domain hardcoded in browser as HTTPS-only (submitted to HSTS Preload List) Cloudflare enables HSTS with one toggle in SSL/TLS settings — no code changes needed
💡 Cloudflare Managed Headers

Cloudflare can inject security headers at the edge without the customer changing their origin code — using the Managed Headers feature in Transform Rules. Enables HSTS, X-Content-Type-Options, X-Frame-Options, and Referrer-Policy with one click. This is a common onboarding win — customers get immediate security improvement with zero origin changes.


Module 7 · Topic 7.12

WebSockets

WebSockets — Persistent Two-Way Communication

Standard HTTP is request-response: client asks, server answers, connection closes (or is reused for the next request). This doesn't work for real-time applications where the server needs to push data to the client at any time — live chat, trading dashboards, collaborative editing, gaming.

WebSockets solve this by upgrading an HTTP connection into a persistent, full-duplex channel where both sides can send messages at any time.

HTTP Limitation 1 — New request needed for updates
In HTTP, the server can only respond — it can never volunteer information. If you want fresh data (new messages, live scores, stock prices), your browser must keep asking over and over. This is called polling — wasteful and slow.
HTTP Limitation 2 — Server can't push unsolicited data
"Unsolicited" means data the client didn't ask for. A live chat server knows the moment a message arrives — but with HTTP it cannot tell your browser. Your browser has to ask first. WebSocket eliminates this entirely — the server pushes the moment it has something to say.
💡 HTTP 101 — How WebSocket Starts

WebSocket doesn't have its own connection mechanism — it piggybacks on HTTP to start. The browser sends a normal HTTP request with an Upgrade: websocket header. The server responds with HTTP 101 Switching Protocols — meaning "Agreed. We're switching from HTTP to WebSocket now." After this, HTTP is done. The same TCP connection becomes a persistent WebSocket channel.

Think of it like two people mid-conversation agreeing to switch languages: "Let's speak French from now on" → "Agreed." — and from that point everything is in French. The 101 response is that agreement moment.

HTTP vs WebSocket — Request-Response vs Persistent Channel
HTTP (Request-Response) Client Server request response Connection closes New request needed to get updates Server can't push unsolicited data WebSocket (Full-Duplex) Client Server persistent connection Both sides send anytime — no polling

WebSocket Handshake

WebSocket starts as an HTTP request with an Upgrade header — asking the server to switch protocols:

WebSocket Handshake — HTTP Upgrade Request & Response
REQUEST (Browser → Server) GET /chat HTTP/1.1 Host: chat.example.com Upgrade: websocket Connection: Upgrade RESPONSE (Server → Browser) HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept: s3pP... ✅ Connection upgraded — now a WebSocket, not HTTP Status 101 = Switching Protocols · Full-duplex open · Both sides can send anytime
💡 Cloudflare Proxies WebSockets

Cloudflare proxies WebSocket connections transparently on orange-cloud domains. The upgrade handshake passes through Cloudflare's edge and the persistent connection is maintained. Cloudflare's Durable Objects (developer platform) are specifically designed for stateful WebSocket applications — e.g. real-time collaborative tools running at Cloudflare's edge.


Module 7 · Topic 7.13

APIs & REST

An API (Application Programming Interface) is a defined way for two pieces of software to communicate with each other. It's a contract — one side says "here's what requests I accept and what I'll return", the other side follows that contract to get data or trigger actions.

Think of it like a restaurant menu. The menu defines what you can order (the API). You don't need to know how the kitchen works — you just place your order (make a request) and get your food (response). The kitchen and you never directly interact; the menu (API) is the interface between you.

Real Example
When you open a weather app on your phone, the app doesn't store weather data. It calls a weather API: sends a request with your location, gets back temperature/humidity/forecast as a response. The app and weather service never share code — they just agree on the API format.
Web APIs
Web APIs communicate over HTTP/HTTPS — the same protocol your browser uses for websites. Instead of returning HTML (for humans to read), they return structured data like JSON (for applications to process).
Why APIs Matter for Cloudflare
APIs carry the most sensitive data — user records, payments, PII. They're a major attack surface. Cloudflare API Shield is built specifically to protect APIs.

REST APIs — The Standard for Web APIs

REST (Representational State Transfer) is an architectural style for building APIs over HTTP. It's not a protocol — it's a set of conventions that makes APIs predictable and easy to use.

Core REST Principles
1. URLs are things (nouns) — HTTP methods are the action (verbs)

Instead of putting the action in the URL, you put the resource name. The HTTP method tells the server what to do with it.

❌ Non-REST (action in URL)✅ REST (resource in URL)
/getUser?id=42GET /users/42 → read
DELETE /users/42 → delete
PATCH /users/42 → update
/deleteUser?id=42
/updateUserEmail?id=42

Same URL /users/42 — the HTTP method tells the server what to do with it. This makes APIs consistent and predictable.

2. HTTP Methods Map to CRUD

CRUD = Create, Read, Update, Delete — the four basic operations on any data. REST maps these to HTTP methods:

What you want to doHTTP MethodExample
Create something newPOSTPOST /users
Read / retrieveGETGET /users/42
Update fully (replace all fields)PUTPUT /users/42
Update partially (one field only)PATCHPATCH /users/42
DeleteDELETEDELETE /users/42
3. Stateless

Every request must contain everything the server needs to process it. The server keeps no memory of previous requests. This means authentication is sent with every single request — typically as a token in the Authorization header:

GET /users/42 Authorization: Bearer eyJhbGciOiJIUzI1NiJ9... ← Server reads the token, verifies it, knows who you are — all from this one request alone
A REST API in Practice
MethodEndpointAction
GET/usersList all users
POST/usersCreate a new user
GET/users/42Get user with ID 42
PUT/users/42Replace user 42 entirely
PATCH/users/42Update specific fields of user 42
DELETE/users/42Delete user 42
Nested Resources
GET/users/42/postsList all posts by user 42
POST/users/42/postsCreate a post for user 42
💡 REST APIs & Cloudflare API Shield

Cloudflare's API Shield product is designed specifically for REST APIs. It discovers all API endpoints automatically, lets you define OpenAPI schemas (what valid requests look like), and blocks malformed requests before they reach the origin. Rate limiting per endpoint, sequence abuse detection, and mTLS client certificates are all part of API Shield. Understanding REST is the foundation for understanding what API Shield is protecting.


Module 7 · Topic 7.14

Web App Architecture, Reverse Proxy & Load Balancers

Modern Web Application Architecture

A "website" is rarely just one server anymore. Modern web applications are made of multiple components — each with a specific job.

Typical Web Application Architecture — With Cloudflare in the Path
💻 User browser Cloudflare Edge / PoP DDoS + WAF CDN Cache TLS Termination Cache hit → responds here cache miss Load Balancer distributes traffic Web Server 1 nginx / Node.js Web Server 2 nginx / Node.js Web Server 3 nginx / Node.js 🗄️ DB Postgres MySQL, MongoDB Internet-facing → Cloudflare → Load Balancer → App Servers → Database The "origin" to Cloudflare = the Load Balancer or any of the App Servers

The Reverse Proxy

A reverse proxy sits in front of one or more servers and forwards client requests to them. Clients talk to the reverse proxy — they don't know (or need to know) about the backend servers.

PropertyForward ProxyReverse Proxy
ServesClients — sits in front of usersServers — sits in front of backend
Client knows about it?Yes — explicitly configuredNo — transparent to the client
Used forPrivacy, content filtering, corporate outbound proxyLoad balancing, SSL termination, caching, WAF
ExampleCorporate proxy, VPNCloudflare, nginx, AWS ALB

Cloudflare is a reverse proxy. When you orange-cloud a domain, Cloudflare sits transparently between users and your origin. Users connect to Cloudflare's IP. Cloudflare connects to your origin. Users never see the origin IP — they only see Cloudflare.

Load Balancers

A load balancer distributes incoming requests across multiple backend servers to prevent any single server from being overwhelmed.

AlgorithmHow it worksBest for
Round RobinServer 1, Server 2, Server 3, Server 1... in rotationIdentical servers, uniform requests
Least ConnectionsSend to server with fewest active connectionsLong-lived connections (WebSockets)
IP HashSame client IP always goes to same serverSession stickiness without cookies
Geo-basedRoute to nearest/best server for the user's locationGlobal deployments, latency optimisation
Health-check basedOnly send to servers passing health checksAutomatic failover when a server goes down
💡 Cloudflare Load Balancer

Cloudflare has its own Load Balancer product that operates at the DNS + HTTP level — distributing traffic across origins globally, with health checks, automatic failover, geo-steering, and session affinity. Unlike a traditional load balancer sitting in one data center, Cloudflare's operates across 330+ PoPs — routing users to the best origin from the nearest edge. This becomes a major product conversation in Phase 2.


Module 7 · Key Takeaways

Important to Remember

🌐 7.1 — What is HTTP? & URLs
  • HTTP = Layer 7 protocol for browser-server communication. Stateless — every request is independent.
  • HTTPS = HTTP + TLS. Cloudflare terminates TLS at the edge — enables all L7 security products.
  • URL parts: scheme, subdomain, domain, path, query string, fragment (fragment never reaches server)
  • WAF rules can match on any URL component — path, query string, specific parameters
📋 7.2 — HTTP Methods
  • GET = retrieve, POST = create, PUT = replace, PATCH = partial update, DELETE = remove
  • Safe methods (GET, HEAD, OPTIONS) don't modify data. Idempotent = same result if called multiple times.
  • POST/PATCH are non-idempotent — submitting twice may charge twice
  • WAF rules can block/allow/rate-limit by method (e.g. block all DELETE, rate limit POST /login)
📦 7.3 — HTTP Request & Response Structure
  • Request: Method + Path + Version | Headers | [Body]
  • Response: Version + Status Code + Reason | Headers | Body
  • cf-ray header = Cloudflare request ID + PoP. First thing to check when debugging any issue.
🔢 7.4 — HTTP Status Codes
  • 2xx = success, 3xx = redirect, 4xx = client error, 5xx = server error
  • 401 Unauthorized = unauthenticated — not logged in, no credentials provided
  • 403 Forbidden = authenticated but access denied — what Cloudflare WAF returns when a rule blocks a request
  • 429 = rate limit exceeded — Cloudflare Rate Limiting triggers this
  • 520–526 = Cloudflare-specific — always an origin/SSL issue, not a client issue
  • No cf-ray header in response = Cloudflare is NOT in the path
🏷️ 7.5 — HTTP Headers
  • Key request headers: Host, User-Agent, Authorization, Cookie, CF-Connecting-IP, X-Forwarded-For
  • Key response headers: Content-Type, Cache-Control, Set-Cookie, cf-ray, cf-cache-status
  • Use CF-Connecting-IP (not X-Forwarded-For) for the real visitor IP in WAF rules
  • WAF can match on any header — User-Agent, Referer, Authorization are most common targets
⚡ 7.6 — HTTP Versions
  • HTTP/1.1 = persistent connections, but head-of-line blocking within a connection
  • HTTP/2 = multiplexing (multiple streams on one TCP connection), header compression
  • HTTP/3 = QUIC over UDP — multiplexing with no TCP HOL blocking, built-in TLS, connection migration
  • Cloudflare supports HTTP/3 by default — first CDN to deploy at scale
🍪 7.7 — Cookies
  • Cookies = small data server asks browser to store and send back, enabling state on stateless HTTP
  • HttpOnly = JS can't read it (XSS protection). Secure = HTTPS only. SameSite = CSRF protection.
  • Cloudflare bypasses cache for cookied requests by default (likely personalised content)
  • Bot Management uses cookie handling as a detection signal
🔑 7.8 — Sessions & Authentication
  • Sessions = server stores state, gives client a session ID cookie to reference it
  • JWT = self-contained token with signed claims — server verifies signature, no DB lookup needed
  • JWT sent as: Authorization: Bearer <token>
  • Cloudflare Access issues JWT to authenticated users — validates at edge, not origin
📦 7.9 — Caching
  • Cache-Control controls caching: max-age (browser+CDN), s-maxage (CDN only), public/private, no-store
  • ETag + If-None-Match = cache revalidation → 304 Not Modified saves bandwidth
  • cf-cache-status: HIT = served from cache. MISS = fetched from origin. BYPASS = cache skipped.
  • Cloudflare caches static assets by default. HTML and API responses require Cache Rules to cache.
  • Requests with cookies bypass cache by default — important for logged-in user flows
🔒 7.10 — CORS
  • Same-Origin Policy = browsers block cross-origin requests by default
  • CORS = server explicitly allows cross-origin requests via response headers
  • Browser sends OPTIONS preflight before certain cross-origin requests
  • Cloudflare WAF blocking OPTIONS = frontend shows CORS error — common gotcha
🛡️ 7.11 — Security Headers
  • HSTS = force HTTPS, prevent protocol downgrade. preload = hardcoded in browsers.
  • CSP = define allowed content sources. Prevents XSS by blocking inline scripts.
  • X-Frame-Options = prevent clickjacking via iframes
  • Cloudflare can inject all security headers at the edge via Managed Headers — no origin changes needed
🔄 7.12 — WebSockets
  • WebSocket = HTTP upgrade to persistent full-duplex connection. Used for real-time apps (chat, live scores, trading dashboards)
  • HTTP limitation: server can only respond — it cannot push data. WebSocket removes this constraint.
  • HTTP 101 = Switching Protocols — the moment HTTP hands off to WebSocket protocol
  • Cloudflare proxies WebSockets transparently. Durable Objects enable stateful WebSocket apps at the edge.
🔌 7.13 — APIs & REST
  • API = a defined contract for two pieces of software to communicate. Web APIs use HTTP and return JSON.
  • REST = a convention for web APIs: URLs are resources (nouns), HTTP methods are actions (verbs)
  • CRUD maps to methods: GET=read, POST=create, PUT=replace, PATCH=partial update, DELETE=remove
  • Stateless — every request carries its own auth token. Server keeps no session memory.
  • API Shield protects REST APIs — discovery, schema validation, rate limiting, sequence abuse detection, mTLS
🏗️ 7.14 — Web App Architecture, Reverse Proxy & Load Balancers
  • Typical stack: User → Cloudflare → Load Balancer → App Servers → Database
  • Reverse proxy = sits in front of servers, transparent to clients. Cloudflare IS a reverse proxy.
  • Load balancer distributes traffic across servers. Algorithms: round robin, least connections, geo-based.
  • Cloudflare Load Balancer = global, runs at 330+ PoPs, with health checks and automatic failover
Module 8 of 10

Encryption & TLS

How data is kept private and authentic in transit — the cryptographic foundation behind every HTTPS connection and Cloudflare security product.

Module 8 · Topic 8.1

Why Encryption Exists

The Problem — Data in Transit is Exposed

When you send data across the internet, it passes through dozens of routers, ISPs, and network devices — all of which can theoretically read the data. Without encryption, everything is sent as plaintext — readable by anyone who intercepts it.

Without Encryption — Anyone in the Path Can Read Your Data
💻 Laptop sends password password=abc123 🕵️ Attacker reads packet! sees: password=abc123 password=abc123 🖥️ Server On coffee shop WiFi, your ISP, any router in the path — all can read plaintext

What Encryption Provides

Encryption solves three distinct security problems:

🔒 Confidentiality
Only the intended recipient can read the data. Intercepted traffic is unreadable gibberish without the key.
✅ Integrity
Data has not been modified in transit. If an attacker tampers with the data, the receiver will detect it.
🪪 Authentication
The server is who it claims to be. Prevents connecting to a fake server impersonating the real one (man-in-the-middle).

TLS (the protocol behind HTTPS) provides all three. Understanding each one matters — because when TLS is misconfigured, it might provide confidentiality but not authentication, or vice versa.


Module 8 · Topic 8.2

Symmetric & Asymmetric Encryption

Symmetric Encryption — One Shared Key

In symmetric encryption, the same key encrypts and decrypts the data. Both sender and receiver must have this key. Like a physical padlock where both parties have a copy of the key.

Symmetric Encryption — Same Key Encrypts and Decrypts
Plaintext "hello" 🔑 Key Ciphertext "xK9#mQ2@p..." 🔑 Same key Plaintext "hello" Algorithm: AES-256 Fast — bulk data encryption Problem: key sharing

The key exchange problem: If you encrypt data with a key, how do you share that key with the other party? You can't send it unencrypted — it could be intercepted. You can't encrypt it either — that requires a key they already need. This is the fundamental problem asymmetric encryption solves.

Asymmetric Encryption — Public & Private Key Pair

Asymmetric encryption uses two mathematically linked keys: a public key (shared freely with everyone) and a private key (kept secret, never shared). What one key encrypts, only the other key can decrypt.

Asymmetric Encryption — Public Key Encrypts, Private Key Decrypts
Encryption: anyone encrypts with public key — only server decrypts with private key Anyone has public key encrypted data Server only can decrypt Algorithm: RSA, ECDSA Slower — key exchange only public key private key Signatures: server signs with private key — anyone verifies with public key Server signs with private key → Anyone verifies with public key Proves message came from the server — only they have the private key Public key = shared freely · Private key = never shared

How They Work Together — The Hybrid Approach

In practice, TLS uses both: asymmetric encryption to securely exchange a symmetric key, then symmetric encryption for all actual data. This gives you the security of asymmetric with the speed of symmetric.

Hybrid Encryption — How TLS Actually Works at a High Level
sequenceDiagram participant C as Client participant S as Server C->>S: "I want to connect. Here are my supported algorithms." S->>C: "Here is my public key (certificate)." C->>S: Generates session key → encrypts with server's public key → sends Note over S: Decrypts with private key → now both have the session key C->>S: All further data encrypted with fast symmetric session key S->>C: All further data encrypted with fast symmetric session key

Module 8 · Topic 8.3

Hashing & Digital Signatures

Hashing — One-Way Fingerprinting

A hash function takes any input and produces a fixed-size output called a hash (or digest). Three critical properties make it useful for security:

One-way
You cannot reverse it. Given a hash, you cannot recover the original input. Hash → Input is computationally impossible.
Deterministic
Same input always produces the same hash. "cloudflare.com" always produces the exact same SHA-256 output.
Avalanche Effect
Tiny change in input = completely different hash. "cloudflare.com" vs "Cloudflare.com" produce entirely different outputs.
SHA-256 — Tiny Change in Input = Completely Different Hash
INPUT SHA-256 HASH OUTPUT (256 bits / 64 hex chars) "cloudflare.com" 8f14e45f...d8c3b9a1 "Cloudflare.com" 3b9a2c8f...7e1d4f02 ← completely different "cloudflare.co" 9c2e7a1b...4d8f0c63 ← completely different One letter changed → completely new hash Any length input → always 256 bits output One-way — cannot reverse a hash back to the original input Passwords stored as hashes — server never stores your actual password

Common Hash Algorithms

AlgorithmOutput SizeStatusUsed for
MD5128 bits⚠️ Broken — collisions foundFile checksums only (not security)
SHA-1160 bits⚠️ Deprecated — weaknesses foundLegacy systems (avoid)
SHA-256256 bits✅ SecureTLS certificates, password storage, HMAC
SHA-384 / SHA-512384/512 bits✅ SecureHigh-security applications
bcrypt / Argon2Varies✅ SecurePassword storage specifically — designed to be slow

Digital Signatures — Proving Authenticity

A digital signature combines hashing and asymmetric encryption to prove: (1) this message came from who it claims, and (2) it hasn't been tampered with.

1
Sender hashes the message

A SHA-256 hash of the message is computed: hash("Hello") → 8f14e45f...

2
Sender encrypts the hash with their private key

Only the sender has their private key — encrypting the hash proves it came from them. This encrypted hash is the digital signature.

3
Recipient verifies with sender's public key

Recipient decrypts the signature with the sender's public key to get the original hash. Then hashes the received message independently. If the two hashes match — message is authentic and unmodified.

Digital signatures are used everywhere in TLS — the certificate authority signs certificates with their private key. Your browser verifies the signature using the CA's public key (built into the browser). This is the foundation of trust on the web.


Module 8 · Topic 8.4

Certificates, CAs & PKI

The Problem — Who Do You Trust?

Asymmetric encryption requires a public key. But when your browser connects to cloudflare.com and receives a public key — how does it know that key genuinely belongs to Cloudflare, and isn't a public key from an attacker pretending to be Cloudflare?

This is the trust problem, and it's solved by a system of trusted third parties called Certificate Authorities (CAs).

X.509 Certificates — Identity + Public Key

A digital certificate is a document that binds a domain name to a public key — signed by a trusted third party (CA) to prove the binding is legitimate. Think of it as a digital passport issued by a trusted authority.

What's Inside a TLS Certificate
📜 TLS Certificate for cloudflare.com Subject: cloudflare.com (who this cert is for) Subject Alt Names: *.cloudflare.com, cloudflare.com Public Key: [Cloudflare's public key — 2048-bit RSA] Issuer: DigiCert Inc (the CA that signed this) Valid From: 2026-01-01 Valid Until: 2027-01-01 CA Signature: [DigiCert signed this with their private key] ← proves DigiCert verified that Cloudflare controls cloudflare.com

Certificate Authorities (CAs)

A Certificate Authority is an organisation trusted to verify domain ownership and issue certificates. Before issuing, the CA proves the applicant controls the domain (via DNS records, file upload, or email). The CA then signs the certificate with its private key.

Your browser and OS come pre-installed with a list of ~150 trusted root CAs (including DigiCert, Let's Encrypt, Comodo, GlobalSign). If a certificate is signed by any of them — it's trusted.

The Chain of Trust — Root, Intermediate, Leaf

CAs don't sign site certificates directly with their root key (too risky — root key compromise = all trust destroyed). Instead they use a hierarchy:

Certificate Chain of Trust
Root CA Certificate DigiCert Global Root hardcoded in all browsers & operating systems Browser trusts → pre-installed root signs → Intermediate CA Certificate DigiCert TLS RSA SHA256 2020 CA1 signs → Leaf Certificate cloudflare.com — the actual site cert Each level vouches for the next — break the chain = browser rejects the certificate

PKI — Public Key Infrastructure

PKI is the full system — the policies, procedures, hardware, software, and CAs — that manages digital certificates and public keys. TLS on the web is the largest PKI in existence.

ComponentWhat it does
Root CAUltimate trust anchor. Private key kept offline in a vault. Rarely used directly.
Intermediate CAIssues end-entity certificates on behalf of root. If compromised, only intermediate is revoked — root stays safe.
Leaf/End-Entity CertificateThe actual cert for a domain. Has a validity period (usually 1 year or 90 days for Let's Encrypt).
CRL / OCSPCertificate Revocation List / Online Certificate Status Protocol — checks if a cert has been revoked before expiry.
💡 Cloudflare Universal SSL

When a domain is proxied through Cloudflare, Cloudflare automatically issues a TLS certificate for it — for free — via its own CA partnerships and Let's Encrypt. Users see a valid padlock. The certificate is managed entirely by Cloudflare — renewed automatically before expiry. This is called Universal SSL and it was a major moment for internet security when launched in 2014 — overnight, millions of sites got HTTPS for free.


Module 8 · Topic 8.5

TLS — Handshake, HTTPS, TLS 1.2 vs 1.3

What is TLS?

TLS (Transport Layer Security) is the protocol that encrypts all data sent between a browser and a server. It's what turns HTTP into HTTPS. TLS operates at Layer 6 (Presentation) of the OSI model, sitting between TCP (Layer 4) and HTTP (Layer 7).

TLS provides all three security properties from Topic 8.1 simultaneously: confidentiality (encrypted data), integrity (HMAC detects tampering), and authentication (certificate proves server identity).

The TLS 1.2 Handshake

Before any encrypted data flows, the client and server must negotiate TLS. This negotiation is called the handshake. In TLS 1.2, it takes 2 round trips (2-RTT) before data can flow:

TLS 1.2 Handshake — 2 Round Trips Before Data Flows
sequenceDiagram participant C as 💻 Client participant S as 🖥️ Server Note over C,S: Round Trip 1 C->>S: ClientHello — TLS version, cipher suites, random nonce S->>C: ServerHello — chosen cipher suite, random nonce S->>C: Certificate — server's public key + identity S->>C: ServerHelloDone Note over C,S: Round Trip 2 C->>S: ClientKeyExchange — pre-master secret (encrypted with server's public key) C->>S: ChangeCipherSpec — switching to encryption now C->>S: Finished (encrypted) S->>C: ChangeCipherSpec S->>C: Finished (encrypted) Note over C,S: ✅ Handshake complete — encrypted data flows

TLS 1.3 — Faster and More Secure

TLS 1.3 (2018) reduced the handshake to 1 round trip (1-RTT) — cutting connection setup time nearly in half. It also removed weak algorithms that had accumulated in TLS 1.2 over the years.

PropertyTLS 1.2TLS 1.3
Handshake round trips2-RTT1-RTT (0-RTT for resumption)
Cipher suitesMany, including weak ones (RC4, 3DES)5 modern ciphers only (AES-GCM, ChaCha20)
Forward SecrecyOptionalMandatory — always
RSA key exchangeSupportedRemoved — only ECDHE
0-RTT resumptionNoYes — returning clients skip handshake
TLS 1.3 Handshake — 1 Round Trip Before Data Flows
Client browser Server Cloudflare PoP ① ClientHello + KeyShare supported ciphers + public key sent upfront ② ServerHello + Cert + Finished all combined in ONE response — RTT 1 complete ③ Finished + HTTP data encrypted data sent immediately ← 1 RTT ✅ 1 round trip — handshake done, data flowing

Forward Secrecy — Why It Matters

Forward Secrecy means that even if a server's private key is compromised in the future, past encrypted sessions cannot be decrypted. TLS 1.2 without forward secrecy: an attacker who records encrypted traffic today and later gets the private key can decrypt everything retroactively. TLS 1.3 always uses forward secrecy — past sessions are always safe.

HTTPS = HTTP + TLS

HTTPS is simply HTTP running inside a TLS connection. The HTTP request and response are identical in format — TLS is a transparent layer that encrypts the entire conversation. The URL changes from http:// to https:// and the port changes from 80 to 443.

Full HTTPS Connection Sequence — DNS + TCP + TLS + HTTP
① DNS resolve domain ② TCP 3-way SYN SYN-ACK ACK ③ TLS Handshake 1-2 round trips ④ HTTP Request GET / HTTP/1.1 ⑤ Response 200 OK + HTML Total from URL typed to first byte received: typically 100–300ms Cloudflare reduces this by ~70% — TLS terminates at nearby PoP, cache hit skips ④ entirely
💡 Cloudflare Enforces TLS Versions

In the Cloudflare dashboard, customers can set the minimum TLS version their site accepts — typically TLS 1.2 minimum. Cloudflare recommends TLS 1.3 for all new deployments. Customers in regulated industries (finance, healthcare) often need to explicitly disable TLS 1.0 and 1.1 for compliance (PCI-DSS requires TLS 1.2+). This is a real configuration conversation during onboarding.


Module 8 · Topic 8.6

mTLS — Mutual TLS

Standard TLS vs mTLS

In standard TLS, only the server presents a certificate — the client verifies the server's identity. The server doesn't verify who the client is (anyone can connect).

mTLS (Mutual TLS) requires both sides to present certificates — the server verifies the client's identity too. This creates a two-way authentication: you know who you're talking to, and they know who you are.

TLS vs mTLS — One-Way vs Two-Way Certificate Verification
Standard TLS Client Server 📜 server cert Client verifies server identity ✓ Server doesn't know who client is mTLS Client Server 📜 server cert 📜 client cert Both verify each other's identity ✓ Only authorised clients can connect ✓ mTLS use cases: API-to-API auth, IoT devices, Zero Trust network access Without a valid client cert → connection is refused before any HTTP is processed Much stronger than API keys or passwords — cryptographic proof of identity

When mTLS is Used

Use CaseWhy mTLS
API security (B2B)Only authorised partner services can call the API. No API key to steal — certificate is cryptographic.
MicroservicesService A can only talk to Service B if it has a valid certificate. Prevents lateral movement in a breach.
IoT devicesEach device has a unique certificate. Revoke one device without affecting others.
Zero Trust networksEvery device on the network proves its identity before accessing anything.
💡 Cloudflare API Shield Uses mTLS

Cloudflare's API Shield product supports mTLS client authentication. Customers upload their CA certificate to Cloudflare, then issue client certificates to each authorised API consumer. Cloudflare verifies the client cert at the edge — any request without a valid certificate is rejected with a 403 before reaching the origin. This is a zero-trust approach to API security that replaces weaker API key authentication.


Module 8 · Topic 8.7

TLS Termination

What is TLS Termination?

TLS termination means decrypting an incoming TLS connection at a specific point in the network path. The device that "terminates" TLS decrypts the traffic, processes it as plaintext, then optionally re-encrypts it before forwarding it further.

Where TLS Terminates Matters

Three TLS Termination Scenarios
❌ TLS terminates at origin (no CDN/proxy) User (TX) Internet (routers) Origin (London) 250ms handshake 🔒 encrypted end-to-end No security products can inspect content ✅ TLS terminates at Cloudflare PoP (edge) User (TX) CF PoP (Dallas) TLS terminates here WAF/Bot/Cache runs Origin (London) ~5ms CF backbone (re-encrypted) Cloudflare SSL Modes — Controls the CF→Origin Leg Flexible CF→origin: HTTP Full CF→origin: HTTPS (any cert) Full (Strict) CF→origin: HTTPS (valid cert) ✓ ⚠ Always use Full (Strict) in production — Flexible leaves origin traffic unencrypted

Why TLS Termination at the Edge Matters

💡 Origin CA Certificates

Cloudflare offers Origin CA certificates — certificates issued by Cloudflare's own CA, trusted only between Cloudflare's edge and the customer's origin server (not trusted by browsers). This lets customers use Full (Strict) mode without buying a certificate from a public CA. Valid for up to 15 years. Free. This is the recommended setup for all Cloudflare customers — it ensures the CF-to-origin leg is always encrypted and validated, without certificate cost or renewal overhead.


Module 8 · Key Takeaways

Important to Remember

🔒 8.1 — Why Encryption Exists
  • Without encryption, all data is readable by anyone in the path (ISPs, routers, attackers on WiFi)
  • Encryption provides three things: Confidentiality (only recipient reads it), Integrity (detect tampering), Authentication (server is who it claims)
  • TLS provides all three simultaneously
🔑 8.2 — Symmetric & Asymmetric Encryption
  • Symmetric = one shared key, fast. Problem: how to share the key securely? (AES)
  • Asymmetric = public + private key pair. Public key encrypts, private key decrypts. Solves key exchange. (RSA, ECDSA)
  • TLS uses both: asymmetric to exchange a symmetric session key, then symmetric for all data
#️⃣ 8.3 — Hashing & Digital Signatures
  • Hash = one-way fingerprint. Same input → same output. Tiny change → completely different output. Cannot be reversed. (SHA-256)
  • Digital signature = hash encrypted with private key. Proves authenticity + integrity.
  • Passwords are stored as hashes — never plaintext
  • CAs sign certificates with digital signatures — browsers verify them
📜 8.4 — Certificates, CAs & PKI
  • Certificate = document binding domain + public key, signed by a CA
  • Chain of trust: Root CA → Intermediate CA → Leaf certificate (your site)
  • ~150 root CAs are pre-trusted by browsers/OS
  • Cloudflare Universal SSL = free auto-managed TLS for all proxied zones
  • Origin CA cert = Cloudflare-issued cert for the CF→origin leg. Free, 15-year validity.
🤝 8.5 — TLS Handshake, HTTPS, TLS 1.2 vs 1.3
  • TLS 1.2 = 2-RTT handshake. TLS 1.3 = 1-RTT, 0-RTT for returning users.
  • TLS 1.3 is mandatory forward secrecy — past sessions safe even if key compromised later
  • HTTPS = HTTP inside TLS. Port 443. Identical format to HTTP.
  • Full sequence: DNS → TCP handshake → TLS handshake → HTTP request → response
  • Cloudflare terminates TLS at nearest PoP → ~5ms handshake vs ~250ms to distant origin
  • PCI-DSS requires TLS 1.2 minimum — common compliance configuration in Cloudflare dashboard
🔐 8.6 — mTLS
  • Standard TLS = server proves identity to client only
  • mTLS = both sides present certificates — mutual authentication
  • Used for: API-to-API auth, IoT, microservices, Zero Trust networks
  • Cloudflare API Shield uses mTLS — only requests with valid client certs reach the origin
  • Stronger than API keys — cryptographic proof, not a secret that can be stolen
⚡ 8.7 — TLS Termination
  • TLS termination = where decryption happens in the path
  • Cloudflare terminates TLS at the edge → performance + ability to run WAF/Bot/Cache on plaintext
  • SSL modes: Flexible (bad — CF→origin unencrypted), Full (HTTPS but any cert), Full (Strict) (always use this — HTTPS + valid cert)
  • Use Cloudflare Origin CA cert for the CF→origin leg — free, 15-year, no public trust needed
Module 9 of 10

Security Fundamentals

Understanding the attacks that Cloudflare's products defend against — the threat landscape every SE needs to know.

Module 9 · Topic 9.1

What is a Firewall?

The Core Concept

A firewall is a security system that monitors and controls network traffic based on a set of rules. It sits between a trusted network (your internal systems) and an untrusted network (the internet), deciding what traffic to allow and what to block.

The name comes from the physical concept — a firewall in a building stops fire from spreading between sections. A network firewall stops malicious traffic from spreading into your systems.

Types of Firewalls

Stateless / Packet Filtering (L3/L4)
Inspects individual packets based on:
• Source/destination IP
• Source/destination port
• Protocol (TCP/UDP/ICMP)

Fast but shallow — no context of what came before.
Stateful Inspection (L4)
Tracks the state of active connections.

Knows if a packet is part of an established connection or a new unsolicited one.

Most corporate firewalls work this way.
Application Firewall (L7)
Understands application protocols (HTTP, DNS, SMTP).

Can inspect the content of requests — query strings, headers, body.

This is what a WAF is.

Network Firewall vs WAF

PropertyNetwork FirewallWAF (Web Application Firewall)
OSI LayerL3/L4L7
InspectsIP addresses, ports, protocolsHTTP headers, URLs, request body, cookies
BlocksUnauthorised connections, port scansSQLi, XSS, CSRF, bots, DDoS at HTTP layer
Knows about HTTP?No — sees only TCP packetsYes — reads full HTTP requests and responses
ExampleFortiGate, Cisco ASA, AWS Security GroupCloudflare WAF, AWS WAF, Imperva

How a Firewall Makes Decisions

Firewalls work through an ordered list of rules — called a ruleset or policy. Each packet is checked against rules from top to bottom. The first matching rule wins.

Firewall Rule Processing — First Match Wins
Incoming Packet Rule 1: ALLOW port 443 from any Rule 2: BLOCK IP 203.0.113.5 Rule 3: ALLOW port 80 from any Rule 4: BLOCK port 22 from internet Default: BLOCK everything else ✅ ALLOW ❌ BLOCK Packet checked top-down — first matching rule applies. Order matters.
💡 Cloudflare as a Firewall

Cloudflare operates firewalls at multiple layers simultaneously on every request:

  • L3/L4 — Magic Firewall: IP/port based rules, blocks DDoS at the network layer
  • L7 — WAF: Inspects HTTP content, blocks application attacks (SQLi, XSS, bots)
  • L7 — Cloudflare Access: Identity-aware firewall — allows only authenticated users to reach internal apps

The key advantage: Cloudflare's firewall runs at the edge (330+ PoPs) — traffic is filtered before it ever reaches the customer's origin server.


Module 9 · Topic 9.2

DDoS Attacks

What is a DDoS Attack?

A DDoS (Distributed Denial of Service) attack overwhelms a target with traffic until it can no longer respond to legitimate users. The "Distributed" part means the attack comes from thousands or millions of sources simultaneously — making it impossible to block a single IP.

The goal is not to steal data — it's to make the target unavailable. Every second of downtime costs money, reputation, and trust.

The Attack Source — Botnets

DDoS attacks are typically carried out by botnets — networks of thousands of compromised devices (computers, IoT cameras, routers, phones) infected with malware. The attacker commands the botnet remotely. The infected device owners have no idea they're participating.

DDoS Attack — Botnet Flooding a Target
Attacker C&C server Bot 1-1000 infected PCs Bot 1001-5000 IoT cameras Bot 5001-10000 routers FLOOD Tbps of traffic Target overwhelmed Legit user can't connect

L3/L4 vs L7 DDoS — The Critical Distinction

DDoS attacks operate at different layers, requiring completely different defences. Getting this wrong in a customer conversation is a significant mistake.

PropertyL3/L4 DDoS (Volumetric)L7 DDoS (Application)
TargetNetwork bandwidth or TCP stackWeb application logic
Measured inGbps or Tbps (packet volume)Requests per second (rps)
Attack looks likeMassive flood of UDP/TCP/ICMP packetsLegitimate HTTP requests — harder to detect
Example attacksUDP flood, SYN flood, ICMP flood, DNS amplificationHTTP flood, Slowloris, credential stuffing
Cloudflare defenceMagic Transit, network-level DDoS protectionWAF + HTTP DDoS managed ruleset
Scale examplesLargest ever: 5.6 Tbps (blocked by Cloudflare, 2024)Largest ever: 71M rps (blocked by Cloudflare, 2023)

Common L3/L4 Attack Types

SYN Flood
Sends millions of TCP SYN packets but never completes the handshake. Server allocates memory for each half-open connection until it runs out and crashes.
UDP Amplification
Sends small requests to public servers (DNS, NTP) with victim's spoofed IP. Servers send large responses to the victim. Amplification factors: DNS 50x, NTP 556x, Memcached 51,000x.
ICMP Flood (Ping Flood)
Floods target with ICMP Echo Request packets. Target must process and respond to each one — consuming CPU and bandwidth until it's overwhelmed.

Why Cloudflare's DDoS Protection is Different

Traditional DDoS mitigation uses scrubbing centres — when an attack is detected, traffic is rerouted to a centralised facility where it's cleaned, then sent onward. This adds latency and has limited capacity.

Cloudflare's approach: every PoP is a scrubbing centre. Because of Anycast, attack traffic is spread across all 330+ PoPs globally — no single location receives the full volume. A 5 Tbps attack gets distributed across hundreds of locations, each handling a fraction. Cloudflare's total network capacity is over 280 Tbps — more than enough to absorb even the largest recorded attacks.

💡 Unmetered DDoS Protection

Cloudflare offers unmetered DDoS protection — customers are never charged based on the volume of attack traffic. This is a significant differentiator vs. competitors who charge per Gbps of attack traffic absorbed. A customer under a 5 Tbps attack pays the same as a customer with no attacks. This is possible because Cloudflare's network capacity far exceeds any realistic attack volume.


Module 9 · Topic 9.3

OWASP Top 10

What is OWASP?

The Open Worldwide Application Security Project (OWASP) is a non-profit foundation that publishes open standards and research on web application security. Their most widely referenced resource is the OWASP Top 10 — a list of the 10 most critical web application security risks, updated every few years based on real-world data from thousands of applications.

The entire WAF industry — including Cloudflare's WAF — is largely organised around defending against the OWASP Top 10. When you talk to security-conscious customers, they will reference OWASP directly.

OWASP Top 10 (2021 Edition)

#RiskWhat it isCloudflare defence
A01Broken Access ControlUsers accessing resources they shouldn't — reading other users' data, admin pages without authCloudflare Access (ZTNA), WAF rules
A02Cryptographic FailuresSensitive data exposed due to weak/missing encryption — passwords in plaintext, HTTP instead of HTTPSHTTPS enforcement, HSTS, TLS version control
A03InjectionAttacker inserts malicious code into queries — SQL injection, command injection, LDAP injectionWAF Managed Ruleset (OWASP core rule set)
A04Insecure DesignArchitectural flaws — security not built into the design phaseNot directly — requires secure development practices
A05Security MisconfigurationDefault credentials, exposed error messages, unnecessary features enabled, open cloud storageWAF rules, security headers via Managed Headers
A06Vulnerable ComponentsUsing libraries or frameworks with known vulnerabilities — Log4Shell was this categoryWAF virtual patching — blocks exploit attempts while origin is patched
A07Authentication FailuresBroken login — credential stuffing, brute force, weak passwords, session fixationBot Management, Rate Limiting, Cloudflare Access
A08Software & Data Integrity FailuresUntrusted code/data in pipeline — malicious npm packages, insecure deserializationPage Shield (client-side JS protection)
A09Logging & Monitoring FailuresNot detecting breaches — no logs, alerts, or incident responseCloudflare Security Analytics, SIEM integration
A10Server-Side Request Forgery (SSRF)App fetches remote URL controlled by attacker — access internal systems via serverWAF rules targeting SSRF patterns

The Most Important Ones for Cloudflare Conversations

A03 — Injection
SQL Injection and XSS are sub-categories of this. The WAF's entire OWASP Core Rule Set is primarily built to detect and block injection attacks. Covered in depth in Topic 9.4.
A06 — Vulnerable Components
When Log4Shell hit in 2021, Cloudflare deployed WAF rules to block exploit attempts within hours — before most organisations could patch. This is virtual patching — the WAF buys time while the origin gets fixed.
A07 — Authentication Failures
Credential stuffing (using leaked passwords to try thousands of accounts) is one of the most common attack vectors. Cloudflare's Bot Management detects and blocks these patterns before they reach the login endpoint.
💡 Cloudflare WAF & OWASP

Cloudflare's WAF includes the OWASP Core Rule Set (CRS) as a managed ruleset — a set of rules maintained by OWASP that covers the most common attack patterns across all Top 10 categories. Customers can enable it with one click. Cloudflare's security team also maintains their own additional rulesets on top of OWASP CRS, updated in real-time as new vulnerabilities are discovered.


Module 9 · Topic 9.4

SQL Injection & XSS

SQL Injection (SQLi)

SQL Injection is an attack where an attacker inserts malicious SQL code into an input field, which then gets executed by the database. It's one of the oldest and most devastating attacks — responsible for countless data breaches.

How it Works

Consider a login form. The backend takes the username and password and builds a SQL query:

SQL Injection — How a Malicious Input Breaks a Query
✅ Normal login: Username: alice | Password: mypassword SQL: SELECT * FROM users WHERE username='alice' AND password='mypassword' → Returns Alice's record if credentials match. Normal behaviour. ❌ SQL Injection attack: Username: admin' OR '1'='1 | Password: anything SQL: SELECT * FROM users WHERE username='admin' OR '1'='1' AND password='anything' → '1'='1' is always true → query returns ALL users → attacker bypasses login entirely → Can also: dump database, delete tables, extract passwords
Other SQLi Techniques
TypeWhat it doesExample payload
Classic / In-bandResults returned directly in response' OR '1'='1
UNION-basedAppends another SELECT to extract data from other tables' UNION SELECT username,password FROM users--
Blind SQLiNo direct output — infers data from true/false responses or timing' AND 1=1-- vs ' AND 1=2--
Time-based BlindUses database sleep functions to infer data via response delay'; IF (1=1) WAITFOR DELAY '0:0:5'--
Prevention

The proper fix is parameterised queries / prepared statements — separating SQL code from user data so input can never be interpreted as SQL. The WAF provides an additional layer by detecting and blocking SQLi patterns in requests before they reach the origin.

Cross-Site Scripting (XSS)

XSS attacks inject malicious JavaScript into a webpage that is then executed in other users' browsers. Unlike SQLi which targets the database, XSS targets the users themselves.

How it Works

A user submits a comment on a website. The comment is stored and displayed to other visitors. If the site doesn't sanitise input:

Stored XSS — Malicious Script Injected via Comment Field
Attacker submits comment with <script> tag <script>steal(document.cookie)</script> Database stores script as comment Victim visits page browser executes the script session cookie stolen! What attacker can do with stolen session cookie: • Steal session cookies → impersonate victim, take over their account • Redirect user to phishing site • Keylog — capture every keystroke (passwords, credit card numbers) • Perform actions as the victim — transfer money, change email, delete account
Types of XSS
TypeHow it worksPersistence
Stored (Persistent)Malicious script saved in database, served to every visitor. Most dangerous.Permanent until removed
ReflectedScript in URL parameter reflected back in response. Victim clicks a malicious link.Only affects users who click the link
DOM-basedJavaScript on the page itself reads attacker-controlled data and writes it to DOM unsafely.Client-side only — never sent to server
Prevention
💡 SQLi & XSS in Cloudflare WAF

SQLi and XSS are the two most common attack types the WAF is configured to block. Cloudflare's OWASP Managed Ruleset includes hundreds of signatures for both — detecting patterns like SELECT FROM, UNION SELECT, <script>, onerror=, javascript: etc. in URLs, headers, and request bodies. When you write a custom WAF rule to block a specific SQLi variant, you're extending this protection.

⚠️ SQLi vs XSS — Key Distinction
  • SQLi targets the database — the attacker manipulates server-side SQL queries to extract or modify data
  • XSS targets other users — the attacker injects client-side scripts that execute in victims' browsers
  • SQLi is a server-side attack. XSS is a client-side attack. Both are injection attacks (OWASP A03) but at different layers.

Module 9 · Topic 9.5

CSRF — Cross-Site Request Forgery

What is CSRF?

CSRF (Cross-Site Request Forgery) tricks a user's browser into making an unwanted request to a site where the user is already logged in. The attacker doesn't steal the session — they abuse it.

How CSRF Works

The attack relies on one key fact: browsers automatically attach cookies to every request to a domain — even if the request originates from a different site.

CSRF Attack — Browser Tricked Into Making Unauthorised Request
① User logged into bank.com — cookie set ② User visits evil.com (attacker) ③ evil.com hidden tag <img src="bank.com/transfer ?to=attacker&amount=1000"> Browser sends request WITH bank.com cookie auto-attached! bank.com server sees valid cookie → executes transfer! 💸 Bank sees a valid session cookie → assumes it's the legitimate user → processes the transfer without the user's knowledge The attacker never had the cookie — they just made the browser use it

CSRF vs XSS — Key Difference

XSS
Attacker injects script into the target site. Script runs in victim's browser. Attacker can read data, steal cookies, perform actions.
CSRF
Attacker tricks browser into sending a request FROM the victim's session. No script injection needed. Attacker can't read the response — just trigger actions.

Prevention

MethodHow it works
CSRF TokenServer generates a unique secret token per session and embeds it in every form. Attacker's forged request doesn't have the token → request rejected. Most effective defence.
SameSite Cookie attributeSameSite=Strict or SameSite=Lax prevents cookies being sent with cross-site requests. Covered in Module 7.7.
Checking Origin/Referer headersServer checks where the request came from. If it's not from the expected domain — reject it.
Requiring re-authenticationFor sensitive actions (money transfer, email change) — ask for password again. Even a valid CSRF token can't bypass this.
💡 Why SameSite Cookies Largely Solved CSRF

Modern browsers now default to SameSite=Lax for cookies — meaning cookies are not sent on cross-site POST requests. This breaks the core CSRF mechanism for most scenarios. However, older browsers and misconfigured SameSite=None cookies still leave CSRF possible. WAF rules can also detect common CSRF patterns — missing CSRF tokens or mismatched origin headers.


Module 9 · Topic 9.6

Bots & Scrapers

What is a Bot?

A bot is any automated program that makes HTTP requests — acting like a browser but without a human behind it. Bots are not inherently bad. A huge portion of internet traffic is bots. The challenge is distinguishing good bots from bad bots.

Good Bots vs Bad Bots

✅ Good Bots
Googlebot, Bingbot — search engine crawlers that index your site

Uptime monitors — check if your site is up

Security scanners — legitimate vulnerability testing

RSS readers — fetch content updates

These bots help your site and should be allowed.
❌ Bad Bots
Scrapers — steal your content, price data, or contact lists

Credential stuffers — try stolen username/password combos at scale

Vulnerability scanners — probe for security weaknesses

DDoS bots — flood requests to overwhelm your server

Ad fraud bots — generate fake ad clicks

Credential Stuffing — The Most Common Bot Attack

Attackers obtain lists of leaked username/password combinations from data breaches (billions exist on the dark web). They then use bots to automatically try these credentials on other sites — betting that users reuse passwords.

Credential Stuffing — Scale Makes it Effective
Leaked DB 1 billion username/ password combos Bot Network tries 10,000 logins/minute Login Endpoint POST /login bank.com Even 0.1% success rate = 1,000,000 compromised accounts from 1B attempts Cloudflare Bot Management detects anomalous login patterns → blocks bot traffic Rate limiting, bot score thresholds, JS challenge, CAPTCHA — all before login logic runs

How Cloudflare Detects Bots

Cloudflare's Bot Management assigns every request a bot score from 1–99:

Detection signals used:

SignalWhat it detects
JavaScript fingerprintingReal browsers execute JS in specific ways — bots often don't or behave differently
TLS fingerprinting (JA3)The TLS handshake reveals the client's software — bot frameworks have distinctive signatures
Behavioural analysisMouse movements, scroll patterns, timing between requests — bots are too consistent, too fast
Request header analysisBots often have missing, unusual, or fake User-Agent strings
IP reputationCloudflare's global network sees 20% of internet traffic — known bad IPs are flagged immediately
Machine learningModels trained on trillions of requests identify bot patterns that rule-based systems miss

Bot Management Tiers

ProductAvailable onWhat it does
Bot Fight ModeFree planBlocks obvious bots — simple fingerprinting, challenges known bad bot IPs
Super Bot Fight ModePro/Business plansAdds ML detection, verified bot allowlist (Googlebot etc.), JS challenges
Bot ManagementEnterprise planFull bot score (1–99), custom rules by score, analytics, API access, model tuning

Module 9 · Topic 9.7

API Attacks

Why APIs are a Major Attack Surface

APIs are the backbone of modern applications — mobile apps, SPAs, microservices, and third-party integrations all communicate via APIs. But APIs are often less protected than web frontends:

Common API Attack Types

AttackWhat it isExample
Broken Object Level Authorisation (BOLA)API returns data for any object ID — attacker changes the ID to access other users' data. #1 on OWASP API Top 10.GET /api/users/42 works. Attacker tries GET /api/users/43 → gets another user's data.
Broken AuthenticationWeak or missing authentication on API endpoints — API tokens never expire, endpoints accessible without any tokenAPI key sent in URL query string → logged in server logs → leaked
Excessive Data ExposureAPI returns more data than needed — frontend filters it, but full data is exposed in the API responseAPI returns full user object including SSN and DOB — frontend only shows name and email
Rate Limiting AbsentNo limits on how many requests a client can make — enables scraping, brute force, credential stuffingAttacker calls /api/search 10M times to dump entire product catalogue
Mass AssignmentAPI blindly applies all fields from request body to database object — attacker adds privileged fieldsPOST body: {"name":"alice","role":"admin"} → user gets admin role if API doesn't filter fields
Injection via APISQLi, NoSQLi, command injection through API parameters — same attack as web but via JSON body{"username": "admin' OR '1'='1"} in JSON body
Sequence AbuseAPI calls designed to be made in a specific order — attacker skips steps (e.g. skip payment, go straight to order confirmation)E-commerce: browse → add to cart → pay → confirm. Attacker calls /confirm directly.
💡 Cloudflare API Shield

Cloudflare's API Shield product addresses the full API attack surface:

  • API Discovery — automatically finds all API endpoints including undocumented ones
  • Schema Validation — defines what valid requests look like (OpenAPI schema) and blocks anything outside the schema
  • Sequence Mitigation — detects and blocks out-of-order API calls (e.g. skipping payment step)
  • mTLS — requires client certificates, ensuring only authorised clients can call the API
  • Rate Limiting — enforced per endpoint, per API key, per IP

Module 9 · Topic 9.8

Man-in-the-Middle Attacks

What is a MitM Attack?

A Man-in-the-Middle (MitM) attack is when an attacker secretly intercepts and potentially modifies communication between two parties — each believing they're communicating directly with the other.

Man-in-the-Middle — Attacker Intercepts Communication
✅ Normal — Direct Communication Browser 🔒 HTTPS Server ❌ MitM — Attacker Intercepts Browser Attacker reads + modifies Server Encrypted end-to-end Attacker sees nothing Attacker reads all traffic Can inject content too

Common MitM Attack Scenarios

AttackHow it worksDefence
HTTP interceptionUser visits an HTTP (not HTTPS) site. Attacker on same network reads all traffic in plaintext.HTTPS everywhere, HSTS to force HTTPS
SSL strippingAttacker downgrades an HTTPS connection to HTTP — user's browser talks HTTP to attacker, attacker talks HTTPS to server. User thinks they're on a secure connection.HSTS with preload — browser refuses HTTP entirely
Rogue WiFi / Evil TwinAttacker sets up a fake WiFi hotspot ("Free Airport WiFi"). User connects — all traffic routes through attacker.TLS + HSTS — even on rogue WiFi, encrypted traffic can't be read without the cert's private key
ARP SpoofingOn a local network, attacker claims their MAC is the router — devices send all traffic through attacker. Covered in Module 2.Dynamic ARP inspection, network-level controls
BGP HijackingAttacker announces false BGP routes — traffic for a destination gets routed through attacker's network. Covered in Module 4.RPKI, route filtering, BGP route monitoring

Why TLS Defeats Most MitM Attacks

When TLS is implemented correctly, MitM attacks face a fundamental barrier: the attacker cannot forge a valid TLS certificate for the target domain (they don't have the CA-signed private key). The browser will show a certificate error.

The attacker is left with two options — both of which fail when users and systems are configured correctly:

💡 Cloudflare & MitM Prevention

Cloudflare protects against MitM at multiple levels:

  • HTTPS enforcement — redirects all HTTP to HTTPS automatically
  • HSTS — one-click enablement in SSL/TLS settings, including preload list submission
  • TLS 1.3 — mandatory forward secrecy means even if a key is compromised later, past sessions are safe
  • Certificate Transparency — Cloudflare monitors CT logs and alerts customers if unauthorised certificates are issued for their domains
  • mTLS — even if an attacker intercepts traffic, they can't forge a valid client certificate to authenticate as a legitimate service

Module 9 · Topic 9.9

Zero-Day Vulnerabilities

What is a Zero-Day?

A zero-day vulnerability is a security flaw in software that is unknown to the vendor — meaning they have had zero days to fix it. Because no patch exists yet, any system running that software is exposed with no defence from the vendor.

Zero-days are the most dangerous category of vulnerability because:

The Zero-Day Lifecycle

Zero-Day Timeline — From Discovery to Patch
Flaw exists in software unknown Attacker discovers flaw exploitation begins ← ZERO-DAY WINDOW — no patch available → Vendor notified / discovers patch in progress Patch released CVE published Patch deployed by users safe at last

Famous Zero-Day Examples

VulnerabilityYearWhat it wasImpact
Log4Shell (CVE-2021-44228)2021Critical flaw in Apache Log4j logging library — attackers could run any code on the server by logging a malicious stringHundreds of millions of systems affected. Cloudflare deployed WAF rules within hours of disclosure.
EternalBlue2017NSA-developed exploit for a Windows SMB flaw, leaked by Shadow BrokersUsed in WannaCry and NotPetya ransomware — billions in damage
Heartbleed (CVE-2014-0160)2014Buffer over-read in OpenSSL — attackers could read server memory including private keysAffected ~17% of all HTTPS servers. Private keys, passwords, session tokens exposed.

CVE — Common Vulnerabilities and Exposures

When a vulnerability is publicly disclosed, it gets assigned a CVE identifier — a standardised reference number like CVE-2021-44228. This allows vendors, security tools, and teams worldwide to refer to the same vulnerability unambiguously.

CVSS (Common Vulnerability Scoring System) rates severity from 0–10. A score of 9.0+ is considered Critical.

💡 Virtual Patching — How Cloudflare WAF Responds to Zero-Days

When a critical zero-day is disclosed (like Log4Shell), organisations need weeks or months to patch all affected systems. The WAF can be updated in hours to detect and block exploit attempts — buying time while the underlying software gets patched.

Cloudflare's security team deployed WAF rules blocking Log4Shell exploit attempts within hours of public disclosure — before most organisations even knew they were vulnerable. This is virtual patching at scale, and it's one of the strongest arguments for a WAF in any customer conversation.


Module 9 · Topic 9.10

Regex Basics

What is Regex?

Regex (Regular Expressions) is a pattern-matching syntax. You define a pattern, and it checks whether a string matches it. In Cloudflare WAF, regex is used in custom rules to match attack patterns in URLs, headers, and request bodies.

The 4 Symbols You Actually Need

SymbolMeaningWAF Example
^Starts with^/admin — URL must start with /admin
$Ends with\.php$ — URL must end with .php
|ORSELECT|UNION|DROP — any of these words
(?i)Case-insensitive(?i)SELECT matches select, SELECT, SeLeCt — essential since attackers mix case to evade detection

Real WAF Regex Examples

What to blockRegex patternWhat it matches
SQL injection(?i)(SELECT|UNION|INSERT|DROP)SQL keywords in any case
XSS script tags(?i)<scriptOpening script tags in any form
Known attack scanners(?i)(sqlmap|nikto|nmap)Common attack tool names in User-Agent
Admin paths^/adminAny URL starting with /admin
Path traversal\.\./Directory traversal like ../../etc/passwd
💡 Regex in Cloudflare WAF

In the WAF rule builder, set the operator to "matches regex" and write your pattern. Common fields to match against: http.request.uri.path (URL path), http.user_agent, http.request.body.raw.

Example: Block if User-Agent matches (?i)(sqlmap|nikto) — done. You don't need to be a regex expert to write effective WAF rules.


Module 9 · Key Takeaways

Important to Remember

🔥 9.1 — Firewalls
  • Firewall = monitors and controls traffic based on rules. First match wins.
  • L3/L4 firewall = inspects IP, port, protocol. WAF (L7) = inspects HTTP content.
  • Cloudflare operates at L3 (Magic Firewall), L4 (Spectrum), and L7 (WAF + Access) simultaneously.
💥 9.2 — DDoS Attacks
  • L3/L4 DDoS = volumetric packet floods — measured in Gbps/Tbps. Defence: network-level filtering, Magic Transit.
  • L7 DDoS = HTTP request floods — measured in requests/second. Defence: WAF + HTTP DDoS managed ruleset.
  • SYN flood exploits TCP handshake. UDP amplification spoofs victim IP to multiply traffic (DNS 50x, NTP 556x).
  • Cloudflare: Anycast distributes attack across 330+ PoPs. Unmetered — never charged for attack volume. 280 Tbps+ capacity.
📋 9.3 — OWASP Top 10
  • OWASP Top 10 = the 10 most critical web app security risks. The WAF industry is organised around defending against these.
  • Most relevant for Cloudflare: A03 Injection (SQLi/XSS), A06 Vulnerable Components (virtual patching), A07 Auth Failures (Bot Mgmt)
  • Cloudflare WAF includes the OWASP Core Rule Set as a managed ruleset — one click to enable.
  • Virtual patching: WAF blocks exploit attempts for zero-days while origin waits for a patch
💉 9.4 — SQL Injection & XSS
  • SQLi targets the database — injects SQL code into queries to extract/modify data or bypass authentication
  • XSS targets other users — injects JavaScript into pages, executes in victims' browsers, steals cookies/sessions
  • SQLi = server-side attack. XSS = client-side attack. Both are injection (OWASP A03).
  • Prevention: parameterised queries (SQLi), CSP + HttpOnly cookies (XSS), WAF for both
🔄 9.5 — CSRF
  • CSRF tricks a logged-in user's browser into making an unwanted request to a site — abuses their session, not steals it
  • Works because browsers automatically attach cookies to every request to a domain
  • Prevention: CSRF tokens, SameSite=Strict/Lax cookies (now browser default)
  • XSS = attacker runs code in victim's browser. CSRF = attacker triggers actions using victim's session.
🤖 9.6 — Bots & Scrapers
  • Good bots (Googlebot, monitors) should be allowed. Bad bots (scrapers, credential stuffers) must be blocked.
  • Credential stuffing = testing billions of leaked username/password combos at scale against login endpoints
  • Cloudflare Bot Score 1–99: 1 = bot, 99 = human. Uses JS fingerprinting, TLS/JA3, behavioural analysis, IP reputation, ML.
  • Three tiers: Bot Fight Mode (Free), Super Bot Fight Mode (Pro), Bot Management (Enterprise)
🔌 9.7 — API Attacks
  • BOLA (#1 OWASP API) = accessing other users' data by changing object IDs in the URL
  • Sequence abuse = skipping steps in an API flow (e.g. skip payment, confirm order directly)
  • APIs often have undocumented "shadow" endpoints — major attack surface
  • Cloudflare API Shield: Discovery, Schema Validation, Sequence Mitigation, mTLS, Rate Limiting
🕵️ 9.8 — Man-in-the-Middle Attacks
  • MitM = attacker secretly intercepts communication between two parties
  • SSL stripping = downgrading HTTPS to HTTP — defeated by HSTS preload
  • TLS defeats most MitM — attacker can't forge a valid CA-signed certificate
  • Cloudflare: HTTPS enforcement, HSTS, TLS 1.3 forward secrecy, Certificate Transparency monitoring, mTLS
🚨 9.9 — Zero-Day Vulnerabilities
  • Zero-day = security flaw unknown to the vendor — zero days to patch it, exploited immediately
  • CVE = standardised identifier for vulnerabilities (e.g. CVE-2021-44228 = Log4Shell)
  • CVSS score 9.0+ = Critical severity
  • Virtual patching: Cloudflare WAF deployed Log4Shell blocking rules within hours of disclosure — before most organisations even knew they were vulnerable
🔍 9.10 — Regex Basics
  • Regex = pattern syntax for matching text. Used in WAF custom rules, log analysis, security tooling.
  • Key symbols: ^ starts with, $ ends with, | OR, (?i) case-insensitive
  • In Cloudflare WAF: match on http.request.uri.path, http.user_agent, http.request.body.raw using regex
  • You don't need to be an expert — being able to read and modify a regex is enough
Module 10 of 10

Putting It All Together

Every concept from every module comes together in one complete picture — what happens when you type a URL, where Cloudflare fits, and how to think about the full stack as an SE.

Module 10 · Topic 10.1

Full Web Request Lifecycle

The Complete Journey — From URL to Response

You've now learned every layer of the stack. Here's how they all connect in a single web request. When you type https://cloudflare.com and press Enter:

1
DNS Resolution (Module 6)

Browser checks cache → OS cache → Resolver (1.1.1.1) → Root → .com TLD → Cloudflare's authoritative NS.
Result: cloudflare.com resolves to 104.21.5.10 (Cloudflare's Anycast IP)

2
TCP Handshake (Module 5)

Browser initiates a TCP connection to 104.21.5.10:443.
SYN → SYN-ACK → ACK. One round trip. Connection established.

3
TLS Handshake (Module 8)

Browser and Cloudflare's nearest PoP negotiate TLS 1.3. One more round trip (1-RTT).
Certificate verified. Session key exchanged. Connection is now encrypted.

4
HTTP Request Sent (Module 7)

Browser sends: GET / HTTP/3 with headers (Host, User-Agent, Accept, etc.)
Travels over the encrypted TLS channel to Cloudflare's PoP.

5
Cloudflare Edge Processing (Modules 9, 4)

At the PoP, Cloudflare runs in milliseconds:
DDoS check → WAF rules → Bot score → Cache lookup → Rate limiting
If cache HIT: response served from PoP immediately. No origin contact.

6
Origin Request (Cache MISS) (Module 4)

If not cached, Cloudflare forwards the request to the origin server over its private backbone (not the public internet). New TLS connection opened between Cloudflare and origin.

7
Origin Response + Caching (Modules 7, 4)

Origin returns HTTP response. Cloudflare caches it per Cache-Control headers.
Adds cf-ray, cf-cache-status, and other Cloudflare response headers.

8
Response Delivered to Browser (Module 7)

Browser receives HTTP response with status 200. Renders HTML. Makes additional requests for CSS, JS, images — each following the same path (but hitting the cache for most static assets).

Complete Request Flow — Every Layer from Browser to Origin
Browser DNS lookup TCP + TLS HTTP/3 HTTPS Cloudflare PoP DDoS + WAF + Bot Cache (HIT → respond) TLS termination ~5ms from user cache miss CF Backbone private network not public internet Load Balancer customer origin infrastructure Origin Server app + database AWS / on-prem ~0ms ~5ms fast origin

Module 10 · Topic 10.2

What Happens at Each OSI Layer

Mapping the Request to the OSI Model

Every step of the web request lifecycle maps to specific OSI layers. This is the framework that lets you precisely diagnose issues and explain products:

OSI LayerWhat happened in our requestCloudflare product operating here
L7 — ApplicationHTTP request/response. Headers, URL, cookies, request body. DNS resolution.WAF, Bot Management, CDN cache, Rate Limiting, API Shield, Workers
L6 — PresentationTLS encryption/decryption. Cloudflare terminates TLS at the edge, re-encrypts to origin.TLS termination, Universal SSL, mTLS
L5 — SessionTCP session management. Keep-alive connections, multiplexing in HTTP/2.Connection management, QUIC sessions (HTTP/3)
L4 — TransportTCP/UDP. Port numbers (443 for HTTPS). TCP handshake. Flow control.Spectrum (L4 proxy), Magic Firewall (L4 filtering)
L3 — NetworkIP packets. Routing. BGP path selection to nearest Cloudflare PoP via Anycast.Magic Transit (L3 DDoS), network-level DDoS protection
L2 — Data LinkEthernet frames. MAC addresses. Switch forwards frames at IXP to Cloudflare.Network infrastructure (handled by data center switches)
L1 — PhysicalBits on fiber optic cables. Radio waves for WiFi last mile. Submarine cables across oceans.Network infrastructure (Cloudflare's PoP hardware)

The "What Layer Is This?" Quick Reference

Customer says: "We're under a 2 Tbps attack"
L3/L4 — Gbps/Tbps = packet volume. Defence: Magic Transit, network DDoS protection.
Customer says: "50M requests/sec HTTP flood"
L7 — requests/sec = HTTP. Defence: WAF HTTP DDoS managed ruleset.
Customer says: "Users getting 403 errors"
L7 — 403 = WAF blocking. Check Security Events in Cloudflare dashboard for the blocking rule.
Customer says: "525 SSL error"
L6 — TLS handshake failed between Cloudflare and origin. Check origin certificate.
Customer says: "DNS propagation taking too long"
L7 (DNS) — TTL on old records. Lower TTL before making changes next time.
Customer says: "Website slow for Australia users"
L7 (CDN) — origin is far. Cloudflare PoP in Sydney serves from cache. Configure cache rules.

Module 10 · Topic 10.3

Where Cloudflare Sits in the Flow

Cloudflare as a Reverse Proxy

Cloudflare sits between users and the origin server — acting as a reverse proxy. Users connect to Cloudflare, Cloudflare connects to the origin. Neither side knows about each other directly.

Cloudflare's Position — Between the Internet and the Origin
INTERNET Browsers Mobile apps API consumers Bots (good + bad) They see Cloudflare IP all traffic ☁️ Cloudflare Anycast edge — 330+ PoPs DDoS protection WAF + Bot Management CDN Cache TLS termination + API Shield Origin IP never exposed to internet clean traffic ORIGIN Web servers App servers Databases AWS / Azure / on-prem Only sees CF IP

What Cloudflare Can and Cannot Do

Cloudflare CANCloudflare CANNOT
Block malicious requests before they reach originFix bugs in the origin application code
Cache content globally to reduce latencySpeed up an uncacheable dynamic origin that's inherently slow
Terminate TLS and inspect HTTP contentInspect traffic if the customer uses Full (Strict) end-to-end encryption without Cloudflare's knowledge
Absorb DDoS attacks at 280+ Tbps capacityProtect origins that aren't proxied (grey cloud) or accessed directly via IP
Add security headers, transform requests/responsesPrevent a data breach if the origin database itself is compromised

Module 10 · Topic 10.4

Proxied vs Non-Proxied Traffic

The Orange Cloud vs Grey Cloud Decision

This is one of the most important and most commonly misunderstood decisions in Cloudflare. Every DNS record has a proxy toggle that fundamentally changes how traffic flows.

Proxied (Orange Cloud) vs DNS Only (Grey Cloud) — Full Traffic Path Comparison
🟠 Orange Cloud — Proxied User DNS query CF Auth DNS returns CF Anycast IP Cloudflare Edge WAF, DDoS, Cache Bot Mgmt, TLS Origin Server ✅ Origin IP hidden · WAF + DDoS active · Cache serves most requests · Origin only sees CF IP ⚪ Grey Cloud — DNS Only User DNS query CF Auth DNS returns REAL origin IP [ Cloudflare bypassed ] Origin Server ❌ Origin IP exposed · No WAF, DDoS, or cache · Traffic goes directly to origin When to use Grey Cloud: Email (MX records, SMTP) · SSH (port 22) · FTP · Any non-HTTP/HTTPS protocol · Internal DNS records Common mistake: proxying MX records breaks email — always grey cloud for mail

How to Tell if Cloudflare is in the Path

When diagnosing a customer issue, the first thing to confirm is whether Cloudflare is actually proxying the request:

1
Check for cf-ray header

Run curl -I https://domain.com. If you see cf-ray: ... in the response headers — Cloudflare is proxying. If no cf-ray header — Cloudflare is NOT in the path.

2
Check the IP

Run nslookup domain.com. If the IP belongs to Cloudflare (check cloudflare.com/ips) — proxied. If it's the customer's own IP — grey cloud.

3
Check cloudflare.com/cdn-cgi/trace

Visit https://domain.com/cdn-cgi/trace. If Cloudflare is proxying, this returns a trace page showing the PoP, visitor IP, and HTTP version. If not proxied, it returns 404.


Module 10 · Topic 10.5

Origin Server Concept

What is an Origin Server?

In Cloudflare's terminology, the origin server is the customer's actual web server — the one that contains the real application and data. Cloudflare sits in front of it. When Cloudflare can't serve from cache (cache miss), it fetches from the origin.

Origin Server Configurations

Origin TypeWhere it livesWhat Cloudflare connects to
Traditional originCustomer's own servers or VPS (DigitalOcean, Linode)Origin's public IP address on port 80/443
Cloud originAWS EC2, Azure VM, Google Cloud ComputeInstance's IP or load balancer DNS name
Cloud storageAWS S3, Google Cloud StorageBucket's public URL
PaaS originHeroku, Render, RailwayApp's platform-provided domain
Serverless originAWS Lambda + API Gateway, VercelFunction endpoint URL
On-premise originCustomer's own data centerPublic IP or Cloudflare Tunnel (no open port needed)

Cloudflare Tunnel — When There's No Public IP

Traditionally, Cloudflare connects to an origin via its public IP on port 443. But what if the origin is behind a corporate firewall with no public IP? Cloudflare Tunnel (formerly Argo Tunnel) solves this — a lightweight agent runs on the origin and creates an outbound connection to Cloudflare. No inbound ports needed.

Cloudflare Tunnel — Origin Initiates Outbound Connection (No Exposed Ports)
Internet Users + attackers Cloudflare WAF + DDoS + Cache Traffic here outbound tunnel Origin No open inbound ports Behind firewall / NAT cloudflared agent running Origin never receives direct internet traffic · Zero open ports on origin Cloudflare holds all inbound connections

SSL Modes — How Cloudflare Connects to Origin

We covered this in Module 8, but it's worth summarising here as it's one of the most common customer configurations:

ModeUser → CFCF → OriginUse when
OffHTTP onlyHTTPNever — completely insecure
FlexibleHTTPS ✅HTTP ❌Avoid — origin traffic unencrypted. Only if origin has NO SSL at all.
FullHTTPS ✅HTTPS ✅ (any cert)Origin has HTTPS but self-signed cert
Full (Strict)HTTPS ✅HTTPS ✅ (valid cert)✅ Always use this in production. Origin cert must be valid (use Cloudflare Origin CA)
💡 The Golden Rule

Always use Full (Strict) in production. It's the only mode that ensures end-to-end encryption with verified certificates. Common support issue: customers set "Flexible" because their origin doesn't have a cert — but then traffic between Cloudflare and origin is unencrypted. Solution: issue a free Cloudflare Origin CA certificate and switch to Full (Strict).


Module 10 · Key Takeaways

Important to Remember

🔄 10.1 — Full Web Request Lifecycle
  • Full sequence: DNS → TCP handshake → TLS handshake → HTTP request → Cloudflare edge processing → origin (if cache miss) → response
  • Cache HIT: response served from Cloudflare PoP in ~5ms — origin never contacted
  • Cache MISS: Cloudflare forwards to origin via private backbone — not the public internet
  • Every response includes cf-ray header — unique request ID + PoP code
📐 10.2 — OSI Layers in Context
  • L7 = HTTP — WAF, Bot Mgmt, CDN, Rate Limiting, API Shield
  • L6 = TLS — Universal SSL, mTLS, TLS termination at edge
  • L4 = TCP/UDP — Spectrum, Magic Firewall
  • L3 = IP — Magic Transit, network DDoS protection
  • Gbps/Tbps attack = L3/L4. Requests/sec attack = L7. Different products for each.
☁️ 10.3 — Where Cloudflare Sits
  • Cloudflare = reverse proxy between internet and origin. Users see CF IP, origin sees CF IP.
  • Origin IP is hidden when proxied — attackers can't bypass Cloudflare by hitting origin directly
  • Cloudflare can block, cache, transform — but cannot fix bugs in origin code or protect unproxied records
🟠 10.4 — Proxied vs Non-Proxied
  • Orange cloud = proxied: WAF + DDoS + cache active, origin IP hidden, Anycast IP returned by DNS
  • Grey cloud = DNS only: real origin IP returned, traffic bypasses Cloudflare entirely
  • Email (MX, SMTP) must always be grey cloud — Cloudflare doesn't proxy email protocols
  • Confirm Cloudflare is in path: look for cf-ray header in response. No cf-ray = not proxied.
🖥️ 10.5 — Origin Server
  • Origin = customer's real server (own hardware, AWS EC2, Heroku, Lambda — any platform)
  • Cloudflare Tunnel = origin initiates outbound connection to CF — no open inbound ports needed. Best for firewalled origins.
  • Always use Full (Strict) SSL mode in production. Use Cloudflare Origin CA cert on origin — free, 15-year validity.
  • Flexible mode = CF→origin traffic unencrypted. Never use in production.
🎉 Phase 1 Complete — 10 Modules Done

You've completed the full networking, HTTP, DNS, TLS, and security foundation. Every concept from these 10 modules directly enables the Cloudflare product conversations in Phase 2.