haugene / docker-transmission-openvpn

Docker container running Transmission torrent client with WebUI over an OpenVPN tunnel
GNU General Public License v3.0
4.04k stars 1.21k forks source link

DNS connection lost after some time #1259

Closed rogerfar closed 4 years ago

rogerfar commented 4 years ago

I added DNS parameters to my docker-compose.yaml because I am having issues with OpenVPN not able to connect after a few days anymore:

Sun Jun 21 04:17:38 2020 NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
Sun Jun 21 04:17:48 2020 RESOLVE: Cannot resolve host address: nl.windscribe.com:1194 (Temporary failure in name resolution)
Sun Jun 21 04:17:58 2020 RESOLVE: Cannot resolve host address: nl.windscribe.com:1194 (Temporary failure in name resolution)
Sun Jun 21 04:17:58 2020 Could not determine IPv4/IPv6 protocol
Sun Jun 21 04:17:58 2020 SIGUSR1[soft,init_instance] received, process restarting

My config has hardcoded DNS in it:

        dns:
            - 1.1.1.1
            - 1.0.0.1

When I start the container everything works fine, remote access is available, torrents work and when I remote in the shell I can do a DNS lookups.

But after a few days it stops, it's hard to pinpoint when exactly but usually it's about 3-4 days. Remote access still works, I can shell in the container, but DNS seems to have stopped.

When I do something simple like ping google.com it can't resolve the hostname.

I'm running docker on Windows, this my docker-compose.yaml:

version: '3.3'
services:
    transmission-openvpn:
        container_name: transmission-vpn
        volumes:
            - 'D:/Downloads/:/data'
        image: haugene/transmission-openvpn
        environment:
            - CREATE_TUN_DEVICE=true
            - OPENVPN_PROVIDER=WINDSCRIBE
            - OPENVPN_CONFIG=Netherlands-udp
            - OPENVPN_USERNAME=
            - OPENVPN_PASSWORD=
            - OPENVPN_OPTS=--inactive 3600 --ping 10 --ping-exit 60
            - WEBPROXY_ENABLED=false
            - LOCAL_NETWORK=192.168.0.0/16
            - TRANSMISSION_RPC_AUTHENTICATION_REQUIRED=true
            - TRANSMISSION_RPC_HOST_WHITELIST="127.0.0.1,192.168.*.*"
            - TRANSMISSION_RPC_USERNAME=
            - TRANSMISSION_RPC_PASSWORD=
        cap_add:
            - NET_ADMIN
        devices:
            - /dev/net/tun
        restart: always
        logging:
            driver: json-file
            options:
                max-size: 10m
        ports:
            - '9091:9091'
        dns:
            - 1.1.1.1
            - 1.0.0.1

What would be the way to troubleshoot this issue?

pkishino commented 4 years ago

more likely this is an issue with the vpn provider..you could add a dns check and mark container unhealthy and have it auto-restart when this happens.

rogerfar commented 4 years ago

But OpenVPN isn't connected to anything at that point, I don't see how that could be an issue?

The container reports itself already as unhealthly at that point.

pkishino commented 4 years ago

Sorry, you wrote that after a few days you cannot connect, right? So, it will connect and work fine for a while and then stop..and then it cannot reconnect? so for some reason you are being disconnected and this is causing some issue with openvpn it seems. A more deeper look into logs and debugging openvpn sound like what is necessary, you can see if you can enable debug logging or such and analyse the logs next time this happens. It seems you are running the ubuntu release, perhaps try this with the alpine image and see if the same things occurs? Perhaps the openvpn versions needs updating or such, in which case it would be an issue with the image, otherwise it's more openvpn related and not much we can do (except give advice perhaps)

rogerfar commented 4 years ago

I've been monitoring it for a bit now, installed the dig tools just in case, but so far I haven't had a freeze anymore.

One change I made was disable Ipv6 on the host completely, could be that throws things off.