I want to run only qBittorrent through my VPN but with my current setup, I have a namespace for OpenVPN and qBittorrent runs entirely through it. The issue with that is that Sonarr and Radarr can’t access it. Because of that, I would like to switch my setup to use a network interface instead. What would be the best way to do that?
Edit: I used this guide, with some changes to make it work on my setup, to set it up. I can also post my docker-compose file here if anyone’s interested.
If you know how to use docker look up gluetun, it basically allows you to tunnel everything through the VPN and still access everything locally.
Will that install qBittorrent by itself and allow Sonarr and Radarr that run outside the container to speak to it? Then it would be perfect
Edit: For some reason I thought it was a torrent client but it’s just a VPN client. So it creates a network interface but doesn’t route all traffic through it?
You run a gluetun container and a qBittorrent container on which you set the “network mode” to the gluetun container. Then you put your *arr software and the gluetun container in the same (virtual) network so they can communicate internally. All containers using gluetun as their “network mode” have their ports available on the gluetun container. You can also put the qBittorrent container in your virtual internal network but then you have to make sure that the network is marked as internal to avoid traffic leaking.
Managed to set it all up yesterday. Thanks for suggesting Gluetun.
Here’s an example docker-compose.yaml for gluetun with Nordvpn and qBittorrent"
version: "3" services: gluetun: image: qmcgaw/gluetun container_name: gluetun cap_add: - NET_ADMIN devices: - /dev/net/tun:/dev/net/tun ports: # this makes qBittorrent's web UI accessible on localhost:8080 - "127.0.0.1:8080:8080" environment: # See https://github.com/qdm12/gluetun-wiki/tree/main/setup#setup - VPN_SERVICE_PROVIDER=nordvpn - VPN_TYPE=wireguard - WIREGUARD_PRIVATE_KEY=aGFoYWltbm90dGhhdGR1bWJnb2RkYW1taXQ= - TZ=Europe/Berlin # Server list updater # See https://github.com/qdm12/gluetun-wiki/blob/main/setup/servers.md#update-the-vpn-servers-list - UPDATER_PERIOD= - SERVER_COUNTRIES=Germany - SERVER_REGIONS=p2p qbittorrent: image: lscr.io/linuxserver/qbittorrent:latest container_name: qbittorrent network_mode: "service:gluetun" environment: - PUID=1000 - PGID=1000 - TZ=Europe/Berlin - WEBUI_PORT=8080 volumes: - ./config:/config - ./downloads:/downloads - ./torrents:/torrents restart: unless-stopped
You can use qBittorrent’s API (enable it in the settings) to add magnet links. I have a small wrapper tool for that, so I can just click on a magnet link in the browser and it gets added to the queue.
I know of a similar setup. Arr stack with qBittorrent and VPN on kubernetes. A bit different than yours in that the arr+qBit+VPN run in the same namespace. Here’s how:
--- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: qbittorrent-ingress namespace: arr spec: ingressClassName: nginx rules: - host: your.ho.st http: paths: - path: / pathType: Prefix backend: service: name: qbittorrent port: number: 8080 --- kind: Service apiVersion: v1 metadata: name: qbittorrent namespace: arr spec: selector: app: qbittorrent ports: - protocol: TCP port: 8080 targetPort: 8080 --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: qbittorrent namespace: arr spec: storageClassName: zfs accessModes: - ReadWriteMany resources: requests: storage: 1Ti --- apiVersion: apps/v1 kind: Deployment metadata: namespace: arr name: qbittorrent spec: replicas: 1 selector: matchLabels: app: qbittorrent strategy: type: Recreate template: metadata: labels: app: qbittorrent spec: containers: - name: qbittorrent image: linuxserver/qbittorrent imagePullPolicy: Always volumeMounts: - mountPath: "/config" name: "volume" - mountPath: "/media" name: "media" env: - name: PUID value: "1000" - name: PGID value: "1000" - name: TZ value: "Etc/UTC" ports: - containerPort: 8080 - name: gluetun image: qmcgaw/gluetun imagePullPolicy: Always securityContext: capabilities: add: ["NET_ADMIN"] volumeMounts: - mountPath: /dev/net/tun name: tun env: - name: VPN_SERVICE_PROVIDER value: "mullvad" - name: VPN_TYPE value: "wireguard" - name: WIREGUARD_PRIVATE_KEY value: "removed" - name: WIREGUARD_ADDRESSES value: "removed" - name: SERVER_CITIES value: "removed" - name: FIREWALL_INPUT_PORTS value: "8080" - name: TZ value: "Etc/UTC" restartPolicy: Always volumes: - name: volume persistentVolumeClaim: claimName: qbittorrent - name: media nfs: server: nfs.server.local path: /media - name: tun hostPath: path: /dev/net/tun
The relevant bit of the qBittorrent.conf:
[BitTorrent] Session\Interface=tun0 Session\InterfaceName=tun0
Best of luck!
Managed to set it up before you posted this already but thanks anyway. I also used Gluetun btw.