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!
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.
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
- Shell12011-03-16 23:04:43 -0600 net.c:414 [Debug] Transmission: Bound socket 11 to port 49921 on 22.214.171.124
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 126.96.36.199 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.
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
- Shell12342011-03-16 23:04:47 -0600 upnp.c:113 [Info] Port Forwarding (UPnP): Found Internet Gateway Device "http://10.9.9.1:5555/ctl/IPConn"2011-03-16 23:04:47 -0600 upnp.c:115 [Info] Port Forwarding (UPnP): Local Address is "10.9.9.21"2011-03-16 23:04:47 -0600 upnp.c:221 [Info] Port Forwarding (UPnP): Port forwarding through "http://10.9.9.1:5555/ctl/IPConn", service "urn:schemas-upnp-org:service:WANIPConnection:1". (local address: 10.9.9.21:49921)2011-03-16 23:04:47 -0600 upnp.c:224 [Info] Port Forwarding (UPnP): Port forwarding successful!
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.