HowTo: Bind to a specific network interface

Ask for help and report issues with the Mac OS X version of Transmission
scott451
Posts: 3
Joined: Fri Jan 20, 2012 11:24 pm

Re: HowTo: Bind to a specific network interface

Post by scott451 » Thu Aug 29, 2013 7:04 am

hi,

i've been looking at this same question since i switched to openvpn. i've got things rolling by binding the ip address, but binding to an interface seems so much cleaner.

i hesitate to plunge into building transmission ; does anyone know if the patch from #2313 every made it into a nightly build ? thanks !


- scott

x190
Posts: 5094
Joined: Sun Nov 30, 2008 4:59 am

Re: HowTo: Bind to a specific network interface

Post by x190 » Thu Aug 29, 2013 8:17 am

No.

#2313 (comment:99) has got a prebuilt model you can download.
The stone age didn’t end because we ran out of stones.
---The Great Disruption - by Paul Gilding
https://paulgilding.com/
-------------------------------------------------

jonny_noog
Posts: 5
Joined: Wed Aug 20, 2014 11:23 am

Re: HowTo: Bind to a specific network interface

Post by jonny_noog » Sun Aug 24, 2014 10:00 am

Sorry to dig up an old thread, but reading through what's here and the related ticket, I was just wondering what the current situation is in relation to exclusively binding Transmission to a specific interface? Would I be correct in assuming this feature has not made it into the standard build of Transmission? If so, are there any plans for this to happen at any point?

x190
Posts: 5094
Joined: Sun Nov 30, 2008 4:59 am

Re: HowTo: Bind to a specific network interface

Post by x190 » Sun Aug 24, 2014 11:36 pm

Would I be correct in assuming this feature has not made it into the standard build of Transmission?
Yes.
If so, are there any plans for this to happen at any point?
No.
The stone age didn’t end because we ran out of stones.
---The Great Disruption - by Paul Gilding
https://paulgilding.com/
-------------------------------------------------

jonny_noog
Posts: 5
Joined: Wed Aug 20, 2014 11:23 am

Re: HowTo: Bind to a specific network interface

Post by jonny_noog » Mon Aug 25, 2014 7:59 am

x190 wrote:
Would I be correct in assuming this feature has not made it into the standard build of Transmission?
Yes.
If so, are there any plans for this to happen at any point?
No.
You're a man of great lingual economy, sir. Thanks for the confirmation.

mbtm
Posts: 7
Joined: Mon Dec 28, 2015 2:42 pm

Re: HowTo: Bind to a specific network interface

Post by mbtm » Tue Jan 02, 2018 10:31 pm

Anything new here? It looks like a few people have written patches, but I don't see anything indicating that these patches have been successfully incorporated into any recent builds.

hbwhite
Posts: 16
Joined: Tue Feb 27, 2018 10:55 pm

Re: HowTo: Bind to a specific network interface

Post by hbwhite » Wed Feb 28, 2018 1:04 am

Hey guys, I just wrote an app that adds this feature to Transmission on Mac. It's fully open-source and automatically updates the "BindAddressIPv4" (or IPv6) option in Transmission's preferences when the IP address of the binding interface changes.

It's a separate app so it doesn't require patching, and it should work with future versions of Transmission automatically. I hope this helps people who have been waiting for this feature on Mac.

