qdm12 / gluetun

VPN client in a thin Docker container for multiple VPN providers, written in Go, and using OpenVPN or Wireguard, DNS over TLS, with a few proxy servers built-in.
https://hub.docker.com/r/qmcgaw/gluetun
MIT License
8.04k stars 372 forks source link

Help: Connects to same IP all the time #229

Closed entrptaher closed 4 years ago

entrptaher commented 4 years ago

TLDR: Connects to same IP all the time

Even if I restart the docker, reconnect, the IP doesn't change at all. So if the IP is bad, I cannot use the VPN at all to browse any website.

  1. Is this urgent?

    • [x] Yes
    • [ ] No
  2. What VPN service provider are you using?

    • [x] PIA
    • [ ] Mullvad
    • [ ] Windscribe
    • [ ] Surfshark
    • [ ] Cyberghost
  3. What's the version of the program?

    Running version latest built on 2020-08-30T14:49:36Z (commit 7c102c0)

  4. What are you using to run the container?

    • [ ] Docker run
    • [x] Docker Compose
    • [ ] Kubernetes
    • [ ] Docker stack
    • [ ] Docker swarm
    • [ ] Podman
    • [ ] Other:
  5. Extra information

Logs:

gluetun_1  | 2020-08-31T00:47:17.252Z   INFO    openvpn: TCP/UDP: Preserving recently used remote address: [AF_INET]212.102.37.77:1197
gluetun_1  | 2020-08-31T00:47:17.252Z   INFO    openvpn: UDP link local: (not bound)
gluetun_1  | 2020-08-31T00:47:17.252Z   INFO    openvpn: UDP link remote: [AF_INET]212.102.XX.XX:1197

Configuration file:

gluetun:
    image: qmcgaw/private-internet-access
    # uncomment to use the check ip
    # container_name: gluetun
    network_mode: bridge
    ports: 
      - ${VPN_ADMIN_PORT}:8000/tcp
    cap_add:
      - NET_ADMIN
    environment:
      - VPNSP=private internet access
      - USER=${PIA_USER}
      - PASSWORD=${PIA_PASSWORD}
      - REGION=Switzerland
      - TINYPROXY=on
    restart: always

Host OS: Ubuntu 20.04

qdm12 commented 4 years ago

Private Internet Access recently added static IP addresses to their openvpn zip files. That's what is used now so there is only one ip address per region. IP address should also be pretty much stable, as before I was hardcoding IP addresses from their different subdomains, which were quite dynamic.

On the other hand, I added recently a new feature which is still undocumented (because it only works for pia old, new servers and mullvad for now) such that you can update the servers information yourself, see #217 You would need to bind mount the /gluetun directory which contains the servers information. You can already modify it manually or use docker run -it --rm -v /blabla:/gluetun qmcgaw/private-internet-access update -pia -file which does all the zip file download+extract+parsing for you automatically.

I'll add more documentation once it's fully ready, but that should answer your question I hope. Thanks!

philipp65 commented 4 years ago

Thank you for the information and hard work.

How can I change the IP of a specific region if the (only) IP is being blocked?

qdm12 commented 4 years ago

Easy solution:

Tell me your provider and region and I can look if I can add some IPs.

Harder solution without me:

If you bind mount the /gluetun directory, you can modify the servers.json file and restart the container. To do so, override the IP address you want (or add one) for the server you want and then update the unix timestamp for the corresponding provider, all in servers.json. You can find the current unix timestamp with a google search.

Note however that if a newer Docker image comes with updated IP addresses and a more recent timestamp, it will override what you wrote. You can go around it by specifying a huge number for the timestamp.

philipp65 commented 4 years ago

Thank you for the detailled information.

The region would be Austria. Currently glueton is always taking the following IP:

      {
        "ips": [
          "156.146.60.14"
        ],
        "region": "Austria"
      },

Is there a possibility to specify the IP afterwards within the docker-compose ENV or better within the glueton container or API?

qdm12 commented 4 years ago

Multiple things 🎉

EDIT: Pull latest when the build is done (link)

philipp65 commented 4 years ago

Awesome. Works like a charm. Thank you