How to configure Deluge to only torrent when connected to a VPN?

General support for problems installing or using Deluge
Limp
New User
New User
Posts: 3
Joined: Mon Aug 29, 2016 9:54 pm
OS or Distro: Windows

How to configure Deluge to only torrent when connected to a VPN?

Postby Limp » Mon Aug 29, 2016 10:07 pm

Basically I want my Deluge config to be foolproof against VPN disconnects. It must not operate when disconnected from my VPN provider. My VPN provider has a built in kill switch in its service management utility for such events, but I'd rather not solely rely on it.

Can I achieve this functionality in Deluge? If so, where should I look for (in presumably Preferences) to enable?

Thanks

mhertz
Leecher
Leecher
Posts: 85
Joined: Wed Jan 22, 2014 5:05 am
OS or Distro: Arch Linux

Re: How to configure Deluge to only torrent when connected to a VPN?

Postby mhertz » Tue Aug 30, 2016 4:39 pm

There are multiple ways e.g. referenced here: viewtopic.php?f=7&t=49883

In the prefs of deluge, you can bind an IP, not an interface. I don't know if it's 100% working by using the IP of your VPN, but in theory it should I believe, but never had a need to verify it as personally using a socks5 proxy instead of VPN(I use ltconfig plugin to enable force_proxy flag of libtorrent which is "killswitch" for proxys). The above link has two methods; one using iptables to restrict, and another using the openvpn UP directive to run a script starting deluge with the binded IP of the VPN and a script in a cron-job run every 5 mins to restart openvn if down.

Limp
New User
New User
Posts: 3
Joined: Mon Aug 29, 2016 9:54 pm
OS or Distro: Windows

Re: How to configure Deluge to only torrent when connected to a VPN?

Postby Limp » Wed Aug 31, 2016 7:10 pm

mhertz wrote:There are multiple ways e.g. referenced here: viewtopic.php?f=7&t=49883

In the prefs of deluge, you can bind an IP, not an interface. I don't know if it's 100% working by using the IP of your VPN, but in theory it should I believe, but never had a need to verify it as personally using a socks5 proxy instead of VPN(I use ltconfig plugin to enable force_proxy flag of libtorrent which is "killswitch" for proxys). The above link has two methods; one using iptables to restrict, and another using the openvpn UP directive to run a script starting deluge with the binded IP of the VPN and a script in a cron-job run every 5 mins to restart openvn if down.


Thank you for your reply. Yeah I've seen that thread, but surely there's a cleaner method to achieve killswitch functionality? I prefer to use a built in option within Deluge, rather than use a script.

Is it correct that in order to achieve what I need, I just need to browse to Preferences > Network, and under the "interface" tab, enter the IP of my VPN provider I'm currently using?

Sorry for asking noob questions. I'm new to Deluge, and new to using a VPN in combination with a torrent application in general.

mhertz
Leecher
Leecher
Posts: 85
Joined: Wed Jan 22, 2014 5:05 am
OS or Distro: Arch Linux

Re: How to configure Deluge to only torrent when connected to a VPN?

Postby mhertz » Thu Sep 01, 2016 12:52 am

Yes, for strictly killswitch functionality, then binding to VPN IP through deluge prefs should be OK. However, the scripts and iptables are adding functionality of restarting deluge and the VPN when the VPN goes down and you can direct only deluge to use the VPN if wanted and use regular connection for everything else.

Limp
New User
New User
Posts: 3
Joined: Mon Aug 29, 2016 9:54 pm
OS or Distro: Windows

Re: How to configure Deluge to only torrent when connected to a VPN?

Postby Limp » Thu Sep 01, 2016 8:17 am

mhertz wrote:Yes, for strictly killswitch functionality, then binding to VPN IP through deluge prefs should be OK. However, the scripts and iptables are adding functionality of restarting deluge and the VPN when the VPN goes down and you can direct only deluge to use the VPN if wanted and use regular connection for everything else.


Okay, neat. I'll look into the scripts and iptables as well. Thank you very much.

kylepmorris5
New User
New User
Posts: 2
Joined: Tue Jul 19, 2016 12:50 pm
OS or Distro: Bittorrent

