Networking Foundation
This section covers computer networking theory, including the OSI model, TCP/IP, subnetting mathematics, routing protocols, and DNS resolution chains.
Overlay vs. Underlay Networks
In modern distributed systems, networking is often split into two distinct layers:
- The Underlay Network: This is the physical, tangible network. It consists of the actual ethernet cables, hardware switches, VLANs, MAC addresses, and physical router subnets (e.g.,
192.168.1.0/24). - The Overlay Network: This is a logical, virtual network built on top of the underlay. Software nodes participating in the overlay communicate as if they are on a shared, flat network (e.g.,
10.244.0.0/16), completely ignorant of the underlying physical topology.
Encapsulation in Action
When a node in an overlay network needs to send a packet to another node, it performs encapsulation.
For example, in a Kubernetes cluster using the Flannel CNI:
- Overlay Layer: Pod A (10.244.1.3) wants to send an HTTP GET request to Pod B (10.244.2.5).
- Encapsulation: Flannel intercepts the 10.244.x.x packet, wraps it entirely inside a standard 192.168.1.x packet, and sends it out the physical ethernet interface (enp4s0).
- Underlay Layer: The physical switch routes the packet based on the 192.168.x.x headers to the destination physical machine.
- Decapsulation: The destination machine receives the packet, strips away the 192.168.1.x wrapper, and delivers the inner 10.244.x.x packet to Pod B.