Skip to content

network_namespaces — network namespaces ​

Named Linux network namespaces in which outbounds and upstreams can open sockets.

yaml
network_namespaces:
  vpn:
    path: /run/netns/vpn
  lab:
    path: lab

The key is the name that the netns field of the dial block (dial: {netns: vpn}) and of an inbound's listener block (listener: {netns: vpn}: the inbound listens in this namespace) refers to.

FieldMeaning
pathThe path to the namespace file (/run/netns/vpn, /proc/<pid>/ns/net) or a name created by ip netns add (looked up in /var/run/netns)
typedefault (can be omitted). The unshare kind — create a new namespace — is not supported yet: a configuration with it does not load

netns in dial and listener accepts both a name from this section and a path or an ip netns name directly; the section is there to give a namespace a convenient name.

The namespace is checked when the outbound or inbound is built: if the process cannot enter it (no file or no permission; CAP_SYS_ADMIN is needed), loading ends with an error rather than silently opening sockets in its own namespace. A namespace that is declared but not used is not checked.

GPL-3.0-or-later