Leanpub Header

Skip to main content

Internet Protocols from First Principles

How Computers Communicate Across the World

Internet Protocols from First Principles
This book is 100% completeLast updated on 2026-10-01

What really happens when you open a website, send a message or connect to a server across the world? This book builds the Internet from first principles, revealing how bits become packets, packets cross networks and protocols make it all work. Learn the machinery behind the Internet by understanding why each piece exists and how it fits together.

Minimum price

$19.00

$29.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
WEB
APP
262
Pages
About

About

About the Book

This book takes you from zero networking knowledge to expert-level understanding of how the Internet actually works. Beginning with the fundamental problem of communication between computers, we derive every concept logically: signals and bits, encoding and packets, frames and links, addressing and routing, reliability and congestion, encryption and naming. Each protocol is explained in depth, why it exists, what problem it solves, how it works internally and what trade-offs its designers made. You will learn to read packet captures, trace connections end to end through autonomous systems, implement networking components from scratch and debug real network problems. No prior networking knowledge is assumed. Only curiosity and a willingness to understand the machinery beneath the surface.

Bundle

Bundles that include this book

Author

About the Author

Steve Publications

Steve is a technology professional with more than 20 years of experience spanning software development, server infrastructure, cybersecurity, vulnerability research and reverse engineering. His work focuses on understanding complex systems, uncovering security weaknesses and developing practical solutions that make technology more secure, reliable and effective.

Through Steve Publications, he collaborates with experienced researchers, engineers and industry experts to create practical, technically rigorous books on various topics not limited to self-improvement, software development, cybersecurity, cloud computing, DevOps, artificial intelligence and enterprise technologies. His mission is to make complex technical subjects accessible through clear explanations, real-world examples and hands-on exercises that help IT professionals, students and technology enthusiasts build valuable, practical skills.

Steve Publications embraces AI as a supporting tool for translation, proofreading and editorial refinement, not as a substitute for original research, technical expertise, or hands-on experience. Some contributors choose to publish under pseudonyms to protect their privacy or maintain professional boundaries.

Behind every book is a commitment to technical accuracy, practical relevance and continuous improvement. Our publications are written, reviewed and maintained by experienced professionals, with support from a private community of more than 420 engineers and researchers. Rather than prioritizing volume or mass-produced AI-generated content, we focus on delivering reliable, useful resources that readers can apply in real-world environments.

We also welcome experienced professionals who want to share their knowledge by writing or reviewing books, particularly in specialized and emerging technology fields. If you have expertise to contribute, we invite you to get in touch and explore opportunities to collaborate.

Our commitment is simple: To deliver books that respect our readers' time, support their professional growth and provide lasting practical value. If a book does not meet your expectations, Leanpub offers a 60-day money-back guarantee.

Contents

Table of Contents

How Computers Communicate Across the World

Introduction

Chapter 1: The Problem of Communication

  1. Why Computers Need to Talk
  2. From Electricity to Information
  3. Signals, Noise and Reliability
  4. Digital Representation: Bits and Bytes
  5. Synchronization and Clocks
  6. The First Networks

Chapter 2: Encoding Data for Transmission

  1. Line Coding: Voltage Levels and Bit Patterns
  2. Serial vs Parallel Transmission
  3. Start Bits, Stop Bits and Framing Signals
  4. Clock Recovery and Timing
  5. Error Detection with Parity and CRC
  6. Modulation for Wireless Media

Chapter 3: Links, Frames and the First Layer

  1. What Is a Link
  2. The Frame Structure
  3. Physical Addresses (MAC)
  4. Collision Detection and Avoidance
  5. Switching vs Broadcasting
  6. Why We Need Layers

Chapter 4: Ethernet in Detail

  1. Ethernet History and Design Philosophy
  2. Frame Format Field by Field
  3. MAC Address Structure and Assignment
  4. CSMA/CD: How Classic Ethernet Worked
  5. Switched Ethernet and Learning Bridges
  6. VLANs and Tagged Frames
  7. Gigabit Ethernet and Beyond

Chapter 5: Layered Architectures

  1. The Abstraction Problem in Large Systems
  2. Encapsulation: Wrapping Data in Headers
  3. The OSI Model: Seven Layers Explained
  4. The Internet Protocol Stack: Four Layers That Work
  5. Interface Contracts Between Layers
  6. Why Layering Matters for the Internet

Chapter 6: IPv4, Design and Structure

  1. From Local Networks to a Network of Networks
  2. The End-to-End Design Philosophy
  3. IPv4 Address Format and Classes (Historical)
  4. Packet Header Field by Field
  5. Time to Live and Loop Prevention
  6. Fragmentation and Reassembly
  7. IP as an Unreliable Best-Effort Protocol

Chapter 7: Subnetting, CIDR and Address Allocation

  1. The Classful System and Its Failure
  2. Subnet Masks and Network Prefixes
  3. CIDR Notation and Aggregation
  4. Variable-Length Subnet Masking (VLSM)
  5. Worked Subnetting Examples
  6. Global Address Allocation Hierarchy

