Virtual Networking
Overview
Containers use Linux virtual networking to create isolated network stacks. Typical building blocks are veth pairs, bridges, and NAT.
Core Components
Network namespaces separate interfaces, routes, and ports per container.
veth pairs connect a container namespace to the host.
Linux bridge or ip routing ties multiple containers together.
Netfilter/iptables provides NAT and port forwarding.
Common Topologies
Bridge mode: containers share a virtual bridge with NAT to the host. Host mode: container uses the host network namespace (no isolation). MACVLAN: containers appear as separate MACs on the LAN.
Example (Conceptual)
Create a veth pair, move one end into the container namespace, attach the other to a bridge.