Network models and encapsulation
Networking is where many DevOps engineers are weakest, and interviewers know it. You need to follow a request from a browser to a pod and back, name the device and protocol at each hop, and know which tool proves where it breaks. This topic is the foundation for the rest of the networking section (IP addressing, TCP/UDP, the TCP handshake, TLS, DNS, HTTP): layers and encapsulation, switching and routing, NAT, load balancers and proxies, and AWS VPC networking in depth, finishing with a troubleshooting method.
OSI and TCP/IP
| OSI layer | Name | Unit | Examples | TCP/IP model |
|---|---|---|---|---|
| 7 | Application | Data | HTTP, DNS, SSH, SMTP, gRPC | Application |
| 6 | Presentation | Data | Encoding, TLS (often placed here) | Application |
| 5 | Session | Data | Sessions | Application |
| 4 | Transport | Segment / datagram | TCP, UDP, ports | Transport |
| 3 | Network | Packet | IP, ICMP, routing | Internet |
| 2 | Data link | Frame | Ethernet, MAC addresses, ARP, VLANs | Link |
| 1 | Physical | Bits | Cables, fibre, radio | Link |
Real networks follow the 4-layer TCP/IP model; the OSI numbers survive as vocabulary — "an L4 load balancer", "an L7 firewall", "a layer 2 problem".
Encapsulation
Each layer wraps the data from the layer above with its own header:
- Switches look at the Ethernet header (MAC addresses).
- Routers look at the IP header (IP addresses) and replace the Ethernet header at every hop.
- Firewalls and L4 load balancers look at IP + TCP/UDP headers (5-tuple: protocol, src IP, src port, dst IP, dst port).
- L7 load balancers and proxies terminate TCP/TLS and read the HTTP request.
Don't recite — walk a request
A strong interview answer explains the layers through an example. "A user opens https://shop.example.com":
- DNS (L7, over UDP 53): the browser resolves the name to an IP (cache → recursive resolver → root → TLD → authoritative).
- The OS picks a route: the destination isn't on the local subnet, so the packet goes to the default gateway. ARP finds the gateway's MAC address (L2).
- TCP handshake (L4) to port 443: SYN, SYN-ACK, ACK.
- TLS handshake: certificate verification, key agreement.
- HTTP request (L7) inside TLS.
- Along the way: home router NATs the private source IP to a public one; internet routers forward by IP; the request hits a CDN or an ALB, which terminates TLS, picks a target by path/host, and opens a connection to a pod/instance.
- The response retraces the path; the browser renders.
At each step you can name a debugging tool: dig (DNS), ip route/arp (local routing), nc/telnet (TCP), openssl s_client (TLS), curl -v (HTTP), traceroute/mtr (path), tcpdump (everything).