Force qBittorrent to listen on a particular network interface

Bug #578862 reported by Christophe Dumez
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Christophe Dumez

Bug Description

I have Linux/Ubuntu installed on my computer. I sometimes use qbittorrent with a VPN connection ( in order to connect to the Internet through a proxy and make my IP address anonymous, If the VPN connection went down, though, qbittorrent would still be running, and my IP address would no longer be anonymous.

With Windows, there's a neat little program called VPNetMon that will close the torrent application if the VPN connection goes down. But VPNetMon only works with windows.

If I'm running Ubuntu, how can I make sure that qbittorrent will automatically close if the VPN connection goes down?

Revision history for this message
Christophe Dumez (hydr0g3n) wrote :

Here is the patch I propose. It would be nice if you could test it.

You should be able to apply it on qBittorrent v2.2.x with this command:
patch -p0 -i interface_settings.patch

Please keep me posted.

Note that the network interface should be defined from advanced properties and that qBittorrent should be restarted.

Changed in qbittorrent:
assignee: nobody → Christophe Dumez (hydr0g3n)
importance: Undecided → Wishlist
milestone: none → 2.3.0
status: New → Fix Committed
Revision history for this message
Robert John Bennett (rjbennett-post) wrote :

Okay, many thanks for your quick response. Maybe I didn't do it in the right way, but I entered the patch in the terminal, and here's a copy of what I did and what happened:
inu@inu-desktop:~$ gedit patch -p0 -i interface_settings.patch
Unknown option -p0
Run 'gedit --help' to see a full list of available command line options.
I don't know much about computers or about Ubuntu, so if I didn't enter the correct command for installing the patch, please let me know what I should do.

Revision history for this message
Christophe Dumez (hydr0g3n) wrote :

hmm :) gedit is for displaying and editing, not for applying patches.
If you are not familiar with patch utility and compilation, I suggest you simply wait for v2.3.0 release because this is not an easy task.

Revision history for this message
Robert John Bennett (rjbennett-post) wrote :

No, unfortunately I'm not familiar with the patch utility and compilation, so unless I can figure that out, I'll wait for v2.3.0. Many thanks for your efforts. If the patch can be applied and if it solves the problem, I think there are a lot of people who will be grateful, judging from the discussion of this problem in the forums.

Changed in qbittorrent:
status: Fix Committed → Fix Released
Revision history for this message
Bob/Paul (ubuntu-launchpad-bobpaul) wrote :

This seems to work in that it forces qbittorrent to use a specific network interface, however qbittorrent gets confused if there are multiple default gateways. For example, I have the following setup with qbittorrent locked to the wlan0 interface:

     $ route -n
     Kernel IP routing table
     Destination Gateway Genmask Flags Metric Ref Use Iface U 2 0 0 wlan0 U 1 0 0 eth0 U 1000 0 0 eth0 UG 0 0 0 eth0 UG 0 0 0 wlan0

One would think since qbittorrent is limited to the wlan0 interface, it would also use as its default gateway. It does not, and still tries to connect on This means that with the above routing table, qbittorrent actually stalls all torrent activity. Deleting the eth0 default gateway causes all internet traffic to go through the wlan0 interface, including qbittorrent.

It's nice that qbittorrent refuses to use eth0 when configured to use wlan0, but I'd prefer if I could have both enabled and send qbittorrent (and a few other apps) down wlan0 with everything else defaulting to eth0.

Revision history for this message
Christophe Dumez (hydr0g3n) wrote :

I'll look into it. Sure looks like a bug.

Changed in qbittorrent:
status: Fix Released → Triaged
milestone: 2.3.0 → 2.8.6
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.