Chapter 8: IPv6, Modern Internet Protocol

  1. Running Out of Addresses
  2. IPv6 Design Goals
  3. The Simplified Header Format
  4. Address Types and Formats
  5. Stateless Address Autoconfiguration (SLAAC)
  6. Neighbor Discovery Protocol
  7. Transition Mechanisms: Dual Stack and Tunneling

Chapter 9: ARP and Link-Layer Address Resolution

  1. The Address Mapping Problem
  2. ARP Request and Reply Format
  3. ARP Cache Management
  4. Gratuitous ARP
  5. ARP Spoofing Attacks
  6. IPv6 Neighbor Discovery

Chapter 10: Routing Fundamentals

  1. What a Router Does
  2. Forwarding Tables and Longest Prefix Match
  3. Default Routes
  4. Routing vs Forwarding: Control Plane and Data Plane
  5. Static Routing
  6. Dynamic Routing Motivation

Chapter 11: Interior Gateway Protocols, RIP, OSPF, IS-IS

  1. Autonomous Systems Explained
  2. Distance-Vector Routing: RIP
  3. The Count-to-Infinity Problem
  4. Link-State Routing: OSPF
  5. Dijkstra’s Algorithm in Practice
  6. IS-IS: The Telecom Alternative
  7. Route Summarization and Hierarchy

Chapter 12: Border Gateway Protocol (BGP)

  1. Why We Need an Exterior Gateway Protocol
  2. Path-Vector Routing Concept
  3. BGP Peering and Sessions
  4. BGP Attributes: AS_PATH, NEXT_HOP, LOCAL_PREF
  5. The Route Selection Algorithm
  6. Route Hijacking and Security
  7. BGP at Internet Scale

Chapter 13: ICMP, Diagnostics and Error Reporting

  1. Why IP Needs a Signaling Protocol
  2. ICMP Message Types and Codes
  3. Echo Request and Reply: How Ping Works
  4. Time Exceeded: How Traceroute Works
  5. Destination Unreachable Messages
  6. ICMP Rate Limiting and Security

Chapter 14: DHCP, Dynamic Address Assignment

  1. The Configuration Problem
  2. The DORA Process: Discover, Offer, Request, Acknowledge
  3. DHCP Message Format and Options
  4. Lease Renewal and Release
  5. DHCP Relay Agents
  6. DHCPv6 and SLAAC Interaction

Chapter 15: DNS, The Internet’s Naming System

  1. Why We Need Names Instead of Numbers
  2. The Hierarchical Namespace
  3. Domain Name Structure and Labels
  4. Record Types: A, AAAA, CNAME, MX, TXT, SRV
  5. The Resolution Process Step by Step
  6. Recursive Resolvers and Root Servers
  7. DNS Caching and TTL
  8. DNSSEC: Authenticating Responses

Chapter 16: UDP, Simple Transport

  1. Why We Need a Transport Layer
  2. Ports as Process Identifiers
  3. The UDP Header Format
  4. Checksums in UDP
  5. When to Use UDP
  6. DNS over UDP Walkthrough

Chapter 17: TCP, Reliable Stream Transport (Part 1)

  1. The Reliability Problem
  2. Byte Streams vs Datagrams
  3. Sequence Numbers and Acknowledgments
  4. The Three-Way Handshake
  5. Connection Teardown: Four-Way Wave
  6. The TCP State Machine
  7. Retransmission Timeouts

Chapter 18: TCP, Reliable Stream Transport (Part 2)

  1. Flow Control with Sliding Windows
  2. Advertised Window and Zero Window
  3. Congestion: Why Networks Slow Down
  4. Congestion Avoidance Algorithms
  5. TCP Reno and AIMD
  6. Modern Algorithms: CUBIC and BBR
  7. Nagle’s Algorithm and Delayed ACKs

Chapter 19: QUIC, Transport for the Modern Web

  1. Problems with TCP + TLS + HTTP/2
  2. QUIC Design Goals
  3. Running on UDP: Why It Works
  4. The QUIC Connection Establishment
  5. Multiplexed Streams Without Blocking
  6. Connection Migration and Resumption
  7. Security Properties of QUIC

Chapter 20: TLS, Encrypted Communication

  1. The Eavesdropping and Spoofing Problem
  2. Symmetric vs Asymmetric Cryptography (Briefly)
  3. The TLS Handshake Protocol
  4. Certificate Chains and Trust Anchors
  5. Perfect Forward Secrecy
  6. TLS 1.3: Faster and Safer
  7. Common TLS Attacks and Mitigations

Chapter 21: HTTP Family, From 1.1 to HTTP/3

  1. The Request-Response Model
  2. HTTP Methods and Status Codes
  3. Headers, Bodies and Content Negotiation
  4. HTTP/1.1: Persistent Connections and Limitations
  5. HTTP/2: Binary Framing and Multiplexing
  6. HTTP/3: HTTP over QUIC
  7. End-to-End HTTP Transaction Walkthrough

