How to use a different bind IP address in TorrentFlux

TorrentFlux is a web-based PHP front-end for the BitTorrent client BitTornado. It’s a great software to download torrents on Linux servers that have no desktop manager installed.

BitTornado uses the server’s default IP address for it’s peer-to-peer connections by default. If your server has multiple IP addresses, you may want to assign a different IP address for the torrent traffic. All you have to do is to specify a bind parameter in the TorrentFlux settings. On Debian-based servers however, downloading stops instantly if the bind parameter is specified. After doing some debugging I found out that is has to do with how the parameters are passed from TorrentFlux to BitTornado. A small modification to the index.php file will fix this problem. Here’s how to do it.

Open TorrentFlux’ admin settings and specify the bind parameter with quotes. It’s important that the quotes are escaped or the SQL backend will complain when updating the record.

--bind \'123.345.567.789\'

Locate TorrentFlux’s index.php file. On Debian-based OS it’s most likely in /usr/share/torrentflux/www. Around line# 71 there’s a line of code that reads:

$command .= " ".escapeshellarg($cfg["cmd_options"]);

Remove the escapeshellarg function call so the line reads like this:

$command .= " ".$cfg["cmd_options"];

Don’t forget to create a backup copy of the files you’re about to modify.

From now on, every time you start a new torrent download, your specified bind IP address will be used. Check with the netstat command if the new bind address is really being used.

By the way, if you want to change the IP address or virtual host-name TorrentFlux is served from, you’ll have to modify your web server configuration accordingly.

One reply on “How to use a different bind IP address in TorrentFlux”

Comments are closed.