gray and black laptop computer on surface

How Network Protocols Work: An Animated Guide to 48 Protocols

How network protocols work comes down to agreement: a protocol is a set of rules for which messages two machines send, in what order and in what format, so that software written by different people on different continents can still understand each other. Every page load, email and video call is a stack of these agreements, each one handling one job and handing the rest to the layer below.

This post is the hub for a 48-part series that takes one protocol at a time and shows it actually working, with original animated diagrams of each exchange and each header. Start here for the big picture, then jump to whichever protocol you need.

What a network protocol actually is

A protocol defines three things. The messages: what a SYN, a DNS query or an SMTP MAIL FROM looks like, down to the bit. The sequence: who speaks first, what reply is expected, and what happens if it doesn’t come. And the state each side keeps: a TCP connection is in SYN-SENT or ESTABLISHED, an SSH session is authenticated or not.

Most internet protocols are published as RFCs by the IETF, so anyone can read exactly how they’re supposed to work. Some are text you can type by hand (HTTP/1.1, SMTP, IMAP). Others are binary headers where every bit has a meaning (IP, TCP, DNS). This series shows you both, with the RFC numbers so you can check the details yourself.

Layers and encapsulation: how network protocols work together

No single protocol does everything. They’re stacked in layers, and each layer only deals with its own problem:

  • Link layer (Ethernet, Wi-Fi, ARP): moving a frame to the next device on the same network, using MAC addresses.
  • Internet layer (IPv4, IPv6, ICMP): moving packets across many networks to the right host, using IP addresses and routers.
  • Transport layer (TCP, UDP, QUIC): getting data to the right application on that host, using port numbers, and optionally making delivery reliable.
  • Application layer (HTTP, DNS, SMTP, SSH and most of this series): the actual conversation the user cares about.

You’ll also see the seven-layer OSI model, which splits things more finely (that’s where “layer 2” for switching and “layer 7” for applications come from). The four-layer TCP/IP model above is closer to how the internet is really built, and it’s the one this series uses.

The key idea is encapsulation. On the way out, each layer wraps whatever it was given from above in its own header. On the way in, each layer reads its own header, strips it off, and passes the rest up. Neither side’s browser ever sees an Ethernet header, and the switch in the middle never looks at HTTP.

A web request going down the stack and back upThe browser hands an HTTP request to the operating system. The OS adds a TCP header, an IP header and an Ethernet header, and sends the frame onto the wire addressed to the next hop's MAC address. The frame reaches the server, whose OS strips the headers one by one and passes the HTTP request to the web server. The response comes back the same way: wrapped by the server's OS, carried over the wire, unwrapped by the client's OS, and handed to the browser as 200 OK with the HTML.BrowserOSWireServerHTTP request+TCP +IP +EthFrame Eth|IP|TCPFrame dst MACstrip headersResponse 200 OKFrame Eth|IP|TCPstrip headers200 OK HTML
Each layer wraps the data in its own header on the way down and strips it off on the way up, so every layer only talks to its counterpart.
  1. The browser hands an HTTP request to the operating system through a socket. It doesn’t know or care how it’ll be delivered.
  2. The OS adds a TCP header (ports, sequence numbers), then an IP header (source and destination addresses), then an Ethernet header (the next hop’s MAC address).
  3. The finished frame goes onto the wire, addressed to the next device in the path: on a home network that’s your router, which re-wraps the packet in a new frame for each link it crosses.
  4. At the server, the OS strips the Ethernet, IP and TCP headers in turn and hands the HTTP request to the web server.
  5. The response travels back the same way, wrapped by the server and unwrapped by your machine, until the browser gets its 200 OK.

A typical 1,500-byte Ethernet payload carrying a web page therefore holds a 20-byte IPv4 header, a 20 to 60-byte TCP header and the HTTP data; the 14-byte Ethernet header and 4-byte checksum sit around the outside. Those headers are exactly what the header diagrams in each post lay out.

One page load, four protocols

Layers explain the wrapping. Time explains the order. Before a browser can show https://example.com, several protocols have to run one after another:

