Page 1 of 1

BInd to multiple addresses (and ports)

Posted: February 9th, 2008, 1:03 pm
by sander
Hi,

It would be nice if SABnzbdplus could bind to multiple addresses (and maybe ports). That way, SAB would be reachable on all it's IPv4 and IPv6 addresses, i.e. 127.0.0.1, 192.168.1.72, 2001:888:197d::1 and maybe it's host name.

I know nothing about CherryPy, but hopefully this gives a solution: http://www.cherrypy.org/changeset/1217 saying
Fix for #537 (Support for listening on multiple ports). cherrypy.server now has no "httpserver" attribute; instead, it has an "httpservers" attribute, a dict of the form {server object: bind_addr} where bind_addr is usually (host, port). New start_all method. Calling stop stops all httpservers, and restart stops all then restarts all.
Thanks!

Re: BInd to multiple addresses (and ports)

Posted: February 9th, 2008, 1:57 pm
by switch
Host="0.0.0.0" will listen on multiple interfaces. Allowing you access via both localhost/ip address on different interfaces.

CherryPy 3.0 has support for listening on custom interfaces
Multiple HTTP server support

The new cherrypy.server object can now control more than one HTTP server. Add additional ones via server.httpservers[myserver] = (host, port). This can be used to listen on multiple ports or protocols.
It is not-known when we will add CherryPy 3 support, but it shouldn't be too far off.

Re: BInd to multiple addresses (and ports)

Posted: February 10th, 2008, 4:56 pm
by sander
0.0.0.0 works for IPv4, but not for IPv6 like http://[::1]:8080/sabnzbd/queue/

I see CherryPy 3.0 was released on 2006-12-23, so indeed that should contain the mutiple-interface change I linked to.

Re: BInd to multiple addresses (and ports)

Posted: April 2nd, 2008, 8:25 am
by beenthere
Hi,

I too, would like to get IP Binding working with SAB, as this is the most missed feature when I switched from using Hella.

I am on OSX 10.5.2 (Mac Mini), and as OSX has ability to create IP Multihoming/multiple IPs per interfaces, I have setup multiple IPs, each using different gateways.

Basically, the reason for doing this is so that on one machine, I could have SAB downloading in the background binding to IP two using gateway two, while browse using the default IP one, on gateway one. This allows both my browsing, and my SAB NZB downloads to go full speed.

Would this configuration be possible on current SAB 0.3.4 on OSX? If so, could you point me to the direction of setting this up?

Thanks!

Re: BInd to multiple addresses (and ports)

Posted: April 5th, 2008, 7:59 am
by beenthere
[[[bump]]] anyone?

Re: BInd to multiple addresses (and ports)

Posted: April 14th, 2008, 6:17 am
by shypike
I have looked at this in the past.
The Python socket library does not support binding to a specific network interface.
So implementing this is a real big challenge.
Volunteers?

Re: BInd to multiple addresses (and ports)

Posted: April 14th, 2008, 9:34 am
by jcfp
sander wrote:0.0.0.0 works for IPv4, but not for IPv6 like http://[::1]:8080/sabnzbd/queue/
It is possible to make sabnzbd+ (tested on 0.4 beta 2) bind to all (and only) ipv6 addresses, by specifying --server :::8080 (so without any square brackets). This seems a bit non-standard, as normally ipv6 ip addresses in urls and so on are indeed specified like [::1] (or [::] for "all zero"). In addition, sabnzbd+ in this case fails to open the proper address in the browser on startup, instead it tries to connect to http://:::8080/sabnzbd which is definately a bug.

Given the above, the only things currently impossible are (1) to make sabnzbd+ listen on both all v4 and all v6 at the same time, and (2) to specify which interfaces to listen on. Both can be reasonably well worked around using firewall rules and/or forwarding apps (think the likes of 6tunnel).

Re: BInd to multiple addresses (and ports)

Posted: April 15th, 2008, 8:43 am
by shypike
I think the question was how do I connect to a Usenet server, forcing the use of a particular (virtual) network interface?
Suppose the network card gets assigned two different IP addresses (OSX can handle that) 192.168.1.5 and 192.168.1.6.
The request was to tell SABnzbd to make the connection to the Usenet server, via 192.168.1.5 and not the other one.
This is something Python does not enable you to do, at least I don't know how.

Letting the web-server part (= CherryPy) listen to multiple IP addresses is something completely different.
And indeed it is not supported by CherryPy2 and we need to migrate to CherryPy3 to be able to do it.

Re: BInd to multiple addresses (and ports)

Posted: April 15th, 2008, 11:26 am
by jcfp
Yup, I know about the limitations (and worse) of cherrypy v2 vs. v3. I was responding to the (much older) post by Sander, which describes a problem I also ran into and made me run into a bug in sabnzbd (will post separately).

Regarding binding outgoing connections to a news server to a certain ip, hellanzb (which according to Beenthere supports binding to specific ip addresses for outgoing connections) is also written in python; I think it uses something called "twisted python" for its connectivity. That project's code might provide a clue as to how to achieve this in python.

Re: BInd to multiple addresses (and ports)

Posted: April 15th, 2008, 2:04 pm
by shypike
Rewriting SABnzbd to use Twisted is not an option.
We might as well rewrite the thing from scratch.

Re: BInd to multiple addresses (and ports)

Posted: April 15th, 2008, 8:15 pm
by evidenceunseen
I think he was more referring to looking at twisted python's source and seeing how they implement binding to a particular interface.

Course I could be wrong. :P