Skip to content
Tutorials Center
My learning

Topics

Lesson 21 of 37 ยท Networking

Rootless Networking with pasta

How rootless Podman gives containers a network without root: pasta and slirp4netns, port forwarding, source IP behavior, performance, host access and when to pick each mode.

When Podman runs as root it can create bridges and firewall rules directly. A rootless Podman cannot: creating network interfaces on the host is a privileged act. Instead, it builds the container's network in user space, with a helper program that copies packets between the container's private namespace and the real network using ordinary sockets.

Two helpers exist: pasta (the default since Podman 5.0) and slirp4netns (the older default). This lesson explains how they work, what each means for your containers, and how to choose.

What changes for rootless containers

Rootless containers have no access to the host bridge. Compared with rootful containers:

  • Each container gets a private network namespace with a tap device, wired to the helper.
  • Outbound connections work: the helper opens sockets on the host on behalf of the container.
  • Published ports (-p) work: the helper listens on the host and forwards.
  • Ports below 1024 need the sysctl change described in Publishing Ports and Name Resolution.
  • Networks you create with podman network create still exist (Netavark and Aardvark DNS are used in rootless mode too) but the user-space helper sits between the bridge namespace and the host.

Rootless packet path

Container Private network namespace.
Helper pasta copies packets to sockets.
Host Sees ordinary connections.
Internet Sees the host's address.

No root, no host bridge needed.

1 / 2

pasta

pasta (from the passt project) does not implement a whole TCP/IP stack of its own. It translates traffic between the tap interface in the container and native sockets on the host, so it is fast and light. Key behaviors:

  • Real source addresses. With pasta, a service in the container can see the true client IP of incoming connections, because the connection is forwarded rather than re-originated. This matters for logs, rate limiting and allow lists.
  • The container copies host addressing. By default the container gets the same IP address, gateway and DNS as a host interface (the one with the default route) and sees the same name servers.
  • Good throughput, noticeably better than slirp4netns for large transfers.
  • IPv6 works when the host has it.

You select it per container or as a default:

Terminal
podman run --rm --network pasta docker.io/library/alpine:3 ip addr
podman run --rm --network pasta:--map-gw docker.io/library/alpine:3 ip route

Options go after a colon. A frequently used one is --map-gw, which makes the gateway address reach the host. To change the default for every container, set it in ~/.config/containers/containers.conf:

TOML
[network]
default_rootless_network_cmd = "pasta"

slirp4netns

slirp4netns implements a small TCP/IP stack in user space. It works almost everywhere, including on systems where pasta is not packaged, but:

  • Incoming connections appear to come from the helper's address, so the client IP is lost unless you use its port_handler=slirp4netns option.
  • It is slower for heavy traffic because it re-implements the network stack.
  • The container sees a fixed private subnet (10.0.2.0/24) and reaches the host at 10.0.2.2 rather than getting the host's address.
Terminal
podman run --rm --network slirp4netns:port_handler=slirp4netns -p 8080:80 docker.io/library/nginx:stable

Reaching services on the host

From a rootless container, use host.containers.internal for the host. A server on the host that listens only on 127.0.0.1 is, by default, not reachable that way with every mode; bind it to an address the container can reach, or use --network pasta:--map-gw and the gateway address. If one mode does not work, try the other; they differ here.

Choosing between them

Python Which rootless mode? (stand-in)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Privileged ports, once more

Whatever the helper, the kernel decides who may listen below port 1024. Check the current limit and see whether a mapping is allowed.

Python Can I publish this port? (stand-in)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Lowering the limit applies to every user on the machine, not just Podman. For a single exposed service, a high port plus a reverse proxy or a firewall redirect is the more conservative design.

Checking what you are using

Terminal
podman info --format '{{.Host.RootlessNetworkCmd}}'

This prints the rootless network command (pasta or slirp4netns). Inside a container, ip addr and ip route show whether it has the host's address (pasta) or 10.0.2.x (slirp4netns).

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which rootless network helper is the default since Podman 5.0?

    Podman 5 switched the default rootless network command from slirp4netns to pasta.
  2. 2. What is a practical advantage of pasta over slirp4netns?

    pasta forwards connections instead of re-originating them, so source addresses are preserved, and it avoids a full user-space TCP/IP stack.
  3. 3. Why can't a rootless container publish host port 443 by default?

    Linux's default unprivileged port start is 1024. Lower it with the sysctl or publish a higher port.
  4. 4. Where do you set a default rootless network helper for all containers?

    default_rootless_network_cmd in containers.conf selects pasta or slirp4netns for every rootless container.

Summary

  • Rootless Podman cannot create host bridges, so a user-space helper moves packets.
  • pasta (default since Podman 5) preserves client IPs, is fast and mirrors the host's addressing.
  • slirp4netns is the older helper: slower, fixed 10.0.2.0/24 addressing, source IP lost unless configured.
  • Select a helper with --network pasta or --network slirp4netns, or set default_rootless_network_cmd.
  • Privileged ports need a high port, a proxy, or the ip_unprivileged_port_start sysctl.

Next: Troubleshooting Podman Networking