Deluge WebUI Single IP

DEPRECATED: This patch has been superseded by the inclusion of this feature within Deluge 1.3.14 and later (finally!). The info and patches below still apply to 1.3.x prior to revision 14, but it is best to upgrade if possible.

Stingy WebUI

The current release of Deluge, 1.3.11, as well as the development trunk do not contain a way to force the WebUI to bind only to a single interface or IP address. deluged does include both --interface and --ui-interface options. However, these both specify the IP address of the interface to listen on for BitTorrent connections and JSON-RPC connections respectively.

The result of this being that the Deluge WebUI will instead bind to, or all available interfaces on your machine.

jacob@ikumi:~$ sudo netstat -tlpn | grep deluged  
tcp  0  0*     LISTEN      1144/  
tcp  0  0*     LISTEN      1144/  
tcp  0  0*     LISTEN      1144/  
tcp  0  0*     LISTEN      1144/  

The first line of the above output of netstat shows the undesirable results of being unable to specify the WebUI interface IP address. While not a problem in most circumstances, if you have a server with many IP addresses, you generally don't want an application such as Deluge occupying the same port on an entire /29 net block. You may have already noticed this issue if you have attempted to run multiple instances of Deluge, both using the default port 8112 for the WebUI, as you would have received an error when trying to bind to the address, as it's already occupied. Of course, you could just change each instance to use its own unique port number.

Making the changes

A git-diff patch to apply the necessary changes automagically to the source is probably the best/easiest solution. Patch and application instructions are provided in the next section

Before starting

Ensure you have a copy of the Deluge source code, preferably cloned from the git repo. Full instructions on fetching, building and installing Deluge from source can be found here.

git clone git://  

Be sure that you have checked out the current stable branch of Deluge.

git checkout -b 1.3-stable origin/1.3-stable  

Digging in

Searching through the source, we can see the file where the listener is bound is located in deluge/ui/web/

self.socket = reactor.listenTCP(self.port,  

Since Deluge uses the Twisted library to handle communication, the documentation is readily available for reference. Checking the (rather terse) documentation page for listenTCP, we can see that there are two additional arguments that can be passed to the Twisted listener object. We can modify our listenTCP call to include the interface we want to use, instead of using the default listen-to-all-the-things mode.

self.socket = reactor.listenTCP(self.port,, 50, self.iface)  

The third argument is backlog-- we don't really care about this, so we'll use the default value of 50 (see the linked documentation). self.iface is our new property we'll be using for the interface. Note that the same change can be made for the SSL listener:

self.socket = reactor.listenSSL(self.port,, ServerContextFactory(), 50, self.iface)  

listenSSL has an additional ServerContextFactory() argument which was a part of the original call.

Adding our new config value

We also need to initialize the iface attribute to the value specified in the webui.conf file parsed by deluged. To do so, find the __init__ method, and you will notice the section where the other attributes are being initialized-- add our new option to the list:

self.iface = self.config["iface"]  

It's also probably a good idea to set a default value, in case one isn't specified in the config file, otherwise Twisted might freak out. Find the CONFIG_DEFAULTS object and add a default value for iface:

"iface": "",


Rather than editing the source (for fun or out of curiosity), the easiest way would be to just apply the patch.

Patch (diff):

Updated for v1.3.13

To apply the patch, you should have a clean, working copy/clone of the source. Change the the directory where the source is located and run the following:

git apply deluge_1313_webui_ip.diff  

Building & Installing

Full build and installation instructions can be found on Deluge's website, so here is the tl;dr version:

python build  
sudo python install  

Building plugins:

cd deluge/plugins  
for i in */; do python $i bdist_egg ; done ; rm -Rf *.egg-info ; rm -Rf build ; mv dist/*.egg ./  

You can then either symlink, or copy the plugins to ~/.config/deluge/plugins for the user deluge will be running under.

If you receive errors about setuptools, then you will need to install them first, then rebuild/reinstall.

  • For Debian/Ubuntu/Mint: sudo apt-get install python-setuptools
  • For RedHat/CentOS/Fedora: (as root) yum -y install python-setuptools


After the build and installation are complete, ensure that you stop and restart deluged completely. I would also recommend enabling debug mode initially in case any problems arise.

Where do I change the IP?

Note that since our new option isn't integrated into the GUI, you will have to manually edit the config file to change it. On most systems, this is located in ~/.config/deluge/web.conf. This is a JSON file, so you can simply add a value like the following:

   "iface": "",

The config parser in Deluge will pick this up and use it for the WebUI IP address! You can still retain the old functionality by using "" to bind to all IP addresses, if you'd like.

Share on : Twitter, Facebook or Google+