Four protocols in one page loadThe client asks its DNS resolver for the A record of example.com and gets 203.0.113.10. It opens a TCP connection to port 443 with SYN, SYN-ACK and ACK. It starts TLS with a ClientHello, and the server answers with ServerHello, its certificate and Finished. The client sends its own Finished, then the encrypted HTTP GET request, and receives the encrypted 200 OK.ClientDNS resolverWeb serverDNS query A example.comDNS answer 203.0.113.10SYN port 443SYN-ACKACKClientHello TLS 1.3ServerHello cert, FinishedFinishedGET / encrypted200 OK encrypted
Opening https://example.com takes a DNS lookup, a TCP handshake and a TLS handshake before the first HTTP request is sent.
  1. DNS turns the name into an address: 203.0.113.10.
  2. TCP opens a connection to port 443 with the three-way handshake.
  3. TLS agrees encryption keys and checks the server’s certificate.
  4. HTTP finally sends the request and gets the page, encrypted inside TLS.

Underneath all four, ARP found the router’s MAC address and DHCP gave your machine its IP address in the first place. When a site “won’t load”, the useful question is which of these steps failed, and a packet capture answers it in seconds.

How to use this series

Each post follows the same shape, so once you’ve read one you know where to find things in the others:

  • At a glance: the layer, transport, ports, the defining RFCs and what it’s used for.
  • Step by step: an animated sequence diagram of the exchange, with a numbered walk-through of exactly what it shows.
  • Inside the packet: a header diagram where the protocol has a fixed binary layout, plus a realistic example from tcpdump, dig, curl or a raw transcript.
  • See it on your own network: the Wireshark display filters, tcpdump filters and client commands to watch it happen yourself.
  • What goes wrong: the common failures, what they look like in a capture or an error message, and the security issues that matter.

The examples use the documentation address ranges (192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 and 2001:db8::/32) and example.com, so nothing points at a real system. To follow along you only need Wireshark or tcpdump. If you’re new to capturing, Wireshark on Kali Linux covers the basics, and Linux commands for networking is a handy reference for the client tools. For watching protocols at scale rather than one packet at a time, Zeek turns traffic into logs of DNS queries, HTTP requests and TLS handshakes.

If you’re new to networking, read Transport, then Naming, then Web, in that order: TCP, UDP, DNS, TLS and HTTP between them explain most of what happens when you use the internet. After that, dip into whatever you need.

Protocol Explorer: the interactive companion

Protocol Explorer is an interactive simulator that runs in the browser. It animates protocols packet by packet, has a byte-level decoder that shows which bytes make up each header field, and an exam mode for testing yourself. Each post here links to the matching lesson. The HTTP and HTTPS lessons are free, and the rest come with a one-time unlock. The posts stand on their own; the simulator is there if you want to poke at the packets yourself.

The full series index

All 48 posts, grouped by layer. Posts go live on a regular schedule, and each entry here becomes a link as its post is published.

Link and access: getting frames onto a cable or radio and getting a device onto a network.

  • The Ethernet frame: the frame format every wired LAN uses: MAC addresses, EtherType, VLAN tags and the FCS.
  • How Wi-Fi works: how a device scans, authenticates and associates with an access point, and how 802.11 frames differ from Ethernet.
  • WPA3 explained: the SAE handshake that replaced WPA2’s pre-shared key, and why offline password cracking stops working.
  • How ARP works: how a host finds the MAC address behind an IPv4 address, the neighbour cache, and ARP spoofing.
  • PPPoE explained: how DSL and fibre connections wrap PPP sessions in Ethernet, and why the MTU drops to 1492.
  • How captive portals work: how hotel and café Wi-Fi intercepts your first web request and sends you to a login page.

Internet: addressing and routing packets between networks.

  • The IPv4 header: the IPv4 header field by field: TTL, fragmentation, protocol numbers and the checksum.
  • IPv6 explained: 128-bit addresses, the simpler fixed header, extension headers and SLAAC.
  • ICMP, ping and traceroute: echo requests, destination unreachable and time exceeded, and how ping and traceroute use them.
  • How NAT works: how your router rewrites addresses and ports so a whole household shares one public IP.
  • How BGP works: how networks announce routes to each other, path attributes, and what happens in a route leak.
  • IGMP and multicast: how hosts join and leave multicast groups, and how switches use IGMP snooping.

