podman icon indicating copy to clipboard operation
podman copied to clipboard

Container can't connect to VPN if I don't use `Network=pasta:[OPTIONS]`

Open dozenposture opened this issue 1 year ago • 10 comments

Issue Description

I used to have a container that connects to a VPN (Wireguard). To achieve this, the container had to be attached to a custom network or have the following settings: Network=pasta:--ipv4-only,-a,10.0.2.0,-n,24,-g,10.0.2.2,--dns-forward,10.0.2.3,-m,1500,--no-ndp,--no-dhcpv6,--no-dhcp. It's important for me to have that container attached to my custom network as it needs to communicate to other containers. Since yesterday, this container does not connect to the VPN anymore if not with those pasta settings (but then the container can't communicate with other containers...)

From inside the container, I see the wg0 interface and the IPs private/public that are defined in the Wireguard config file.

At the beginning I thought that the last podman/passt updates were the issues but I rolled back my system and I have that issue since then.

Any idea?

Steps to reproduce the issue

Steps to reproduce the issue

  1. Deploy custom network
  2. Deploy this container and attach it to the custom network
  3. Verify missing VPN connectivity

Describe the results you received

Container can't connect to VPN if not with Network=pasta:--ipv4-only,-a,10.0.2.0,-n,24,-g,10.0.2.2,--dns-forward,10.0.2.3,-m,1500,--no-ndp,--no-dhcpv6,--no-dhcp.

Describe the results you expected

Container should connect to VPN as it used to be

podman info output

podman@host:~> podman info
host:
  arch: amd64
  buildahVersion: 1.40.0
  cgroupControllers:
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.13-1.2.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.13, commit: unknown'
  cpuUtilization:
    idlePercent: 87.05
    systemPercent: 6.31
    userPercent: 6.64
  cpus: 4
  databaseBackend: sqlite
  distribution:
    distribution: opensuse-tumbleweed
    version: "20250604"
  eventLogger: journald
  freeLocks: 2015
  hostname: host
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1002
      size: 1
    - container_id: 1
      host_id: 231072
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1002
      size: 1
    - container_id: 1
      host_id: 231072
      size: 65536
  kernel: 6.15.0-1-default
  linkmode: dynamic
  logDriver: journald
  memFree: 276815872
  memTotal: 7983173632
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns-1.15.0-1.1.x86_64
      path: /usr/libexec/podman/aardvark-dns
      version: aardvark-dns 1.15.0
    package: netavark-1.15.0-1.1.x86_64
    path: /usr/libexec/podman/netavark
    version: netavark 1.15.0
  ociRuntime:
    name: crun
    package: crun-1.21-1.1.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.21
      commit: 10269840aa07fb7e6b7e1acff6198692d8ff5c88
      rundir: /run/user/1002/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL
  os: linux
  pasta:
    executable: /usr/bin/pasta
    package: passt-20250512.8ec1341-1.1.x86_64
    version: ""
  remoteSocket:
    exists: true
    path: /run/user/1002/podman/podman.sock
  rootlessNetworkCmd: pasta
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: false
  slirp4netns:
    executable: ""
    package: ""
    version: ""
  swapFree: 6994083840
  swapTotal: 7983169536
  uptime: 1h 18m 27.00s (Approximately 0.04 days)
  variant: ""
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - registry.opensuse.org
  - registry.suse.com
  - docker.io
store:
  configFile: /home/podman/.config/containers/storage.conf
  containerStore:
    number: 28
    paused: 0
    running: 28
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/podman/.local/share/containers/storage
  graphRootAllocated: 255522574336
  graphRootUsed: 52043845632
  graphStatus:
    Backing Filesystem: btrfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Supports shifting: "false"
    Supports volatile: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 26
  runRoot: /run/user/1002/containers
  transientStore: false
  volumePath: /home/podman/.local/share/containers/storage/volumes
version:
  APIVersion: 5.5.0
  Built: 1747285822
  BuiltTime: Thu May 15 07:10:22 2025
  GitCommit: ""
  GoVersion: go1.24.3
  Os: linux
  OsArch: linux/amd64
  Version: 5.5.0

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

