How to use a specific network interface/device?

General support for problems installing or using Deluge
Post Reply
brianx
New User
New User
Posts: 5
Joined: Sun Apr 04, 2021 10:31 am

How to use a specific network interface/device?

Post by brianx »

Is it possible to redirect all deluge traffic through a specific network interface/device (e.g., tun1 or eth0)?

By the way, what is the role of Outgoing Interface in the Preferences?
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: How to use a specific network interface/device?

Post by mhertz »

In deluge2 you can bind to ip's for incoming and ip's or interfaces for outgoing(in deluge1 there was only an incoming option). However, Strangelovian has submitted very nice, still unmerged PR, adding ability to use interface names in both, plus comma-seperated several entries of ip's/interfaces(plus some IPv6 related additions), which I have tested works when previously built deluge with that PR on a windows VM and bound in/out to my VPN interface.

https://github.com/deluge-torrent/deluge/pull/300

Outgoing-interfaces sets libtorrent's outgoing_interfaces setting(incoming-interfaces likewise with libtorrent's listen_interfaces). It's role is tcp outgoing peer communication(incoming is incoming tcp, utp in/out, udp trackers and dht, so this is what gets brodcasted to swarm/trackers).
spmskr
Member
Member
Posts: 10
Joined: Sat Jul 25, 2020 3:10 am

Re: How to use a specific network interface/device?

Post by spmskr »

I tried to use the existing feature as a way to ensure deluge only uses the VPN interface - an easier way to go than netns, containers, proxies, and so on.

The connection would go down, and come up - in the time between the internet connection being available until the time the VPN connection became re-established, this setup leaked the real IP. I'm guessing it was the incoming that was the issue.

will the unmerged changes have an effect on this? It would be nice to get rid of the measures I'm currently taking (proxies)
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: How to use a specific network interface/device?

Post by mhertz »

No it doesn't change that. However I didn't seem to see that, but granted didn't sniff traffic with tcpdump or wireshark etc, but only saw that with VPN off, then no traffic in deluge UI and DHT showing 0 nodes and the ipmagnet test-torrent didn't anounce own IP when checking the ipmagnet site during pause/resume the test-torrent which forces reannounce, and always announced the VPN IP when VPN on and nothing when off. I used deluge2 and tested on windows VM, as have it available there already with said PR included so easiest to test, but shouldn't change anything, except if using deluge1 which only have the single incoming interface option and not the outgoing.

Sorry for off-topic, but personally I don't mess with this on my own system, and instead am much fond of namespaced-openvpn, which imho cannot get much easier than that, giving you full kill-switch and split-tunnel features by simply starting VPN through this openvpn-wrapper with same commands e.g. 'sudo namespaced-openvpn --config /etc/openvpn/client/vpn.conf --daemon', and then run whatever wanted protected, e.g. deluged, as: 'sudo ip netns exec protected sudo -u $USER deluged', done :) I have a shell-alias to run whatever wanted protected as 'vrun <app>', but only use it for deluge actually, and at times a protected web-browser instance if need be. Systemd files for deluged and deluge-web can still be used by e.g. adding drop-in files to add this to there execstart lines etc(or just add new service files), plus systemd service file available for project itself in issues section I saw. It's a small python script firering up openvpn with it's tunnel interface located into protected namespace and quits afterwards so not use extra resources, and is made little different/smarter than most other namespace solutions while giving additional security hardening against things like route-injection and port-fail etc, as detailed upon website.

https://github.com/slingamn/namespaced-openvpn

Anyway, I realize i've mentioned the above for too many times through last couple of years, somewhat of a fanboy honestly lol, so at risk of some people probably am annoyed by it i'd easily presume, so will shut up about it from now on atleast untill asked at least, sorry ;)
Charlweed
New User
New User
Posts: 1
Joined: Sun Jul 10, 2022 11:57 pm

Re: How to use a specific network interface/device?

Post by Charlweed »

Old question, but as of Jul 27, 2022, I can't configure the network for deluge-daemon by changing the values in core.conf.
"listen_interface": "<ipaddress>",
"outgoing_interface": "<device>",

To test, I use wireshark and nethogs. It always seems that deluge-daemon only uses the default network interface, or does not work at all. More specifically, If I use a either a device or an IP for 'outgoing_interface' torrents do not download nor seed.

I tried ipv4 addresses for listen_interface and a device for outgoing_interface, then I tried ips for both, then devices for both, then I swapped device and address. Wireshark and nethogs only show use of the default device no matter what the values are.

So, as the OP asked, How to configure deluge to use a specific network interface/device?
Can this be done without firewall rules, custom routing, etc.?

I have Deluge Server 2.0.3, Deluge Server 2.0.3, libtorrent 1.1.13.0

BTW I also use a proxy. Might that matter?

TY!
Post Reply