Oddbean new post about | logout
 ** Linux Network Namespaces and Bridges: Understanding Containerization Fundamentals

Linux-based containerization relies heavily on network namespaces and bridges. Docker, a popular container runtime, utilizes these features to create isolated networks for processes. Understanding how to create network namespaces and bridges is crucial for effective containerization.

A network namespace allows a process to see only its own localhost (127.0.0.1) and interfaces connected to a bridge. A bridge acts as a virtual switch, enabling communication between namespaces and the outside world. To achieve this, you need to define variables for namespace names, vethernet (a wire-like connection between namespace interface and bridge), vpeer (namespace interfaces), IP addresses for each vpeer, and finally, the bridge itself.

Creating a bridge requires defining a variable, activating it, connecting vethernets, setting an IP address for the bridge, creating a default route to transfer packets through the bridge, and authorizing IP forwarding with a post-routing rule. This setup enables communication between namespaces and the outside world.

**

Source: https://dev.to/xavki/linux-how-to-create-network-namespaces-and-bridge-as-docker-does--pj0