Configuring named to start automatically after every reboot
Previous  Top  Next

The following might look a little complicated, read it twice if you feel that you don't understand what's going on here. Services are started by startup-scripts in the directory /etc/rc.d/init.d/. This is how we started named just a few minutes ago (depends how fast you are typing and reading …). Now we have to tell linux to start named automatically. You can use tools from x-windows, but since I like Linux because I don't need a graphic interface, we will do it by hand, without any special tool. If we run ls /etc/rc.d, we will see the following directories (among others): rc0.d, rc1.d, rc2.d, rc3.d, rc4.d, rc5.d, rc6.d

Each of those directories refers to a runlevel, for example rc3.d refers to runlevel three. Runlevels could be described as a state of the system. Look at the following table:

0Halt the system  
1Enter single-user mode (no networking is enabled)  
2Multiuser mode, but without NFS  
3Full multiuser mode (normal operation)  
4Unused  
5Same as runlevel 3, except using an X Windows login rather than a text-based login  
6Reboot the system  

To tell our linux system when to start which service, we would have to place a startup script in the corresponding directory. However, to make things not more complicated than they already are we will use symbolic links rather than a separate script file everytime. But just adding named to the rc3.d directory (standard runlevel our server should be in most of the time) is not enough. We have to tell linux in which order to start or stop the services.

Let's take a look at result of ls /etc/rc.d/rc3.d/:

K20nfs
K20rwalld
K20rwhod
K34yppasswdd
K45arpwatch
K45named
K84ypserv
S05kudzu
S08ipchains
S10network
S12syslog
S13portmap
S14nfslock
S16apmd
S20random
S25netfs
S35identd
S40atd
S45pcmcia
S50xinetd
S55sshd
S56rawdevices
S60lpd
S75keytable
S80sendmail
S85gpm
S85httpd
S90crond
S90xfs
S95anacron
S97rhnsd
S99linuxconf
S99local




         
The first letter, S, indicates that the script should be started. The 2nd and 3rd number tell the order where 01 would be the first service to start. The rest is the name of the script in the ../init.d/ directory. If we would configure a service to stop (such as in runlevels 0 and 6) we would use a K instead of a S at the beginning.

In our case I would tell named to start before xinetd, using the number 47. I will have named start in runlevels 3 and 5. So we type

ln –s /etc/rc.d/init.d/named /etc/rc.d/rc3.d/S53named
ln –s /etc/rc.d/init.d/named /etc/rc.d/rc5.d/S53named

To start named in runlevel 3 and 5 automatically. To stop named everytime we make a reboot or halt or system, we add the following if it doesn't already exist (please check)

ln –s /etc/rc.d/init.d/named /etc/rc.d/rc0.d/K45named
ln –s /etc/rc.d/init.d/named /etc/rc.d/rc6.d/K45named

Now reboot by typing

shutdown –r now

If we find named started automatically after the login, we are already 25% on our way. You can see if the process is active by typing ps –A | grep named

If we were going from San Diego to Miami, we would probably be somwhere in New Mexico.