Skip to content

qBittorrent with OpenVPN in Docker on a Synology NAS

FAQs

Q: How can I be sure the VPN connection is working?

A: Grab the magnet on the Check My Torrent IP site after a few seconds the site will show the IP address of the connection it finds. This will be of the VPN provider not your home IP.

Q: Why can’t I start the qBittorrent container via the DSM GUI?

A: Due to the way in which this container works the DSM GUI is unable to start the container again if you stop it. In order to start it correctly you will just need to SSH back into your Diskstation and re-run the docker compose—up command.

Q: I am using Mullvad and having issues connecting!

A: Mullvad has a slightly different VPN config compared to some. In order for you to have a successful connection you (may)need to make the following additional edits to the vpn.conf file. We have found through troubleshooting on Discord that the edits you need do vary though!

VariableValue
up /etc/openvpn/update-resolv-confup /vpn/update-resolv-conf
down /etc/openvpn/update-resolv-confdown /vpn/update-resolv-conf
tun-ipv6#tun-ipv6
Three additional variables to add after the #tun-ipv6pull-filter ignore “dhcp-option DNS6”
pull-filter ignore “tun-ipv6”
pull-filter ignore “ifconfig-ipv6”

In addition to the above you may need to add the following to your .yml if you receive an error ‘RTNETLINK answers permission denied’ it will go into the vpn section.

sysctls:
  - net.ipv6.conf.all.disable_ipv6=0

Q: How can I add additional services to the VPN container?

A: See the example docker compose file below. Note the amendment to the ‘network mode’ to make the Prowlarr container use the VPN and the addition of its port numbers to the VPN container section.

version: "3.8"
services:
  vpn:
    container_name: vpn
    image: dperson/openvpn-client:latest
    cap_add:
      - net_admin # gives docker admin rights to amend network settings
    devices:
      - /dev/net/tun #points to the tun device created by the syno VPN package
    volumes:
      - /volume1/docker/vpn:/vpn #The location of our config files
    security_opt:
      - label:disable
    environment:
      OPENVPN_OPTS: '--mute-replay-warnings'
      DNS: --9.9.9.9 #this will override your default DNS and avoids connection issues you can change this value if you wish
    ports: #the port below allow the WebUI of any application connecting through the VPN to remain accessible locally
      - 8090:8090 # port for qBittorrent - Add a line for each application you want to use the VPN
      - 9696:9696 # port for prowlarr
    command: '-f "" -r "192.168.0.0/24"'  # -r 192.168.254.0/24 -f  # amend this in line with your local network settings
    restart: unless-stopped
      
  qbittorrent:
    image: lscr.io/linuxserver/qbittorrent
    container_name: qbittorrent
    environment:
      - PUID=YOURPUID
      - PGID=YOURPGID
      - TZ=YOURTIMEZONE
      - WEBUI_PORT=8090
    volumes:
      - /volume1/docker/qbittorrent:/config
      - /volume1/data/torrents:/data/torrents
    network_mode: service:vpn # run on the vpn network
    depends_on:
      - vpn
    restart: unless-stopped

  linuxserver-prowlarr:
    image: linuxserver/prowlarr:develop
    container_name: prowlarr
    environment:
      - PUID=YOURPUID
      - PGID=YOURPGID
      - TZ=YOURTIMEZONE
    volumes:
      - /volume1/docker/prowlarr:/config
    network_mode: service:vpn # run on the vpn network
    depends_on:
      - vpn
    restart: unless-stopped

More will be added as questions come up



Throw me some bits or buy me a coffee?

If you have found my site useful please consider pinging me a tip as it helps cover the cost of running the site, you can even buy me a coffee 🙂

Buy Me A Coffee
Doge / Ethereum / Bitcoin

Pages: 1 2

Published inDockerDownload ToolsSynology

30 Comments

  1. Manny Black Manny Black

    I’m also getting the vpn always restarting. And the webUI won’t open.

    • Dr_Frankenstein Dr_Frankenstein

      Hey Manny – Can you contact me via Discord or via my contact page on the top left of the site please – It’s easier to fix that way rather than via the comments – Thanks

  2. d d

    Thanks so much for this (and other) useful guides.

    I’m getting this error message. Any troubleshooting suggestions?

    ERROR: for qbittorrent Cannot start service qbittorrent: OCI runtime create failed: container_linux.go:363: creating new parent process caused: container_linux.go:1946: running lstat on namespace path “/proc/26040/ns/net” caused: lstat /proc/26040/ns/net: no such file or directory: unknown

    • Dr_Frankenstein Dr_Frankenstein

      Hey, is your VPN container in a restart loop or has it connected successful?

      • d d

        Thanks for your help here…

        When I first tried it, the vpn connected successfully and stayed connected, but the qbittorrent container threw that error.

        I deleted them both and now when I re-create them, the vpn container is in a restart loop. But the error message is different:

        Cannot start service qbittorrent: Container 95b0156e358e1879adc8054f64b10cd57cd9bcd47ab0db90ae412fb69aa61a41 is restarting, wait until the container is running

        • Dr_Frankenstein Dr_Frankenstein

          OK cool, can you reach out to me either via the contact me page or Discord. The links are in the top left of this site as I will need to check your logs to see why the VPN is not connecting. I suspect it hadn’t actually connected the first time. As without the VPN being up qbittorrent won’t work.

  3. Dr_Frankenstein Dr_Frankenstein

    I believe it should work, give it a try and let us know.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

drfrankenstein.co.uk – writing Synology Docker Guides since 2016 – Join My Discord!