Transport: getting data between applications, reliably or quickly.

  • TCP three-way handshake: SYN, SYN-ACK and ACK, sequence numbers, connection states and SYN floods.
  • TCP vs UDP: connections against datagrams, the 8-byte UDP header, and what packet loss does to each.
  • QUIC and HTTP/3: reliable, encrypted streams over UDP, connection IDs, 1-RTT setup and how HTTP/3 uses them.

Naming and addressing: finding hosts by name and getting an address in the first place.

  • How DNS works: recursive resolvers, root and TLD referrals, caching, and the DNS header.
  • DHCP and the DORA process: Discover, Offer, Request and Acknowledge: how a device gets its IP address, gateway and DNS servers.
  • mDNS and Bonjour: multicast DNS and service discovery: how printers and speakers find each other with no DNS server.
  • DNS over HTTPS: DNS queries sent as HTTPS requests, what that hides, and how it affects network filtering.

Web: the protocols behind every page load.

  • How HTTP works: requests, responses, headers, status codes, keep-alive, caching and redirects.
  • TLS handshake explained: TLS 1.3 message by message: key shares, certificates, Finished, and how TLS 1.2 differs.
  • HTTP vs HTTPS: what TLS hides and what it doesn’t, ports 80 and 443, redirects and HSTS.
  • How WebSockets work: the HTTP upgrade, WebSocket framing and masking, and keeping a two-way connection open.

Email: sending, relaying and collecting mail.

  • How SMTP works: the SMTP conversation from EHLO to QUIT, relays, STARTTLS and where SPF and DKIM fit.
  • The IMAP protocol: folders, flags and IDLE: how mail clients keep a mailbox in sync on the server.
  • POP3 vs IMAP: downloading mail against syncing it, and which one to use.

Files and remote access: moving files and logging in to other machines.

  • FTP active vs passive mode: the separate control and data connections, and why passive mode exists.
  • The Telnet protocol: the original remote terminal protocol, option negotiation, and why it sends passwords in clear.
  • How SSH works: key exchange, host keys, user authentication and channels in an SSH session.
  • The SMB protocol: Windows file sharing: negotiation, sessions, tree connects and SMB signing.
  • The TFTP protocol: the tiny UDP file transfer protocol network boots and switches still rely on.

Proxies and VPNs: putting something in the middle, on purpose.

  • Forward proxies: how a client sends its requests through a proxy, including the HTTP CONNECT method.
  • Reverse proxies: load balancing, TLS termination and caching in front of web servers.
  • SOCKS5 proxies: the SOCKS5 handshake, authentication and how it relays any TCP connection.
  • How WireGuard works: the Noise handshake, cryptokey routing and why WireGuard is so small.
  • IPsec explained: IKEv2, ESP, tunnel and transport mode: the standard site-to-site VPN.

Real-time and media: voice, video and live streaming.

  • How WebRTC works: signalling, ICE candidates, STUN and TURN, and DTLS-SRTP between browsers.
  • The SIP protocol: INVITE, 180 Ringing, 200 OK and ACK: how VoIP calls are set up and torn down.
  • The RTSP protocol: DESCRIBE, SETUP and PLAY: how IP cameras stream video.
  • The RTMP protocol: the handshake and chunk streams behind live streaming ingest.

Management and identity: keeping time, watching devices and proving who users are.

  • How NTP works: how NTP measures offset and delay with four timestamps, and stratum levels.
  • SNMP explained: GET, SET and traps, OIDs and MIBs, and why community strings are a weakness.
  • RADIUS and 802.1X: port-based network access: EAP over LAN, the authenticator and the RADIUS server.
  • LDAP explained: directory lookups: binds, search filters, distinguished names and LDAPS.
  • How Kerberos works: tickets, the KDC, TGTs and service tickets, and attacks like Kerberoasting.

IoT and industrial: small devices and factory floors.

  • The MQTT protocol: publish and subscribe through a broker, topics, QoS levels and retained messages.
  • The Modbus protocol: function codes, registers and coils: the decades-old protocol still running industrial kit.

Leave a Reply