Re: named (bind) in jail does not start

From: Matthew Seaman <m.seaman_at_infracaninophile.co.uk>
Date: Sat, 29 Nov 2003 15:39:50 +0000
On Sat, Nov 29, 2003 at 03:23:48PM +0100, Axel S. Gruner wrote:
> 
> Hi.
> 
> I have configured named in jail (FreeBSD 5.1-RELEASE-p10).
> If i want to start named in the jail
> 
> /usr/sbin/named
> 
> i get this error message:
>   
> opensocket_f: bind([0.0.0.0].53): Address already in use
> 
> Ok, Port 53 is not in use in the jail nor the hostsystem.
> I think the problem is 0.0.0.0, and i have to bind named on the IP of
> the jail. 
> 
> I tested same named configuration on the hostsystem, i thought about
> some misconfigration, but on the hostsystem named starts perfectly.
> 
> I also tried to start named with -g and -u in the jail, same error.
> 
> So, my short question is, how can i run named in the jail?
> Any ideas?

Yes.  The problem is that named is attempting to bind(2) to
INADDR_ANY.  In a jail, that includes the loopback address.  Problem
is, jails don't get their own loopback addresses -- there's just the
one loopback shared between the host system and all jails.  Which
effectively means that jailed processes can't bind to the loopback.

The answer is to configure named to only bind to the jail IP number --
see http://www.isc.org/products/BIND/docs/config/ (for bind8) or
http://www.nominum.com/content/documents/bind9arm.pdf (for bind9)
[available in HTML as
file:///usr/local/share/doc/bind9/arm/Bv9ARM.html if you've installed
the bind9 port.]

In bind9 you need to add something like the following to named.conf --
bind8 will be similar:

    options {

        [...]

        listen-on {
            192.168.1.1;
        };
        query-source address 192.168.1.1 port 53;
        transfer-source      192.168.1.1 port 53;
        notify-source        192.168.1.1 port 53;
    };

There are equivalent IPv6 statements if you're an IPv6 user.

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK

Received on Sat Nov 29 2003 - 06:40:30 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:31 UTC