Convice Bind to listen on IP alias with a range of IPs.

Phil Mayers p.mayers at imperial.ac.uk
Tue May 1 09:00:52 UTC 2012


On 04/30/2012 10:56 PM, Augie Schwer wrote:
> I must be doing something wrong, because what I want to do doesn't
> seem that difficult.
>
> I have a range of IPs bound to a local interface:
>
> lo:1      Link encap:Local Loopback
>            inet addr:10.0.0.1  Mask:255.255.255.224
>
> And I want to convince Bind to listen on sub-set of the given range (
> 10.0.0.2 for example ), yet when I configure that IP:

Which operating system are you running?

Contrary to what a lot of other people have suggested, it is in fact 
possible using the socket API to bind() to IPs which aren't explicitly 
created, due to special handling on the loopback interface. This can 
certainly be done under Linux, for example., and I have just 
re-confirmed that to myself.

I assume, because of the phrasing of your question, that your OS does 
indeed have this feature, and you've tested it working with other 
applications (even if as simple as netcat)?

Unfortunately, it seems likely that named is using the normal socket 
APIs to first enumerate the list of IPs on the box, and then filter 
those through listen-on statements to get the final list of IPs to pass 
to a bind() socket call - this would be a sensible way to implement the 
CIDR listen functionality.

If so, then if the IP isn't *explicitly* on an interface, it won't 
appear in the final output set, regardless of the fact a bind() call 
will succeed.

So you might be being a bit too clever, and foxing the named socket code 
I'm afraid.

Cheers,
Phil



More information about the bind-users mailing list