Opscraft
Networking fundamentals · Lesson 1 of 9 · 4 min read

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".

Enlarge diagramLayerProtocolsRead byApplication · OSI 5-7HTTP, DNS, SSH, TLS, gRPCproxies, ALB, WAFTransport · OSI 4TCP, UDP and portsfirewalls, security groups, NLBInternet · OSI 3IP, ICMP, routingrouters, NAT gatewaysLink · OSI 1-2Ethernet, MAC addresses, ARPswitches
Figure 1. The four TCP/IP layers, with their OSI numbers, the protocols that live there, and which devices read each layer.
Swipe sideways to see all of it, or tap to open it full screen.

Encapsulation

Each layer wraps the data from the layer above with its own header:

Enlarge diagramETHERNET FRAME · MAC ADDRESSES (L2)IP PACKET · IP ADDRESSES (L3)TCP SEGMENT · PORTS (L4)TLS RECORD · ENCRYPTIONHTTP request: GET /productsswitches read MACsrouters read IPsfirewalls and NLB read IPs + portsALB and proxies read HTTP
Figure 2. Encapsulation: each layer wraps the one above in its own header, like envelopes inside envelopes. Each device opens only the envelopes it needs.
Swipe sideways to see all of it, or tap to open it full screen.
  • 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":

  1. DNS (L7, over UDP 53): the browser resolves the name to an IP (cache → recursive resolver → root → TLD → authoritative).
  2. 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).
  3. TCP handshake (L4) to port 443: SYN, SYN-ACK, ACK.
  4. TLS handshake: certificate verification, key agreement.
  5. HTTP request (L7) inside TLS.
  6. 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.
  7. 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).

Enlarge diagram1. DNS lookupdig +short shop.example.com2. Route to the gateway (ARP)ip route get 203.0.113.10, ip neigh3. TCP handshake to :443nc -zv shop.example.com 4434. TLS handshakeopenssl s_client -connect shop.example.com:4435. HTTP requestcurl -v https://shop.example.com/The path and the packetsmtr, traceroute -T, tcpdump
Figure 3. Walking one request down the layers, with the tool that proves each step works.
Swipe sideways to see all of it, or tap to open it full screen.