More information and download links are in my post here: (I didn't want to copy-and-paste the same post)

viewtopic.php?f=5&t=18944

fuori
Posts: 2
Joined: Fri Jul 13, 2018 12:25 pm

Re: HowTo: Bind to a specific network interface

Post by fuori » Fri Jul 13, 2018 12:41 pm

Hi guys,

I second hbwhite's Clutch, using it now on macOS 10.13.5 and it works like a charm!

Best,
Matt

Marc31
Posts: 47
Joined: Thu Dec 06, 2007 12:01 am

Re: HowTo: Bind to a specific network interface

Post by Marc31 » Fri Jan 25, 2019 9:17 pm

Transmission Interface Binder works like a charm since 2015 (the while on macOS Mojave)
*∞ since 1984

rrossorr
Posts: 2
Joined: Tue Feb 19, 2019 11:28 pm

Re: HowTo: Bind to a specific network interface

Post by rrossorr » Wed Feb 20, 2019 12:10 am

The URL to download "Transmission Interface Binder" is broken. I installed Clutch and works great.

davids
Posts: 5
Joined: Thu Feb 28, 2019 1:50 am

Re: HowTo: Bind to a specific network interface

Post by davids » Thu Feb 28, 2019 2:15 am

While Transmission Interface Builder works perfectly, I decided to try Clutch v1.1 because it is IPv6 smart, even though currently only using IPv4. I also like that the Clutch interface can be opened from macOS's status bar and it seems smarter then Transmission Interface Builder in that it doesn't appear to restart Transmission if the VPN has restarted but the IP address of ppp0 is still the same as the one Transmission is already bound too. However, there seems to be a bug in Clutch that causes Transmission to not download when i first reboot my Mac. I have a script on a timer that (re)connects a L2TP tunnel to the VPN if it's not already running that starts the VPN when the computer boots.

If I use Clutch to unbind Transmission from ppp0 and rebind, then Transmission starts downloading. But if I reboot the Mac while everything is working, when it restarts Transmission is again not working. It's odd because Clutch says that it's bound to ppp0 and has the correct IP address.

hbwhite
Posts: 16
Joined: Tue Feb 27, 2018 10:55 pm

Re: HowTo: Bind to a specific network interface

Post by hbwhite » Thu Feb 28, 2019 3:08 am

If I use Clutch to unbind Transmission from ppp0 and rebind, then Transmission starts downloading. But if I reboot the Mac while everything is working, when it restarts Transmission is again not working. It's odd because Clutch says that it's bound to ppp0 and has the correct IP address.
Hi, I'll look into this tomorrow. After you reboot, does Transmission work if you close it and open it again, or does it only work if you unbind/rebind in Clutch?

Update: I'm guessing here, but I assume the local binding IP for your ppp0 interface is always the same, and therefore Clutch never needs to restart Transmission. Also, there may be a bug in Transmission where it fails if it tries to bind to your ppp0 interface before the interface is ready. If simply restarting Transmission fixes the problem, you may just need to add the commands to restart Transmission at the end of your script.

You are a special case because you're using a custom script, while I think most people are using normal VPN clients.

hbwhite
Posts: 16
Joined: Tue Feb 27, 2018 10:55 pm

Re: HowTo: Bind to a specific network interface

Post by hbwhite » Thu Feb 28, 2019 6:10 am

Clutch v1.2 is now available:
https://mega.nz/#!2IAXUYJL!jN7EBqaT9mFQ ... GhfLqjxT9c

Version 1.2 adds support for Dark Mode in macOS Mojave and includes other improvements.

davids
Posts: 5
Joined: Thu Feb 28, 2019 1:50 am

Re: HowTo: Bind to a specific network interface

Post by davids » Thu Feb 28, 2019 8:48 pm

hbwhite wrote:
If I use Clutch to unbind Transmission from ppp0 and rebind, then Transmission starts downloading. But if I reboot the Mac while everything is working, when it restarts Transmission is again not working. It's odd because Clutch says that it's bound to ppp0 and has the correct IP address.
Hi, I'll look into this tomorrow. After you reboot, does Transmission work if you close it and open it again, or does it only work if you unbind/rebind in Clutch?

Update: I'm guessing here, but I assume the local binding IP for your ppp0 interface is always the same, and therefore Clutch never needs to restart Transmission. Also, there may be a bug in Transmission where it fails if it tries to bind to your ppp0 interface before the interface is ready. If simply restarting Transmission fixes the problem, you may just need to add the commands to restart Transmission at the end of your script.

You are a special case because you're using a custom script, while I think most people are using normal VPN clients.
Call me cautious, but I prefer using macOS's internal VPN capability to having another app running as a service -- but not enough to stop me from running Clutch. :-) You are correct that the IP of my VPN connection does not change. Surprisingly, the IP address stays the same even if I connect to the VPN via a different IP address for the VPN server to which macOS makes the L2TP Over IPSec tunnel.

I just installed Clutch v1.2 and rebooted and Transmission still wasn't working. So I restarted Transmission as you suggested and you were correct that Transmission worked. I watched the Mac booting and it appeared the the order of things starting was (1) Clutch, (2) Transmission and then (3) the VPN. All three are started because they are "Login Items" for my user. Actually, the script below is started by Login Items and it sees that there's no connection to the Newshosting VPN and starts it. As far as I know, there is no way to control the order Login Items are started and all three start essentially simultaneously. The start up order I am seeing probably reflects that it takes less time to launch Clutch than Transmission and connecting to the VPN takes the most time. I could add a restart of Transmission to the script (below), but isn't there still a chance at startup that Transmission starts before Clutch has updated BindAddressIPv4? It would be more reliable if Clutch restarted Transmission if it detects that ppp0 hadn't existed but now does, even if the VPN's IP address hasn't changed. Would your app have a problem with this order and if so could this be an easy fix?

Thank you so much for working on this!

David

on idle
tell application "System Events"
tell current location of network preferences
set myConnection to the service "Newshosting"
if myConnection is not null then
if current configuration of myConnection is not connected then
connect myConnection
end if
end if
end tell
return 120
end tell
end idle

hbwhite
Posts: 16
Joined: Tue Feb 27, 2018 10:55 pm

Re: HowTo: Bind to a specific network interface

Post by hbwhite » Thu Feb 28, 2019 9:54 pm

Call me cautious, but I prefer using macOS's internal VPN capability to having another app running as a service
Totally understandable. I personally use Tunnelblick because it's an open-source OpenVPN client (macOS doesn't support OpenVPN), and last I checked the NSA hadn't cracked OpenVPN while L2TP might have been compromised (call me cautious haha).
It would be more reliable if Clutch restarted Transmission if it detects that ppp0 hadn't existed but now does
Yep, that's what we need. I'll build this into version 1.3 and post a link here. I'm also adding automatic updates into v1.3 so people don't have to keep checking here.

So I think this is what's happening:
1. Clutch starts and looks for your ppp0 interface. Because it can't find it yet, it doesn't do anything.
2. Transmission starts and tries to bind to the old IP address of the ppp0 interface. The bind fails because the interface isn't up yet, so Transmission gets stuck.
3. Your VPN starts and the ppp0 interface goes online.
4. Clutch checks your interfaces every 10 seconds, and it sees the ppp0 interface is online. But because the binding IP address is the same as last time, it doesn't restart Transmission.

I'll post an update soon, thanks for identifying this issue!

Post Reply