Chapter 22: WebSockets and Persistent Connections

  1. The Limitation of Request-Response
  2. WebSocket Handshake Protocol
  3. Frame Format and Control Frames
  4. When to Use WebSockets
  5. Server-Sent Events as an Alternative
  6. Brief Look at WebRTC Signaling

Chapter 23: NAT, Network Address Translation

  1. The Address Exhaustion Crisis
  2. Private Address Spaces (RFC 1918)
  3. How NAT Works: Translation Tables
  4. Types of NAT: Full Cone, Restricted, Symmetric
  5. Port Forwarding and DMZ
  6. Why NAT Breaks End-to-End
  7. NAT Traversal Techniques

Chapter 24: Firewalls, Middleboxes and Traffic Control

  1. What Is a Firewall
  2. Packet Filtering Rules
  3. Stateful Inspection
  4. Deep Packet Inspection (DPI)
  5. Quality of Service Marking
  6. Rate Limiting and Traffic Shaping
  7. The Middlebox Problem

Chapter 25: Content Delivery Networks and Load Balancers

  1. The Problem of Scale
  2. Load Balancing Fundamentals
  3. Layer 4 Load Balancing with NAT
  4. Layer 7 Load Balancing and HTTP
  5. Content Delivery Networks (CDNs)
  6. Anycast Routing for CDNs
  7. Reverse Proxies
  8. Edge Computing and Serverless at the CDN

Chapter 26: Multicast and Anycast Delivery Models

  1. Unicast, Broadcast, Multicast, Anycast
  2. IP Multicast Fundamentals
  3. Multicast Routing Protocols
  4. Multicast in Practice
  5. Anycast in Depth
  6. Comparing Delivery Models

Chapter 27: VPNs, Tunneling and Overlay Networks

  1. The Need for Private Networks Over Public Infrastructure
  2. Tunneling Fundamentals
  3. IPsec, The Internet Protocol Security Suite
  4. WireGuard, A Modern VPN Protocol
  5. Site-to-Site VPNs
  6. Overlay Networks in Data Centers
  7. Comparing VPN Technologies

Chapter 28: Operating System Networking Internals

  1. The Kernel as Network Participant
  2. Socket API: The User-Kernel Interface
  3. The Linux Networking Stack: sk_buff and Netfilter
  4. Interrupts, DMA and NIC Processing
  5. Connection Tracking and State Management
  6. Routing Tables and Policy Routing
  7. Memory Pressure and Packet Drops

Chapter 29: Practical Network Investigation Tools

  1. The Philosophy of Network Debugging
  2. ping, ICMP Echo and Reachability Testing
  3. traceroute, Path Discovery
  4. ip and ss, Interface and Socket Inspection
  5. dig, DNS Investigation
  6. curl, HTTP Client and Protocol Testing
  7. tcpdump and Wireshark, Packet Capture and Analysis
  8. Systematic Debugging Workflow

Chapter 30: Building a User-Space Networking Stack (Educational Implementation)

  1. Why Implement Protocols from Scratch
  2. Packet Parsing and Serialization
  3. Implementing ARP
  4. A Minimal UDP Implementation
  5. Simplified TCP State Machine
  6. Putting It Together: A Minimal Stack Architecture

Chapter 31: Data Center and Cloud Networking

  1. Scale Challenges in Modern Data Centers
  2. Spine-Leaf Architecture
  3. Overlay Networking in Data Centers
  4. Kubernetes Networking Model
  5. Cloud Provider Networking
  6. High-Performance Networking in Data Centers

Chapter 32: Advanced Topics, SDN, P4, eBPF and Modern Architecture

  1. Software-Defined Networking (SDN)
  2. P4, Programming Protocol-Independent Packet Processors
  3. eBPF, Programmable Kernel Networking
  4. MPLS, Multi-Protocol Label Switching
  5. Zero Trust Networking
  6. Observability in Modern Networks
  7. The Evolving Internet Architecture

Chapter 33: End-to-End Case Studies

  1. Case Study 1: Opening a Website from a Fresh Machine
  2. Case Study 2: Traversing Autonomous Systems via BGP
  3. Case Study 3: Reaching Cloud Infrastructure Through Load Balancers
  4. Case Study 4: Failure Modes and Recovery

Chapter 34: Protocol Design Principles and a Unified Mental Model

  1. What Makes a Good Protocol
  2. Trade-offs Everywhere
  3. A Unified Mental Model
  4. Engineering at Internet Scale
  5. Continuing Evolution

Conclusion

References

  1. Core IP and Routing RFCs
  2. Link Layer and Local Network RFCs
  3. Transport and Security RFCs
  4. Application Layer RFCs
  5. IPsec, VPNs and Tunneling RFCs
  6. Multicast and Anycast RFCs
  7. ICMP and Diagnostics RFCs
  8. Additional Authoritative Sources

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub