DekGenius.com
I l@ve RuBoard Previous Section Next Section

1.21 Starting named at Boot Time

1.21.1 Problem

You want namedto start at boot time.

1.21.2 Solution

On many Unixish operating systems, namedwill start automatically if the startup scripts see a named.conffile in the right directory, usually /etc. On others, you just need to make minor changes to a startup configuration file. However, on some Unixish operating systems, you may need to add the necessary lines to the appropriate file or create a special link to start up named.

On BSD-based systems, namedis usually started by one of the startup scripts, such as /etc/rc.network. Here's the relevant part of /etc/rc.networkin FreeBSD 4.5:

case ${named_enable} in
[Yy][Ee][Ss])      
    echo -n ' named';       ${named_program:-named} ${named_flags}
    ;;
esac

In this case, the variables named_enable, named_programand named_flagsare set in /etc/rc.conf:

named_enable="YES"
named_flags="-t /etc/namedb -u bind"

named_program isn't set in /etc/rc.conf, so it defaults to namedin /etc/rc.network.

Note that I use the -t and -uoptions to tell namedto call chroot( )and to give up root privileges. This requires some special setup; see Recipes Section 7.8 and Section 7.9 for details.

If you're running a BSD-based operating system, just edit /etc/rc.conf, change named_enableto "YES"and set the other named_*variables, if you need to.

On Solaris 8, named is started from /etc/init.d/inetsvc:

SunOS 5.8
#
# If this machine is configured to be an Internet Domain Name System (DNS)
# server, run the name daemon.  Start named prior to: route add net host,
# to avoid dns gethostbyname timout delay for nameserver during boot.
#
if [ -f /usr/sbin/in.named -a -f /etc/named.conf ]; then
        echo 'starting internet domain name server.'
        /usr/sbin/in.named &
fi

If you haven't installed the BIND name server as in.named, you can adjust the (two!) occurrences of in.named in the script appropriately.

If your operating system uses System V Release 4-style startup scripts, namedis usually started by a shell script called namedin the /etc/rc.d/init.dor /etc/init.ddirectory. If you create a link in the directory /etc/rc.d/rc3.d (called something like S55named) to /etc/rc.d/init.d/named, the rcscript will run the namedscript in init.dand start namedwhen the system enters run level 3:

# cd /etc/rc.d/rc3.d; ln -s ../init.d/named S55named

Also, create links called K55named in the directories for runlevels 0, 1, and S, also to ../init.d/named, to kill the named process when entering those runlevels.

1.21.3 Discussion

The relevant run level is reflected in the name of the directory the script lives in: On most Unixish operating systems, run level 3 is the default. To execute a script when the system enters run level 5 (the default run level for most Unixes when running X Windows), create a link from the directory rc5.d.

The "S" in "S55named" tells rcto run the script with the argument startwhen entering the appropriate run level, while the "K" in "K55named" tells rc to run it with kill as an argument. The "55" tells rcwhen to run the script: after any scripts with lower numbers, before scripts with higher numbers. If your OS starts other servers that depend on name resolution to work, you may need to adjust the "55" to make sure namedstarts before they do. But make sure namedstarts after all of your host's network interfaces are up.

1.21.4 See Also

Section 1.19, for starting the name server from the command line.

    I l@ve RuBoard Previous Section Next Section