Re: How to configure Deluge to only torrent when connected to a VPN?

Postby kylepmorris5 » Fri Sep 16, 2016 11:38 am

There are two basic options when using VPN. I suggest you to use PureVPN with it. (PureVPN Review - https://www.bestvpnprovider.com/purevpn-review/)

Use the VPN as the primary connection with default routing passing through the VPN. This way all the traffic from the host uses the VPN.

Use the VPN connection only for specific traffic. All network traffic passes through the default interface except for the traffic you specifically want to route through the VPN interface.

Routing only specific traffic through the VPN interface can be useful, but is also the most tricky to configure.

Read Full Guide from here: http://dev.deluge-torrent.org/wiki/UserGuide/VPN

mhertz
Leecher
Leecher
Posts: 85
Joined: Wed Jan 22, 2014 5:05 am
OS or Distro: Arch Linux

Re: How to configure Deluge to only torrent when connected to a VPN?

Postby mhertz » Fri Sep 16, 2016 1:32 pm

Yes indeed, though it also works fine with e.g. PIA, which the OP uses. I recently gotten PIA also and set it up like described above i,e, only for torrenting and everything else goes through normal connection. I use linux though, where its much easier to setup than windows. I have a script I run which detects the VPN local address and starts torrent client with the IP binded to, so as getting VPN-tunneling+kill-switch behaviour only for the torrent app(I used rtorrent here though, but deluge works too). I'm trying to figure out if I want VPN or socks5 proxy in the feature. Socks5 is slightly faster but you need to trust the torrent-app/backend to not leak your IP. VPN is slightly overkill for torrenting imho(the encryption is only usefull here for throttling, but not all are throttled and the torrent-client can often fix that too with there encryption), but needed if not trusting 100% the socks5 proxying capabilities of the app used and also uses more cpu for the added encryption.

VPN only for torrenting on linux, is just a matter of adding 3 lines or so to your openvpn config-file and adding 2 batch-scripts which is auto-run on VPN up/down and is found online(can be made into a single script easily too) and then lastly a 2 lines script to retrieve vpn local ip and bind torrent-client of choice to it as means of starting your torrent-client.

Also, it's a possibility to use a VM only for torrenting, where you run your torrent-client through a sandboxed environment with only the VPN as connection to outside. Some added overhead indeed, but still a viable solution used by many.

This is also very easy for windows users. Just install e.g. VirtualBox and setup a small VM with OS of choice, and use that for torrenting through your VPN.

Team503
New User
New User
Posts: 4
Joined: Tue Apr 12, 2016 7:58 pm
OS or Distro: Server 2012 R2

Re: How to configure Deluge to only torrent when connected to a VPN?

Postby Team503 » Tue Sep 05, 2017 6:02 pm

This is also very easy for windows users. Just install e.g. VirtualBox and setup a small VM with OS of choice, and use that for torrenting through your VPN.


Well, unless you want to get to your downloads at some point. If you share the storage from the VM, then it needs a network interface to reach the rest of the network. Similar if you connect to shared storage on the LAN.

Team503
New User
New User
Posts: 4
Joined: Tue Apr 12, 2016 7:58 pm
OS or Distro: Server 2012 R2

Re: How to configure Deluge to only torrent when connected to a VPN?

Postby Team503 » Tue Sep 05, 2017 6:02 pm

And for a double-bump, is there any progress on binding to an interface instead of an IP? Functionally VERY different and seems like it would be very useful.

shamael
Super Seeder
Super Seeder
Posts: 278
Joined: Sat Oct 08, 2016 9:28 am
OS or Distro: osmc

Re: How to configure Deluge to only torrent when connected to a VPN?

Postby shamael » Wed Sep 06, 2017 11:55 am

There are some topics about namespace, creating a virtual interface bind to Deluge. Such way avoid any failback to the real IP out of VPN and remove the iptable change, I never tested them so far.

https://schnouki.net/posts/2014/12/12/o ... -on-linux/
https://gist.github.com/JimboMonkey1234 ... 1c7eef770d

Better solution to my perspective than iptable (idea at least) but yeah, as said not tested.


Return to “Support”

Who is online

Users browsing this forum: Bing [Bot] and 6 guests