BInd to multiple addresses (and ports)

Want something added? Ask for it here.
Post Reply
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

BInd to multiple addresses (and ports)

Post 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!
Please don't send me unrequested PM's; the forum is the best way to communicate.
If someone helps you, please reply to that help.
f you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
User avatar
switch
Moderator
Moderator
Posts: 1380
Joined: January 17th, 2008, 3:55 pm
Location: UK

Re: BInd to multiple addresses (and ports)

Post 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.
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: BInd to multiple addresses (and ports)

Post 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.
Please don't send me unrequested PM's; the forum is the best way to communicate.
If someone helps you, please reply to that help.
f you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
beenthere
Newbie
Newbie
Posts: 6
Joined: April 2nd, 2008, 7:32 am

Re: BInd to multiple addresses (and ports)

Post 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!
beenthere
Newbie
Newbie
Posts: 6
Joined: April 2nd, 2008, 7:32 am

Re: BInd to multiple addresses (and ports)

Post by beenthere »

[[[bump]]] anyone?
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: BInd to multiple addresses (and ports)

Post 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?
Last edited by shypike on April 14th, 2008, 6:21 am, edited 1 time in total.
User avatar
jcfp
Release Testers
Release Testers
Posts: 986
Joined: February 7th, 2008, 12:45 pm

Re: BInd to multiple addresses (and ports)

Post 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).
Last edited by jcfp on April 14th, 2008, 9:42 am, edited 1 time in total.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: BInd to multiple addresses (and ports)

Post 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.
Last edited by shypike on April 15th, 2008, 2:03 pm, edited 1 time in total.
User avatar
jcfp
Release Testers
Release Testers
Posts: 986
Joined: February 7th, 2008, 12:45 pm

Re: BInd to multiple addresses (and ports)

Post 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.
Last edited by jcfp on April 15th, 2008, 11:39 am, edited 1 time in total.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: BInd to multiple addresses (and ports)

Post by shypike »

Rewriting SABnzbd to use Twisted is not an option.
We might as well rewrite the thing from scratch.
evidenceunseen
Jr. Member
Jr. Member
Posts: 56
Joined: February 11th, 2008, 2:33 pm

Re: BInd to multiple addresses (and ports)

Post 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
Post Reply