Configure qBittorrent to block transfers on VPN disconnect
If you are using a virtual private network while downloading torrents, then you may be interested in an option that qBittorrent makes available that blocks transfers automatically if the VPN connection drops.
VPNs are useful to improve your privacy on the Internet but like any other connection, they may disconnect from time to time.
While some services come with kill switches that prevent data transfers until the VPN connection has been established again, it is not the case for all and usually only available if you use a program provided by the VPN to connect to it but not if you use the operating system's build-in functionality to do so.
qBittorrent and VPNs
One feature of qBittorrent, a popular cross-platform torrent client, is such a kill switch. Basically, what it does, is monitor a specific network connection to block all file transfers (up and down) if the network connection changes.
This can be useful to block torrent traffic if the connection to the VPN terminates, but also for other things like making sure that torrents are only downloaded or uploaded when the device is connected to a specific network adapter (say only when it is connected to Ethernet and not Wifi).
Here is what you need to do to configure the feature:
First thing you need to do is find out how the network connection / adapter that you want qBittorrent to use exclusively is named.
If you know that already, skip the following step.
- Use Windows-Pause to open the Windows Control Panel.
- Select Control Panel Home on the screen that opens.
- Select Network and Internet from the selection menu.
- Click on Network and Sharing Center on the next page.
- Select change adapter settings.
- There you find listed all network connections. Identify the one used by the VPN.
Once you know the name of the network connection, you may set up qBittorrent to use it exclusively.
- Open the qBittorrent program on your system.
- Select Tools > Options, or use the shortcut Ctrl-O to do the same.
- Switch to the advanced listing.
- Scroll down until you find "network interface" listed as a setting.
- Click on "any interface", and switch the value to the network connection you have identified previously.
- Click apply and ok.
- Restart qBittorrent.
It may be a good idea to test the setting to make sure it works correctly. What you can do is use a different connection, e.g. no vPN connection and start the program to see if traffic is blocked. Or, and that may be even better, start qBittorrent connected to the exclusive network connection you have configured, and terminate that connection after a moment to see if the BitTorrent client will block all traffic. (Thanks Don)
I’d be interesting in configuring Transmission the same way on a VPS.
I tried to get this to work on Xubuntu 15.10 without any success. It just kept downloading regardless of the interface setting.
Aparrently it was a bug that was fixed in version 3.2.5. Meanwhile, Ubuntu’s repositories are still stuck at 3.2.3. One way to get a recent version is through the qbittorrent PPA:
Now it works for me. Thanks for the article!
Didn’t know about this feature. It makes me want to try out qBittorrent again.
However, the best way to auto-block internet connections when the VPN is down is to use a script in your router, via something like ddwrt or openwrt.
But I’m all for adding layers of protection!
What qualifies this as ‘the best way to auto-block”? Does it block connections faster? How much faster? If it is faster, does it even matter that it is faster?
This of course makes it so you can’t use qbittorent when you aren’t on the VPN. Guess you can’t it both ways of course, or has someone made a qBittorent plugin that detect which network only works for the session? Like if the network you used to connect to for the session is interrupted whether that be your regular or VPN session the client shuts down.
Tried it, but I can only choose from wired and wireless networks, the vpns that are availabe on my computer don’t show under network interace in qbittorrent.
Yes, it doesn’t seem to see Windows VPN adapters. I use Private Internet Access which installs a TAP-Windows Adapter connection which its VPN client then uses. That one does appear in the qBittorrent list.
Although the Private Internet Access client does itself offer a kill switch option it is very problematic in use and can leave your system unable to access the internet at all if the service is not “properly” closed.
Have been doing this for some time.
However, perhaps with the specific VPN provider I use, have found one possible issue / vulnerability…
If the VPN does not fully disconnect, but it “times out” (in that limbo state similar to when first establishing a connection but before getting an IP address), qbittorrent still seems to be “uploading” (i.e. the Total Upload Graph is not flat, but will have some lifts and even spikes in it, indicating that the magnitude of the amount of sending info has not changed from before the “time out” ).
Don’t know enough to explain what this is about, but was surprised that all traffic was not completely stopped.
I would think attempts would account for the blips on the graph when down.
Does anyone know how do the first steps on a mac?
Emmy, you could skip the network adapter step as qBittorrent lists them all in its interface. Maybe you can identify the right one there directly.
Copy and pasted from a reddit thread since it took me a while to figure this out:
Hey, an easy way to do it is to use the ifconfig command to display all active network interfaces. Do it with VPN on, then do it again with VPN off. The missing interface is the VPN.
Great article – thanks for the tip and walkthrough instructions!
As an additional suggestion (just to make the process idiot proof) within ‘Adapter Settings’ right click on your VPN adapter connection and Rename the connection something explicit, like “VPN Connection”. Whatever name you give it will show up in qBittorent as a connection option, simplifying the selection process.
Warning: if using windows, THIS DOES NOT WORK IF YOU HAVE IPV6 ENABLED ON YOUR SYSTEM.
It seems that bittorrent does not respect the interface binding setting if ipv6 is enabled.
You can test this by using the ipleak.net Torrent Leak detection (to check the kill switch, do this while your VPN is disabled):
– if only ipv4 is enabled on your system and the interface is properly configured on qBittorrent, you will not be detected (while the VPN is down, no data goes through)
– if ipv6 is enabled, ipleak.net will show your ipv6 address.
I am using a Free VPN in FireFox called “SETUPVPN”
Can someone please advise how to configure qBbitorrent with SETUPVPN.
SETUPVPN. it is an extension for Firefox and works quite well. However I require Kill Switch capability.
Thank you in advance!!!!!!!!
Thanks in advance,
This was truly a lifesaver. I understand there are other risks and probably plenty of other things I need to research in order to be secure, but this is a great start. Thank you
I can’t believe all the things I tried to get this outcome only to find this solution weeks later… and it’s this simple. SMH! thank you. (I’ll check out that ip6 thing too.)
This is a game changer, thank you.
Worked perfectly – thank you!
I’ve just set this up using AirVPN and it works perfectly :)
First time I tried this it works fine. But know I keep doing the same think but qbitorrent doesnt work for nothing! I have lost 2 hours of my life with this issue so i’m so frustrated and angry. I uninstalled it more than once, reinitiate windows, check firewall. Nothing works.
Forget it there are others that are working fine have done for years why even bother with all this bull. The thing is a pain in the we binned it, when it cuts of the net its a piece of shit. The net is full of crap programs & this is one of them
I just wanna say THANK you for the best and most simple explanation of fthe easiest way to do it, Much appreciated from a linux user.
Awesome! Thank you for this! Still a great solution in March 2021. VPN disconnected when I was asleep which caused problems with my ISP. Problem solved.
Great. Works. Now how do you get qBittorrent to resume downloading once the VPN connection is re-established? I have to restart the program every time.
Tried this on linux Mint 20.2 with qbitorrent v4.1.7, my VPN was “tun0” and I tested disconnecting the VPN and indeed the torrents “Stalled” and qbitorrent even notified me that the network had been disconnected. Which is perfect!
There’s a problem though… When I re-enabled the VPN, qbittorent never resumed the torrents, there were all “stalled”, I waited a couple of minutes but I ended up having to resume them manually (I did a “force re-announce”). Surely it should resume automatically once the VPN “tun0” is up and running?
Got a call from my ISP even though I was using my VPN. I’m hopeful this method prevents any torrenting if coming from my ISP’s routing. They told m the exact things I was downloading and the times. Has anyone here been called by their ISP even using a VPN?