Skip to content

Put a torrent client behind your VPN

qBittorrent and Transmission can send their traffic through the WireGuard server of your VPN provider instead of your home connection. You select one checkbox when you deploy, and you paste one file. If the tunnel drops, the app loses its internet connection. It does not fall back to your home connection.

The app gets a second container next to it, gluetun. This container holds the tunnel and a firewall. The connections of the app to peers and trackers, and its name lookups, all go out through it.

Where it works

Where the app runs Status Notes
A Linux machine Tested Our end-to-end test runs it on a Linux k3d cluster. The test checks that nothing leaks while the tunnel is down.
A Mac (k3d) Expected to work, in testing
A Windows 11 PC (WSL2) Expected to work, in testing
A cluster with more than 1 node Not supported Mesopod cannot read the network ranges of a cluster with several nodes yet. A VPN app must have them.

The 3 statuses have the meanings given in the install guide.

1. Get a WireGuard file from your provider

You must have a WireGuard configuration file for one device. It is the file that you would import into the WireGuard app on a laptop. Providers that give such files let you make one in your account on their website:

  • Mullvad: in your account, WireGuard configuration. Generate a key, select a server and download the file.
  • Proton VPN: in your account dashboard, Downloads, then WireGuard configuration.
  • AirVPN, IVPN and Windscribe also have configuration generators in their account pages.

NordVPN and Private Internet Access do not give you a plain file, so they do not work here. A provider that offers only OpenVPN does not work either.

The file counts as one of your devices with the provider. If you delete that device on their site, the tunnel stops.

The file looks like this. The keys and addresses here are examples:

[Interface]
PrivateKey = yAnz5TF+lXXJte14tji3zlMNq+hd2rYUIgJBgB3fBmk=
Address = 10.64.222.21/32,fc00:bbbb:bbbb:bb01::1:de14/128
DNS = 10.64.0.1

[Peer]
PublicKey = xTIBA5rboUvnH4htodjb6e697QjLERt1NAB4mZqp8Dg=
AllowedIPs = 0.0.0.0/0,::0/0
Endpoint = 203.0.113.7:51820

2. Make sure that the Endpoint is an IP address

Look at the Endpoint line. It must be an IP address and a port, for example 203.0.113.7:51820. It must not be a name, for example nl-ams-wg-001.example.net:51820. The name lookups of the app go through the tunnel. Before the tunnel is up, there is nothing to look a name up with.

The files from Mullvad and Proton VPN already use addresses. If your file has a name, look for an option to use IP addresses when you make the file. Otherwise, look the name up yourself and put the address in its place. Keep the port:

dig +short nl-ams-wg-001.example.net

On Windows, nslookup nl-ams-wg-001.example.net does the same. A provider can move a server to a new address. If the tunnel stops one day, make a new file.

Mesopod checks this line, and the other lines that are necessary for the tunnel, when you deploy. It says what to correct, next to the field.

3. Deploy with the VPN on

  1. Open Catalog and select qBittorrent or Transmission.
  2. Under Configuration, select Route through a VPN.
  3. A WireGuard configuration field appears under Secrets. Paste the whole file into it. The field hides the text at once, like a password. Show shows it again if you want to read it.
  4. Deploy.

Like each secret, the file is encrypted before Mesopod stores it. When the app deploys, the platform decrypts the file in memory and seals it to the key of your machine. After that, only your machine can open it.

You select the VPN when you deploy. You cannot turn it on or off for an app that already runs. An app that you deployed before this option existed offers the checkbox again. That is when you upgrade it to the version that adds it, with Upgrade to … on its page. After the upgrade, the checkbox is fixed too.

If a cluster is greyed out

