expressvpn icon indicating copy to clipboard operation
expressvpn copied to clipboard

Connectivity to other containers

Open vhansjee opened this issue 10 months ago • 13 comments

All my containers running network_mode: service:expressvpn become inaccessible after this update, probably an issue in the iptables (i'm still trying to narrow it down).

vhansjee avatar Jan 09 '26 09:01 vhansjee

In the README Ive added information about it here https://github.com/Misioslav/expressvpn?tab=readme-ov-file#network-lock-and-lan-access Use in the enviromental - LAN_CIDR=192.168.55.0/24 or whatever your network IPs are and it should work, at least it works on my side. The behavior is due to how new expressvpn client operates and seperates the traffic so new env has been added. Maybe it can be somehow automated but for now it can be managed through that.

Misioslav avatar Jan 09 '26 09:01 Misioslav

Yeah I did try the new environment variable (before raisng this issue) but it didn't work, it seems the traffic is not reaching the other containers. If I revert back to misioslav/expressvpn:latest-trixie everything works fine again.

  #EXPRESSVPN
  expressvpn:
    container_name: expressvpn
    image: misioslav/expressvpn:latest
    environment:
      - LAN_CIDR=192.168.2.0/24,172.18.0.0/24
    cap_add:
      - NET_ADMIN
    devices: 
      - /dev/net/tun
    stdin_open: true
    tty: true
    volumes:
    - /tmp/vpn:/shared_data/expressvpn
    - ./expressvpn:/shared_data
    command: /bin/bash -c "cp /etc/resolv.conf /shared_data/resolv.conf && bash"
    privileged: true
    restart: unless-stopped
    ports:
      - 3128:3128
  #SQUID
  squid:
    image: ubuntu/squid
    volumes:
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    container_name: squid
    restart: unless-stopped
    network_mode: service:expressvpn
    depends_on:
      expressvpn:
        condition: service_healthy

vhansjee avatar Jan 10 '26 00:01 vhansjee

Could you clarify what kind of traffic you’re referring to. Local/LAN traffic, or general internet traffic?

Also, are you running the exact same Compose setup 1:1 as in the example, or have you removed/changed any environment variables? If anything differs, could you share your full current Compose setup and your testing steps/methodology? It would also help to know what kernel version the host machine is running.

I’m trying to reproduce the issue on my side with the Compose you have pasted above. So far, the ExpressVPN and Squid containers have working internet access (e.g., curl ipinfo.io shows the expected IP/provider), and from inside both the ExpressVPN and Squid containers I can also ping/curl local network services via their LAN IPs.

The only changes I’ve made compared to your setup were: • Updating the CIDR from LAN_CIDR=192.168.2.0/24,172.18.0.0/24 to LAN_CIDR=192.168.55.0/24,172.18.0.0/24 • Adding the CODE environment variable so the VPN container can connect

Misioslav avatar Jan 10 '26 11:01 Misioslav

Its traffic from my local lan to the container (I believe the flow is like this)

Client - :x: -> DockerHost:3128 - :white_check_mark: -> ExpressVPN Container (Port Forwarding) - :white_check_mark: -> Squid Service (Internal) - :white_check_mark: -> VPN Tunnel (Encryption) - :white_check_mark: -> Internet

Yes that is the exact compose setup (I just removed the CODE variable) I've just tried it again, same issue (rolling back to previous version works perfectly).

  • I did a little more digging and it looks like the DockerHost is not exposing port 3128 so the request just times out [tcp4 0 0 (client ip).50667 (dockerhost).3128 SYN_SENT]

  • if you curl (expressvpn_container_ip):3128 from the DockerHost that works fine

  • if you curl (dockerhost_ip):3128 from any other client that times out

vhansjee avatar Jan 11 '26 01:01 vhansjee

Wouldn’t that point to an issue on the Docker host side? I know you said it worked on an older version, but they changed how networking is handled in v4/v5, which is why I had to add the CIDR workaround. With that change, maybe something else also needs to be adjusted on the Docker host, but I’m not certain.

I’ve tried recreating this across different setups and configs, and unless I explicitly remove the LAN_CIDR env, I can connect from any other machine using the Docker host IP and port. And a key part of my setup depends on that working.

I will try to dig a bit more into this, but if you find something, please, let me know, if it is something on container side I will introduce a fix.

EDIT:

Can you make a test with NETWORK=off ?

Misioslav avatar Jan 11 '26 18:01 Misioslav

Tried it with NETWORK=off, same issue. I can get it to work if move the container out of network_mode: service:expressvpn and then make the the squid container use the expressvpn as the default gateway but that sucks, i'll stick to the old version for now.

vhansjee avatar Jan 12 '26 08:01 vhansjee

Unfortunately, the old version will stop working in a couple of days https://www.expressvpn.com/blog/update-expressvpn-to-stay-connected/

Misioslav avatar Jan 12 '26 08:01 Misioslav

I've been trying to debug the issue, I disconnect the VPN i'm able to reach the container normally, the minute I reconnect it stops working again, also I noticed when I set the networklock to off in status is still says enabled? looks like there a bug there?

oot@3c7204ea37cb:/# expressvpnctl status Connected to Smart (new-zealand)

Protocol in use: LightwayUdp Network Lock: enabled when connected Split Tunnel: enabled root@3c7204ea37cb:/# expressvpnctl disconnect root@3c7204ea37cb:/# expressvpnctl status Disconnected

Location: Smart (new-zealand) Network Lock: enabled when connected Split Tunnel: enabled

root@3c7204ea37cb:/# expressvpnctl get networklock false root@3c7204ea37cb:/# expressvpnctl connect root@3c7204ea37cb:/# expressvpnctl get networklock false root@3c7204ea37cb:/# expressvpnctl status Connected to Smart (new-zealand)

Protocol in use: LightwayUdp Network Lock: enabled when connected Split Tunnel: enabled

vhansjee avatar Jan 12 '26 12:01 vhansjee

Might be a bug in the app but the authors would have to check that. As for the scenario because they changed how the app operates (split tunnels and such) it might be causing some behaviors that are unexpected but until Im able to recreate I won’t be able to help unfortunately.

Just to make sure CIDR values set are the correct ones? What shows ip addr on dockerHost machine? What type of network you are using for expressvpn (or you don’t specify it at all I. Compose?)

Misioslav avatar Jan 12 '26 12:01 Misioslav

No problem thanks for your help 👍 expressvpn tunnel gets : 172.18.0.5 and so the CIDR looks correct. I don't specify it all so it defaults to bridge

vhansjee avatar Jan 12 '26 12:01 vhansjee

Thank you and as for your local ip? As I understood correctly you try to for instance curl/ping 192.168.x.y:port and is not reachable but doing the same on dockerHost meaning localhost:port or dockerIP:port does work right? Currently the only thing that comes to my mind is lack of some additional entry in CIDR.

Misioslav avatar Jan 12 '26 12:01 Misioslav

yeah my client_device is 192.168.2.50 my dockerhost is 192.168.2.30 the expressvpn container ip is : 172.18.0.5

from dockerhost I can :

  • curl -x http://192.168.2.30:3128 http://ifconfig.me/ (returns expressvpn ip)
  • curl -x http://172.18.0.5:3128 http://ifconfig.me/ (returns expressvpn ip)
  • curl -x http://127.0.0.1:3128 http://ifconfig.me/ (returns expressvpn ip)

and everything works fine but it doesn't work from any other device outside of the dockerhost (e.g. my client_device) if console into the expressvpn container and disconnect the vpn, i'm able to curl -x http://192.168.2.30:3128 http://ifconfig.me/ from my client_device and the ip address is my normal public ip address.

vhansjee avatar Jan 12 '26 13:01 vhansjee

Issue is with the actual expressvpn application not the container

vhansjee avatar Jan 14 '26 01:01 vhansjee