HowTo: Bind to a specific network interface

Ask for help and report issues with the Mac OS X version of Transmission
Marc31
Posts: 47
Joined: Thu Dec 06, 2007 12:01 am

Re: HowTo: Bind to a specific network interface

Post by Marc31 »

Transmission Interface Binder works like a charm since 2015 (the while on macOS Mojave)
rrossorr
Posts: 2
Joined: Tue Feb 19, 2019 11:28 pm

Re: HowTo: Bind to a specific network interface

Post by rrossorr »

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 »

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: 18
Joined: Tue Feb 27, 2018 10:55 pm

Re: HowTo: Bind to a specific network interface

Post by hbwhite »

[deleted]
Last edited by hbwhite on Tue Feb 09, 2021 7:13 pm, edited 2 times in total.
hbwhite
Posts: 18
Joined: Tue Feb 27, 2018 10:55 pm

Re: HowTo: Bind to a specific network interface

Post by hbwhite »

[deleted]
Last edited by hbwhite on Tue Feb 09, 2021 7:13 pm, edited 2 times in total.
davids
Posts: 5
Joined: Thu Feb 28, 2019 1:50 am

Re: HowTo: Bind to a specific network interface

Post by davids »

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: 18
Joined: Tue Feb 27, 2018 10:55 pm

Re: HowTo: Bind to a specific network interface

Post by hbwhite »

[deleted]
Last edited by hbwhite on Tue Feb 09, 2021 7:12 pm, edited 2 times in total.
davids
Posts: 5
Joined: Thu Feb 28, 2019 1:50 am

Re: HowTo: Bind to a specific network interface

Post by davids »

I suspect that checking for the ppp0 interface is a lightweight process, but it why is it necessary to check every 10 seconds? If Transmission is already bound to a VPN's IP address by having BindAddressIPv4 and BindAddressIPv6 stored in its configuration file, that means it will not be able to send or receive unless the VPN is operating at those addresses. Therefore, 10 seconds is the maximum time Transmission would not be operable before it is bound to the VPN's IP address and restarted. Waiting a minute or two hardly seem too long. There is a security risk only if BindAddressIPv4 and BindAddressIPv6 haven't been stored before Transmission starts. My concern probably probably reflects having worked extensively with 2 MHz Z80 CPU's. At one time the IBM PC's 4.77 MHz pseudo-16bit CPU (16-bit addresses but fetching data 8-bits at a time) was state of the art!

BTW, it would be helpful if when one clicks on the Clutch icon in macOS's status bar, it displayed Clutch version number.
hbwhite
Posts: 18
Joined: Tue Feb 27, 2018 10:55 pm

Re: HowTo: Bind to a specific network interface

Post by hbwhite »

[deleted]
Last edited by hbwhite on Tue Feb 09, 2021 7:12 pm, edited 2 times in total.
hbwhite
Posts: 18
Joined: Tue Feb 27, 2018 10:55 pm

Re: HowTo: Bind to a specific network interface

Post by hbwhite »

[deleted]
Last edited by hbwhite on Tue Feb 09, 2021 7:12 pm, edited 2 times in total.
davids
Posts: 5
Joined: Thu Feb 28, 2019 1:50 am

Re: HowTo: Bind to a specific network interface

Post by davids »

Hbwhite,

Clutch v1.3 works great!

Thanks,
David
hbwhite
Posts: 18
Joined: Tue Feb 27, 2018 10:55 pm

Re: HowTo: Bind to a specific network interface

Post by hbwhite »

[deleted]
Last edited by hbwhite on Tue Feb 09, 2021 7:12 pm, edited 2 times in total.
ciilo
Posts: 1
Joined: Tue Dec 22, 2020 10:18 pm

Re: HowTo: Bind to a specific network interface

Post by ciilo »

this is amazing! thank you for your work, it looks to be an elegant solution that is exactly what i was looking for. alas! i'm working on a mac pro that is maxed at 10.11 el capitan and clutch requires 10.13 minimum. could i pay you to make this a script i could implement on el cap? i think i understand what all is happening here but it's just past the edge of my understanding enough that i don't want to try and f anything up! i'm hosting a vpn on the machine in question with os x server while simultaneously a client on another vpn for transmission, thus the binding. i'd gladly pay for your time to build this for 10.11 or for you to adapt the script for me. i'm running an ipsec0 vpn client on en2 (wifi) and serving an l2tp vpn on bond0 (ethernet bonded). thanks for your time!
hbwhite
Posts: 18
Joined: Tue Feb 27, 2018 10:55 pm

Re: HowTo: Bind to a specific network interface

Post by hbwhite »

Update: This project has been discontinued.
unifex
Posts: 1
Joined: Sun Jun 11, 2023 11:11 am

Re: HowTo: Bind to a specific network interface

Post by unifex »

Binding to a specific i.p. address is extremely useful. Please do not remove this functionality from transmission.

For instance, if one is behind a vpn, you can bind to that i.p. address and if your vpn goes down, transmission will stop and you remain hidden.

After having my vpn go down and torrents continue to run, I received nasty-grams from comcast threatening me with a lifetime internet ban as well as a string of cease and desist letters from Disney.

I then wrote my bash script to prevent this from happening and have had no problems since then.
Post Reply