Yes

Additional environment details

Additional environment details

Additional information

Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting

dozenposture avatar Jun 24 '25 09:06 dozenposture

  • Deploy custom network

  • Deploy this container and attach it to the custom network

  • Verify missing VPN connectivity

This isn't particular helpful. We need to know exact ip address/routes on the host and container (or in case of using the custom networks inside podman unshare --rootless-netns). You didn't provide your wireguard configs either so it is impossible to replicate your VPN setup as well. What does connection to the VPN mean and where is the tunnel setup, on the host or in the container?

Luap99 avatar Jun 24 '25 10:06 Luap99

A reviewer has determined we need more information to understand the reported issue. A comment on what is missing should be provided. Be certain you:

  • provide an exact reproducer where possible
  • verify you have provided all relevant information - minimum is podman info
  • answer any follow up questions

If no response to the needs-info is provided in 30 days, this issue may be closed by our stale bot.

For more information on reporting issues on this repository, consult our issue guide.

github-actions[bot] avatar Jun 24 '25 10:06 github-actions[bot]

@Luap99 thanks for your quick reply

The VPN tunnel is setup inside the container. This is my wg0.conf file with concealed info where applicable:

Address = 10.173.229.181/32
PrivateKey = REDACTED
MTU = 1320
DNS = 10.128.0.1

[Peer]
PublicKey = REDACTED
PresharedKey = REDACTED
Endpoint = REDACTED
AllowedIPs = 0.0.0.0/0
PersistentKeepalive = 15

Container uses VPN to connect to the internet and exposed a port to my home private network in order to access its WebUI.

How can I provide the exact ip address/routes on the host and container? And yes, container it's attached to a custom network at the moment so I guess I have to provide extra info from podman unshare --rootless-netns: which command do I have run to provide the required info?

Thanks you!

dozenposture avatar Jun 24 '25 10:06 dozenposture

@Luap99 I tried to run podman system reset. Container started and connected to the VPN tunnel. However, when I restarted other containers, I got back to the same issue: no connectivity to the VPN tunnel.

dozenposture avatar Jun 24 '25 14:06 dozenposture

Run ip addr; ip route on the host and in podman unshare --rootless-netns and provide output. If you have public ips in there feel free to retract them.

If wireguard is setup in the container it sounds very much like a duplicate of https://github.com/containers/podman/issues/26438 as it seems to describe a similar problem. Try the package capture from https://github.com/containers/podman/issues/26438#issuecomment-2979570443 as well.

Luap99 avatar Jun 24 '25 16:06 Luap99

@Luap99 I think there's more: while checking something else, I noticed that also other containers in the same custom network don't have internet access regardless of using a VPN tunnel or not. If I pull any container outside of this custom network, they work immediately and they can reach the internet.

Here's the required output:

podman@host:~> ip addr; ip route
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 70:85:c2:70:cd:b1 brd ff:ff:ff:ff:ff:ff
    altname enp0s31f6
    altname enx7085c270cdb1
    inet 192.168.1.138/24 brd 192.168.1.255 scope global dynamic noprefixroute eno1
       valid_lft 57837sec preferred_lft 57837sec
    inet6 fe80::7285:c2ff:fe70:cdb1/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
3: podman0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 72:46:30:00:10:49 brd ff:ff:ff:ff:ff:ff
    inet 10.88.0.1/16 brd 10.88.255.255 scope global podman0
       valid_lft forever preferred_lft forever
4: veth0@if2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master podman0 state UP group default qlen 1000
    link/ether 5e:e1:7b:7a:56:8b brd ff:ff:ff:ff:ff:ff link-netns netns-c0e838bb-d096-32fe-1d64-fb2861c8bdf9
default via 192.168.1.1 dev eno1 proto dhcp src 192.168.1.138 metric 100
10.88.0.0/16 dev podman0 proto kernel scope link src 10.88.0.1
192.168.1.0/24 dev eno1 proto kernel scope link src 192.168.1.138 metric 100

And inside podman unshare --rootless-netns:

host:~ # ip addr; ip route
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host proto kernel_lo
       valid_lft forever preferred_lft forever
