Transmission Torrent Client – Bind to a specific network interface

mac-OS-X-wallpaper-logo

I wanted to configure Transmission to use a specific network interface, specifically a secure VPN connection, but the Mac GUI doesn’t have such an option within the preferences.

The wiki mentions using a ‘bind-address-ipv4’ option to have Transmission bind to a specific IP address of a network interface. I tried entering this option within the preferences plist file but it still didn’t work. After a long time digging thru the source code (thanks for making that available!), I found the section that loads the plist file and saw that the Mac GUI option has a slightly different option spelling of BindAddressIPv4. Adding the properly named option and the IP address of my VPN, Transmission properly bound to that network and all traffic is going over it! :D

So, how do you do it? First, quit Transmission as you don’t want to edit the config file while it is running. Transmission saves to it on quit so any changes you make while it is open will be overwritten.

You can either edit the plist file using the Property List Editor program, if you have the Apple Developer’s Tools package (aka XCode and friends) installed, or Terminal command line using the defaults command. I’ll show you both.

The plist file is located at ~/Library/Preferences/org.m0k.transmission.plist. You might want to make a backup copy of it before you start messing around with it.

If you have the DevTools, Property List Editor is located at /Developer/Applications/Utilities/Property List Editor. Either open it directly or right click on the plist file and choose Open With and Property List Editor should be an option.
When Property List Editor opens the plist file, it should have the Root dictionary selected. Simply click on the Add Child button which will create a New Item entry. Simply rename the item key to BindAddressIPv4 (case matters!) and press Tab to jump over to the Value field. Here you will enter the IP address of the interface you want to use. Make sure the Type remains a String.

Here is what mine looks like.

Image

Simply quit Property List Editor, saving the plist, then launch Transmission and it will bind to that IP address.

You can see this at the very beginning of the Debug level of the Window>Message Log.

Code: Select all

And if you really want, you can confirm it from a Terminal command line using the ‘lsof -i’ command, which lists your open network connections.

If you don’t have the DevTools installed, you can use the Terminal program located at /Applications/Utilities/Terminal.
Simply run Terminal then type in defaults write org.m0k.transmission bind-address-ipv4 69.80.103.21 but exchanging my example IP address (in red) for your interface’s IP address. When you press enter, it should come back to a prompt with no errors. Simply quit Terminal and launch Transmission.

Finally, you can also bind to a IPv6 address but using the BindAddressIPv6 option and proper v6 IP address. I’m not lucky enough to have IPv6 yet so I couldn’t test it.

The Downsides!

1- If the interface/IP address is not available (ie, the VPN isn’t established) then Transmission will not fallback to the primary connection but just sit there trying over and over to bind. You will only see this if you open the Message Log. You will need to re-establish the connection or remove the binding option using defaults delete org.m0k.transmission bind-address-ipv4 or using Property List Editor.

2- The automatic port mapping function within Transmission still found my default internet gateway (10.9.9.1) and configured the open port mapping in my modem. Since Transmission isn’t listening on that interface, the peer listening port is closed thus severely limiting my peer connections.

Code: Select all

At least in my situation, it is an external VPN so I can’t configure port mapping. If you have control of the gateway device (modem/router) for your alternate interface, you will need to manually open the port so that the peers can get in.

Good luck and I hope this helps.



Comments

comments

Leave a Reply