dperson / openvpn-client

GNU Affero General Public License v3.0
1.05k stars 585 forks source link

Application unable to resolve Host with NordVPN #396

Closed WINOFFRG closed 1 year ago

WINOFFRG commented 2 years ago

Hello I am here with reference to another fork of this repository for Nord VPN. Initially I started with docker run command with refernece from the documentation.

Here below commands shows that I am first running the VPN container and once the VPN Container is up, I run another container which has a nodejs application inside it. And what it does is to make a API call to another URL and return its IP Address of host, So just to check if the VPN is working or not

1. docker run -p 8080:8080 --cap-add=NET_ADMIN --name vpn -e USER=xxxx -e PASS=yyyy -e TECHNOLOGY=NordLynx -d ghcr.io/bubuntux/nordvpn
2. docker run --net=container:vpn -d node-api

Using the above commands when I open localhost:8080 it gives me the expected response of my Nord VPN IP Address.

But this doesn't works as expected when working with docker-compose

👉 Here below is the configuration of my docker-compose file:

services:
  web:
      build: /nodejs
      command: npm run start
      volumes:
          - .:/nodejs/
          - /nodejs/node_modules
      network_mode: service:vpn
  vpn:
      image: ghcr.io/bubuntux/nordvpn
      cap_add:
          - NET_ADMIN
      environment:
          - USER=xxxx
          - "PASS=yyyy"
          - TECHNOLOGY=NordLynx
      # sysctls:
          # - net.ipv6.conf.all.disable_ipv6=1  # Recomended if using ipv4 only
      ports:
          - "8080:8080"
      dns:
          - 8.8.4.4
          - 8.8.8.8
      restart: unless-stopped

This time my application runs but is unable to resolve the host for the URL to which I made a request using my NodeJS application. Axios (http client for Nodejs) throws me this error.

{"message":"getaddrinfo EAI_AGAIN pro.ip-api.com","name":"Error","stack":"Error: getaddrinfo EAI_AGAIN" }

which ultimately means that there is some DNS Issue with the app.

I also made sure that VPN is connected and has the status running. Also, I checked other issues which had the solution for similar problem but that also didn't worked well. Moreover after some time, I see the error's as shown below in my terminal thrown by the VPN Client

image

marcingajda commented 1 year ago

Hi @WINOFFRG, did you resolve this problem?

WINOFFRG commented 1 year ago

No but I have I found better alternative, try this: https://github.com/qdm12/gluetun/

marcingajda commented 1 year ago

Great for you :) Finally I made this image working. I had to set up the DNS's.