2: podman0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 65520 qdisc pfifo_fast state UNKNOWN group default qlen 1000
    link/ether ee:fd:b6:3f:c6:e4 brd ff:ff:ff:ff:ff:ff
    inet 10.88.0.1/16 brd 10.88.255.255 scope global podman0
       valid_lft forever preferred_lft forever
    inet6 fe80::ecfd:b6ff:fe3f:c6e4/64 scope link proto kernel_ll
       valid_lft forever preferred_lft forever
3: podman1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether b6:09:85:a6:58:b4 brd ff:ff:ff:ff:ff:ff
    inet 10.89.0.1/24 brd 10.89.0.255 scope global podman1
       valid_lft forever preferred_lft forever
    inet6 fe80::b409:85ff:fea6:58b4/64 scope link proto kernel_ll
       valid_lft forever preferred_lft forever
22: veth1@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master podman1 state UP group default qlen 1000
    link/ether ca:63:e7:09:f6:d9 brd ff:ff:ff:ff:ff:ff link-netnsid 1
    inet6 fe80::c863:e7ff:fe09:f6d9/64 scope link proto kernel_ll
       valid_lft forever preferred_lft forever
23: veth2@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master podman1 state UP group default qlen 1000
    link/ether 22:f8:dc:45:da:bf brd ff:ff:ff:ff:ff:ff link-netnsid 2
    inet6 fe80::20f8:dcff:fe45:dabf/64 scope link proto kernel_ll
       valid_lft forever preferred_lft forever
24: veth3@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master podman1 state UP group default qlen 1000
    link/ether fa:f7:9d:38:27:78 brd ff:ff:ff:ff:ff:ff link-netnsid 3
    inet6 fe80::f8f7:9dff:fe38:2778/64 scope link proto kernel_ll
       valid_lft forever preferred_lft forever
25: veth4@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master podman1 state UP group default qlen 1000
    link/ether 5e:1c:03:0d:f2:ea brd ff:ff:ff:ff:ff:ff link-netnsid 4
    inet6 fe80::5c1c:3ff:fe0d:f2ea/64 scope link proto kernel_ll
       valid_lft forever preferred_lft forever
27: veth6@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master podman1 state UP group default qlen 1000
    link/ether 62:7a:be:80:e1:85 brd ff:ff:ff:ff:ff:ff link-netnsid 6
    inet6 fe80::607a:beff:fe80:e185/64 scope link proto kernel_ll
       valid_lft forever preferred_lft forever
29: veth8@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master podman1 state UP group default qlen 1000
    link/ether 82:a7:e4:7f:9b:e9 brd ff:ff:ff:ff:ff:ff link-netnsid 8
    inet6 fe80::80a7:e4ff:fe7f:9be9/64 scope link proto kernel_ll
       valid_lft forever preferred_lft forever
30: veth9@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master podman1 state UP group default qlen 1000
    link/ether 72:04:4a:e8:5b:19 brd ff:ff:ff:ff:ff:ff link-netnsid 9
    inet6 fe80::7004:4aff:fee8:5b19/64 scope link proto kernel_ll
       valid_lft forever preferred_lft forever
31: veth12@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master podman1 state UP group default qlen 1000
    link/ether 16:2f:40:b7:85:7d brd ff:ff:ff:ff:ff:ff link-netnsid 12
    inet6 fe80::142f:40ff:feb7:857d/64 scope link proto kernel_ll
       valid_lft forever preferred_lft forever
32: veth11@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master podman1 state UP group default qlen 1000
    link/ether ae:b1:76:6a:00:d4 brd ff:ff:ff:ff:ff:ff link-netnsid 11
    inet6 fe80::acb1:76ff:fe6a:d4/64 scope link proto kernel_ll
       valid_lft forever preferred_lft forever
33: veth10@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master podman1 state UP group default qlen 1000
    link/ether 82:34:28:9d:89:66 brd ff:ff:ff:ff:ff:ff link-netnsid 10
    inet6 fe80::8034:28ff:fe9d:8966/64 scope link proto kernel_ll
       valid_lft forever preferred_lft forever