If the checkbox is selected, Where it runs greys out each cluster that cannot run a VPN app, and says why:

  • VPN apps are off on this cluster: someone turned them off. Open the page of that cluster. Under Settings, select the VPN apps checkbox and confirm with Turn on. The line beside the checkbox tells you if the install must run again (pending re-run).
  • re-run the install on this cluster to enable VPN: the cluster was installed before VPN apps existed, or while they were off. Run the install again on that machine. It is safe to run again, and it keeps everything.
  • this cluster's outpost has not reported its network ranges yet: the outpost reads the ranges when it starts. It reports them with its first state report. If that read fails, it tries again after 5 minutes. Wait a few minutes after a new cluster connects. Until then, the VPN apps line on the page of the cluster shows network ranges not reported yet. A cluster with more than 1 node stays in this state for now.

4. Make sure that the tracker sees the address of the VPN

The VPN container writes the address that it got to its log.

  1. On the page of the app, find Logs and click Start.
  2. In the filter, select the entry that ends in vpn. For qBittorrent, it shows Qbittorrent · vpn. The entry appears after that container writes its first line.
  3. Look for Public IP address is followed by an address. It must be an address of your VPN provider, not your home address.

To see what a tracker sees, use Torrent Address detection on ipleak.net. It gives you a magnet link. Add the link to the app, and the page lists the address that the tracker saw.

What goes through the VPN, and what does not

  • The internet traffic of the app goes through it. Its connections to peers and trackers, and its name lookups, leave through the tunnel. If the tunnel goes down, they stop. Nothing goes out over your home connection instead.
  • The web interface does not. You open it at its usual address at home. That traffic comes from your network and goes back the same way.
  • Traffic between your apps does not. Sonarr, Radarr and Prowlarr reach the app over a network grant, as before, under the same rules as any other app.
  • A VPN app cannot call other apps by name. Other apps can reach it. Its own name lookups go to the VPN, which knows nothing about the names in your cluster. qBittorrent and Transmission do not have to call Sonarr or Radarr, so the usual setup works.
  • There is still no inbound port. Mesopod does not forward a port through the VPN. The app can connect out to peers, but peers cannot connect to it. The notes of the app say the same.

If the tunnel does not come up

Mesopod checks the file before it deploys it. When you deploy, or when you replace the file on the Secrets page, Mesopod reads the file as the VPN container reads it. If the container could not use the file, Mesopod refuses the deploy or the change. It changes nothing and says what to correct, next to the field. The messages that you see most:

  • [Interface] PrivateKey is not a WireGuard key: it must be 44 characters of base64, as your provider gave it: part of the key is missing. Paste the whole file again.
  • [Peer] Endpoint must be the server's IP address and port (e.g. 203.0.113.7:51820), not a hostname: see step 2.
  • [Peer] Endpoint has no port: add it after the IP address (e.g. 203.0.113.7:51820).
  • [Interface] Address is missing or [Peer] PublicKey is missing: the file is cut short. Download it again.

The file is good, but the tunnel is not. A file can be correct and still not connect. The page of the app shows Degraded, and under it The VPN tunnel did not come up. This appears approximately 5 minutes after the deploy. The app waits for the tunnel and never starts without it.

Why it's not ready says what to check and links back here. If the VPN container stopped with an error of its own, the page shows that line instead. It shows The VPN sidecar stopped: followed by the words of the container.

To see why, open Logs on the page of the app, click Start, and select the entry that ends in vpn. The log follows the container that ran when you clicked Start. If the container restarts, the log ends. Click Stop and Start to read the new one. The usual causes:

  • A key that your provider does not know. The log says that the key is not valid, or the tunnel never completes a handshake. Make sure that you pasted the whole file, and that the device still exists in your account on the site of your provider.
  • A server that no longer answers. Providers retire servers. Make a new file for another server.
  • An IPv6 address on a machine without IPv6. Files from Mullvad and Proton VPN put an IPv6 address next to the IPv4 address on the Address line. If the kernel of the machine has IPv6 off, the VPN container refuses the file and logs interface address is IPv6 but IPv6 is not supported. Delete the IPv6 address from Address and keep the IPv4 address. Delete ::0/0 from AllowedIPs. Most machines never see this.

To use a corrected file, open Secrets and find the secret that the app uses. The list shows the app beside wireguard_config. Select Rotate value and paste the new file. The field takes the whole file with its line breaks. Mesopod checks the file, saves it and deploys the app again with it.