portcheck icon indicating copy to clipboard operation
portcheck copied to clipboard

Portcheck results in connection refused

Open schweppes-0x opened this issue 1 year ago • 2 comments

When applying the correct settings I get:

2024/06/12 19:58:03 dial tcp 172.20.0.2:6881: connect: connection refused
2024/06/12 19:58:03 Post "http://localhost:8080/api/v2/auth/login": dial tcp 127.0.0.1:8080: connect: connection refused

docker-compose.yml:


version: '3.9'
services:
  gluetun:
    cap_add:
    - NET_ADMIN
    container_name: gluetun
    image: qmcgaw/gluetun:latest
    network_mode: synobridge
    hostname: gluetun

    devices:
     - /dev/net/tun:/dev/net/tun
    ports:
      - 8080:8080 # qbittorrent
    volumes:
      - ${configPath}/gluetun:/gluetun
    environment:
      - PUID=${UID} 
      - PGID=${GID} 
      - TZ=${TZ}
      - VPN_SERVICE_PROVIDER=nordvpn
      - VPN_TYPE=wireguard 
      - WIREGUARD_PRIVATE_KEY=${wireguardPrivateKey}
      - SERVER_COUNTRIES=${vpnCountries}
      - FIREWALL_VPN_INPUT_PORTS=6881 #,1194,443
      - FIREWALL_OUTBOUND_SUBNETS=172.20.0.0/16,192.168.0.0/24
    restart: always

  portcheck:
    container_name: portcheck
    depends_on:
      - qbittorrent
    environment:
      - DIAL_TIMEOUT=5
      - QBITTORRENT_PASSWORD=mypassword
      - QBITTORRENT_PORT=6881 #this port is also configured within qBit's settings
      - QBITTORRENT_USERNAME=admin
      - QBITTORRENT_WEBUI_PORT=8080
      - QBITTORRENT_WEBUI_SCHEME=http
      - TIMEOUT=300
    image: eiqnepm/portcheck
    network_mode: service:gluetun
    restart: unless-stopped
  
  qbittorrent:
    image: lscr.io/linuxserver/qbittorrent
    container_name: qbittorrent
    network_mode: service:gluetun
    environment:
      - PUID=${UID}
      - PGID=${GID}
      - TZ=${TZ}
      - WEBUI_PORT=8080
    volumes:
      - ${configPath}/qbit:/config
      - ${mediaPath}:/media
    depends_on:
      - gluetun
    restart: always

I have no clue how to fix this

schweppes-0x avatar Jun 12 '24 20:06 schweppes-0x

@schweppes-0x set this env variable QBITTORRENT_WEBUI_HOST=your externally accessible server ip [ex. 192.168.1.1]

John5798 avatar Jun 16 '24 16:06 John5798

@schweppes-0x set this env variable QBITTORRENT_WEBUI_HOST=your externally accessible server ip [ex. 192.168.1.1]

Actually that environment variable defaults to localhost so it's completely optional in this case as both containers are running inside the Gluten service network.

@schweppes-0x do you get this error every 300 seconds or just the once when the container starts? https://github.com/eiqnepm/portcheck/issues/1#issuecomment-1666702965

eiqnepm avatar Jun 16 '24 16:06 eiqnepm

I have essentially the same docker compose but I keep getting connection refused. 2024/08/29 15:34:09 dial tcp 10.137.253.41:49455: connect: connection refused 2024/08/29 15:34:09 Post "http://localhost:8085/api/v2/auth/login": dial tcp 127.0.0.1:8085: connect: connection refused 2024/08/29 16:19:10 dial tcp 10.137.253.41:49455: connect: connection refused 2024/08/29 16:19:10 {"listen_port":0} 2024/08/29 16:19:10 {"listen_port":49455}

Manny8787 avatar Aug 29 '24 19:08 Manny8787

I have essentially the same docker compose but I keep getting connection refused. 2024/08/29 15:34:09 dial tcp 10.137.253.41:49455: connect: connection refused 2024/08/29 15:34:09 Post "http://localhost:8085/api/v2/auth/login": dial tcp 127.0.0.1:8085: connect: connection refused 2024/08/29 16:19:10 dial tcp 10.137.253.41:49455: connect: connection refused 2024/08/29 16:19:10 {"listen_port":0} 2024/08/29 16:19:10 {"listen_port":49455}

The last two lines of your output indicate that it's working, the JSON response is only outputted if the change was a success. https://github.com/eiqnepm/portcheck/blob/4e76b8177ba4da23366b4f8f2ca16b6293f94b9e/internal/qbit/qbit.go#L100-L103

If the connection is refused only once when the containers are initially started this is to be expected https://github.com/eiqnepm/portcheck/issues/1#issuecomment-1666702965.

eiqnepm avatar Aug 29 '24 19:08 eiqnepm