34: veth13@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master podman1 state UP group default qlen 1000
    link/ether ae:57:a4:b7:ba:b3 brd ff:ff:ff:ff:ff:ff link-netnsid 13
    inet6 fe80::ac57:a4ff:feb7:bab3/64 scope link proto kernel_ll
       valid_lft forever preferred_lft forever
10.88.0.0/16 dev podman0 proto kernel scope link
10.88.0.0/16 dev podman0 proto kernel scope link src 10.88.0.1
10.89.0.0/24 dev podman1 proto kernel scope link src 10.89.0.1

I haven't changed anything in my quadlets definition, this issue appeared out of nowhere.

dozenposture avatar Jun 25 '25 09:06 dozenposture

Thanks, that output does indeed explain why things are not working but not how we got there.

First, you seems to be running rootful containers as well and therefore have a podman0 interface on the host. Second, pasta normally picks the default route interface when it is started to copy the ip addr/routes from the host into the private namespace. For some reason it seemed to have picked podman0 instead of your actual host interface eno1.

Can you provide the output of this command pasta -d --config-net ip addr? That just runs pasta directly and should give some more info about what interface past picked. Now if that correctly uses eno1 then there is likely some race during the first container start happing where the network might not be fully set up.

In order to reconfigure the podman "rootless-netns" namespace to make is restart pasta one has to stop all containers with custom networks first (and make sure there are no podman unshare --rootless-netns processes running). Then make sure you no longer have a pasta process running with an argument similar to that:

--pid /run/user/1000/containers/networks/rootless-netns/rootless-netns-conn.pid

Then if you start one container on your custom network it should restart pasta which then select the interface again hopefully selecting the correct one this time around.

cc @sbrivio-rh

Luap99 avatar Jun 25 '25 11:06 Luap99

@Luap99 thanks for your inputs!

Thanks, that output does indeed explain why things are not working but not how we got there.

From what can you tell the above? (Genuine question as I'm here to learn)

Here the required output:

podman@host~> pasta -d --config-net ip addr
0.0008: No interfaces with usable IPv6 routes
0.0008: Failed to detect external interface for IPv6
0.0245: Template interface: eno1 (IPv4)
0.0245: Namespace interface: eno1
0.0245: MAC:
0.0245:     host: 9a:55:9a:55:9a:55
0.0245:     NAT to host 127.0.0.1: 192.168.1.1
0.0245: DHCP:
0.0245:     assign: 192.168.1.138
0.0245:     mask: 255.255.255.0
0.0245:     router: 192.168.1.1
0.0245: DNS:
0.0245:     192.168.1.138
0.0245:     192.168.1.108
0.0246: DNS search list:
0.0246:     localdomain
0.0301: SO_PEEK_OFF supported
0.0302: TCP_INFO tcpi_snd_wnd field  supported
0.0302: TCP_INFO tcpi_bytes_acked field  supported
0.0302: TCP_INFO tcpi_min_rtt field  supported
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host proto kernel_lo
       valid_lft forever preferred_lft forever
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 65520 qdisc pfifo_fast state UNKNOWN group default qlen 1000
    link/ether 8e:54:83:68:21:a9 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.138/24 brd 192.168.1.255 scope global noprefixroute eno1
       valid_lft forever preferred_lft forever
    inet6 fe80::8c54:83ff:fe68:21a9/64 scope link tentative proto kernel_ll
       valid_lft forever preferred_lft forever

I indeed have one single rootful container running. I thought that podman0 interface would come from a rootless container with network set to host mode.

and make sure there are no podman unshare --rootless-netns processes running

How?

Then make sure you no longer have a pasta process running with an argument similar to that

Simply by checking the output of ps -ef?

dozenposture avatar Jun 25 '25 11:06 dozenposture

Yes check check the process list with ps, simplest thing it to reboot and see if it happens again. Not sure how you run your root container but I guess the important thing would be that it only starts after the main network interface is fully configured.

Luap99 avatar Jun 26 '25 10:06 Luap99

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Jul 27 '25 00:07 github-actions[bot]