Multiple Named Daemons on one machine

Mark_Andrews at isc.org Mark_Andrews at isc.org
Thu Apr 25 23:51:11 UTC 2002


> 
> I'm trying to setup a Split-DNS on a single machine having one network
> interface. I've created an IP alias for the network interface & have
> created the following directory structure:
> //var/named/int//     Internal DNS server file directory
> //var/named/ext//     External DNS server file directory
> 
> I've setup the respective zone files & named.conf file in each
> directory.
> 
> I can run multiple daemons of named from command line as follows:
> 
> /usr/sbin/named -u named -c /var/named/int/named.conf -t
> /var/named/int
> /usr/sbin/named -u named -c /var/named/ext/named.conf -t
> /var/named/ext
> But I'm unable to start these daemons from the startup script which is
> as follows:
> -----------------------------------------------------------------------------
> ---
> #!/bin/sh
> #
> # named           This shell script takes care of starting and
> stopping
> #                 named (BIND DNS server).
> # ---------------------------------------------------------------------------
> -
> # Source function library.
> . /etc/rc.d/init.d/functions
> 
> # Source networking configuration.
> . /etc/sysconfig/network
> 
> # Check that networking is up.
> [ ${NETWORKING} = "no" ] && exit 0
> 
> [ -f /etc/sysconfig/named ] && . /etc/sysconfig/named
> 
> [ -f /usr/sbin/named ] || exit 0
> [ -f /usr/sbin/named ] || exit 0
> 
> [ -f /var/named/int/named.conf ] || exit 0
> [ -f /var/named/ext/named.conf ] || exit 0
> 
> RETVAL=0
> 
> # See how we were called.
> case "$1" in
> 
>        start)
>             # Start daemons.
>             echo -n "Starting named-int: "
> 
>             #Bind9 - Use this setup if you are using Bind9
>             #
>             daemon /usr/sbin/named -u named -c
> /var/named/int/named.conf -t /var/named/int
> 
>             RETVAL=$?
>             [ $RETVAL -eq 0 ] && touch /var/lock/subsys/named-int
> 
>             sleep 5
> 
>             echo -e "\r"
>             echo -n "Starting named-ext: "
> 
>  
>             #Bind9 - Use this setup if you are using Bind9
>             #
>             /usr/sbin/named -u named -c /var/named/ext/named.conf -t
> /var/named/ext
> 
>             RETVAL=$?
>             [ $RETVAL -eq 0 ] && touch /var/lock/subsys/named-ext
>             echo -e "\r"
>          ;;
> 
>         start-int)
>             # Start daemons.
>             echo -n "Starting named-int: "
> 
>             #Bind9 - Use this setup if you are using Bind9
>             #
>             /usr/sbin/named -u named -c /var/named/int/named.conf -t
> /var/named/int
> 
>             RETVAL=$?
>             [ $RETVAL -eq 0 ] && touch /var/lock/subsys/named-int
>             echo -e "\r"
>         ;;
> 
>         start-ext)
>             echo -n "Starting named-ext: "
> 
>             #Bind9 - Use this setup if you are using Bind9
>             #
>             /usr/sbin/named -u named -c /var/named/ext/named.conf -t
> /var/named/ext
> 
>             RETVAL=$?
>             [ $RETVAL -eq 0 ] && touch /var/lock/subsys/named-ext
>             echo -e "\r"
>         ;;
> 
>         stop)
>           # Stop daemons.       
>                    echo -n "Shutting down named: "
>            killproc named
>            RETVAL=$?
>            [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/named-int && rm
> -f /var/lock/subsys/named-ext
>            echo -e "\r"
>         ;;
> 
>         stop-int)
>             # Stop INT daemons.
>             echo -n "Shutting down named-int: "
>             kill `ps ax | grep /usr/sbin/named | grep -v -e grep | awk
> '{print $1}'`
>             RETVAL=$?
>             [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/named-int
>             echo -e "\r"
>         ;;
> 
>         stop-ext)
>             # Stop EXT daemons.
>             echo -n "Shutting down named-ext: "
>             kill `ps ax | grep /usr/sbin/named | grep -v -e grep | awk
> '{print $1}'`
>             RETVAL=$?
>             [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/named-ext
>             echo -e "\r"
>         ;;
> 
>         status)
>           /usr/sbin/rndc status
>           exit $?
>         ;;
> 
> 
>         restart)
>            $0 stop
>            $0 start
>         ;;
> 
> 
>         reload)
>            /usr/sbin/rndc reload
>            exit $?
>         ;; 
> 
> 
>         probe)
>            # named knows how to reload intelligently; we don't want
> linuxconf
>            # to offer to restart every time
>            /usr/sbin/rndc reload >/dev/null 2>&1 || echo start
>            exit 0
>         ;;
> 
>  
>         *)
>           echo "Usage: named
> {start|start-int|start-ext|stop|stop-int|stop-ext|status|restart}"
>         exit 1
> esac
> exit $RETVAL
> -----------------------------------------------------------------------------
> ---
> 
> When I run this script, I get the following errors in the logs:
> 
> Apr 25 22:50:36 ABC /usr/sbin/named[3708]: starting BIND 9.1.0 -u
> named -c /var/named/int/named.conf -t /var/named/int
> Apr 25 22:50:36 ABC /usr/sbin/named[3708]: using 1 CPU
> Apr 25 22:50:36 ABC /usr/sbin/named[3711]: loading configuration from
> '/var/named/int/named.conf'
> Apr 25 22:50:36 ABC /usr/sbin/named[3711]: /var/named/int/named.conf:
> open: file not found
> Apr 25 22:50:36 ABC /usr/sbin/named[3711]: loading configuration: file
> not found
> Apr 25 22:50:36 ABC /usr/sbin/named[3711]: exiting (due to fatal
> error)
> Apr 25 22:50:36 ABC /usr/sbin/named[3708]: starting BIND 9.1.0 -u
> named -c /var/named/ext/named.conf -t /var/named/ext
> Apr 25 22:50:36 ABC /usr/sbin/named[3708]: using 1 CPU
> Apr 25 22:50:36 ABC /usr/sbin/named[3711]: loading configuration from
> '/var/named/ext/named.conf'
> Apr 25 22:50:36 ABC /usr/sbin/named[3711]: /var/named/ext/named.conf:
> open: file not found
> Apr 25 22:50:36 ABC /usr/sbin/named[3711]: loading configuration: file
> not found
> Apr 25 22:50:36 ABC /usr/sbin/named[3711]: exiting (due to fatal
> error)
> 
> 
> -----------------------------------------------------------------------------
> ---Both
> the files /var/named/int/named.conf & /var/named/ext/named.conf very
> much exist.
> 
> Cannot figure out at all what's causing this problem ? 
> 
> Any idea/suggestions/solutions are very much appreciated.
> 
> Thanks,
> 
> Ashwin.
> 
> 
> 

	Think about what chroot() does.

	named -t /var/named/int -c /named.conf
	named -t /var/named/ext -c /named.conf

	Mark

--
Mark Andrews, Internet Software Consortium
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742                 INTERNET: Mark.Andrews at isc.org


More information about the bind-users mailing list