Well I keep getting connection refused. 2024/08/29 15:34:09 dial tcp 10.137.253.41:49455: connect: connection refused 2024/08/29 15:34:09 Post "http://localhost:8085/api/v2/auth/login": dial tcp 127.0.0.1:8085: connect: connection refused 2024/08/29 16:19:10 dial tcp 10.137.253.41:49455: connect: connection refused 2024/08/29 16:19:10 {"listen_port":0} 2024/08/29 16:19:10 {"listen_port":49455} 2024/08/29 16:29:11 dial tcp 10.137.253.41:49455: connect: connection refused 2024/08/29 16:29:11 {"listen_port":0} 2024/08/29 16:29:11 {"listen_port":49455} 2024/08/29 16:39:12 dial tcp 10.137.253.41:49455: connect: connection refused 2024/08/29 16:39:24 {"listen_port":0} 2024/08/29 16:39:24 {"listen_port":49455} 2024/08/29 16:49:25 dial tcp 10.137.253.41:49455: connect: connection refused 2024/08/29 16:49:25 {"listen_port":0} 2024/08/29 16:49:25 {"listen_port":49455} 2024/08/29 19:14:28 dial tcp 10.137.253.41:49455: connect: connection refused 2024/08/29 19:14:28 {"listen_port":0} 2024/08/29 19:14:28 {"listen_port":49455}

Manny8787 avatar Aug 29 '24 19:08 Manny8787

Well I keep getting connection refused.

Are you sure your port forwarding is working? The web connection to your torrent client is working correctly, but it's unable to connect to the client through your VPN.

eiqnepm avatar Aug 29 '24 19:08 eiqnepm

Yes its working fine. here is my docker compose:

version: "3" services: portcheck: labels: - com.centurylinklabs.watchtower.enable=true
depends_on: - qbittorrent environment: - DIAL_TIMEOUT=5
- QBITTORRENT_PORT=49455 - QBITTORRENT_WEBUI_PORT=8085 - QBITTORRENT_USERNAME=********* - QBITTORRENT_PASSWORD=********* - QBITTORRENT_WEBUI_SCHEME=http
- TIMEOUT=300 image: eiqnepm/portcheck:latest network_mode: service:gluetun restart: unless-stopped

gluetun: image: qmcgaw/gluetun:v3 cap_add: - NET_ADMIN network_mode: bridge labels: - com.centurylinklabs.watchtower.enable=true
devices: - /dev/net/tun:/dev/net/tun ports: - 8888:8888/tcp # HTTP proxy - 8085:8085/tcp #qbittorrent port - 8112:8112/tcp # Shadowsocks - 8388:8388/udp # Shadowsocks volumes: - /share/appdata/gluetun/config:/config environment: # See https://github.com/qdm12/gluetun-wiki/tree/main/setup#setup - VPN_SERVICE_PROVIDER=airvpn - VPN_TYPE=wireguard # OpenVPN: # - OPENVPN_USER=************ # - OPENVPN_PASSWORD=**************** # Wireguard: - WIREGUARD_PRIVATE_KEY=***************************** - WIREGUARD_ADDRESSES=10.137.253.41/32 - WIREGUARD_PRESHARED_KEY=******************************** - SERVER_COUNTRIES=Netherlands - FIREWALL_VPN_INPUT_PORTS=49455 - UPDATER_PERIOD=24h # Timezone for accurate log times - TZ=europe/paris # Server list updater # See https://github.com/qdm12/gluetun-wiki/blob/main/setup/servers.md#update-the-vpn-servers-list

qbittorrent: image: lscr.io/linuxserver/qbittorrent container_name: qbittorrent network_mode: service:gluetun labels: - com.centurylinklabs.watchtower.enable=true environment: - PUID=1000 - PGID=1000 - TZ=Europe/Paris - WEBUI_PORT=8085 volumes: - /share/appdata/qbit/config:/config - /share/CACHEDEV2_DATA/data/torrents:/data/torrents - /share/CACHEDEV2_DATA/data/media:/data/media depends_on: gluetun: condition: service_healthy

Manny8787 avatar Aug 29 '24 19:08 Manny8787

Yes its working fine.

Please may you get your VPN public IP and make sure you port is definitely externally accessible using https://ping.eu/port-chk/? Making sure to enter the correct torrent listening port.

eiqnepm avatar Sep 03 '24 16:09 eiqnepm

@Manny8787 I created another branch which uses an external service for port checking portcheck.transmissionbt.com which is provided by the Transmission BitTorrent client developers, obviously the checks are requested from behind your VPN either way so privacy shouldn't be a worry here. If your port definitely is open, this branch should work for you.

https://github.com/eiqnepm/portcheck/tree/manny

Make sure to read the example, Docker tag, and environment variables, as they are different to the main branch.

eiqnepm avatar Sep 05 '24 21:09 eiqnepm