liveBook · Manning

Network namespace

As explained in Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more

A network namespace is a Linux namespace that provides an isolated view of network devices and network configuration.

A network namespace is a Linux isolation boundary that gives processes a separate view of network devices and configuration. It removes access to the host network while providing virtual network devices, helping containers operate as if they had distinct networking. section 1.2 section 10.5

Podman configures networking inside the namespace before starting the container process. Rootful containers use CNI plugins to configure networking devices; rootless containers cannot create devices or modify firewall rules, so slirp4netns provides user-mode networking through a TAP device and relays connections to the host. section 6.2.2 section 6.2.3

Isolating containers with Podman networks

Create private networks with podman network create net1 and net2, then start a container with --network net1. Another container on net1 can resolve and ping it by name, while containers in the default namespace or on net2 cannot. Use --net=host when a container must bind directly to host ports, accepting less network isolation. section 10.5

Figure 6.6 Podman creates a network namespace and launches slirp4netns to relay network connections.

Shows Podman creating a network namespace and launching slirp4netns to relay connections for rootless networking. section 6.2.3

How Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more covers it

How deep it goes
Explains virtual devices, rootless relaying, TAP devices, and network assignment, but does not detail firewall configuration.
Examples
Demonstrates net1 and net2, container-name resolution, cross-network ping failure, and the --net=host option.
What it assumes
Assumes Linux container and Podman basics while defining namespaces as virtualized resource views.
What you can do after
Operate/configure Podman networks that isolate containers or deliberately expose host networking.
How it connects
Connects Linux namespaces with Podman, virtual network devices, CNI plugins, slirp4netns, TAP devices, and host networking.

Also explained in

Compare how 2 books explain network namespace →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more. The section links point to the parts of the book it draws on.