Previous Next Contents

5. Maintenance

Keeping it working.

There is one maintenance task you have to do on nameds, other than keeping them running. That's keeping the root.cache file updated. The easiest way is using dig, first run dig with no arguments, you will get the root.cache according to your own server. Then ask one of the listed root servers with dig @rootserver. You will note that the output looks terribly like a root.cache file except for a couple of extra numbers. Those numbers are harmless. Save it to a file (dig . @e.root-servers.net >root.cache.new) and replace the old root.cache with it.

Remember to restart named after replacing the cache file.

Al Longyear sent me this script that can be run automatically to update named.cache, install it a crontab entry for it and forget it. The script assumes you have mail working and that the mail-alias `hostmaster' is defined. You should hack it to suit your setup.


#!/bin/sh
#
# Update the nameserver cache information file once per month.
# This is run automatically by a cron entry.
#
(
 echo "To: hostmaster <hostmaster>"
 echo "From: system <root>"
 echo "Subject: Automatic update of the named.boot file"
 echo

 export PATH=/sbin:/usr/sbin:/bin:/usr/bin:
 cd /var/named

 dig . @rs.internic.net >named.cache.new

 echo "The named.boot file has been updated to contain the following
information:"
 echo
 cat named.boot.new

 chown root.root named.cache.new
 chmod 444 named.cache.new
 rm -f named.cache.old
 mv named.cache named.cache.old
 mv named.cache.new named.cache
 ndc restart
 echo
 echo "The nameserver has been restarted to ensure that the update is complete.
"
 echo "The previous named.cache file is now called
/var/named/named.cache.old."
) 2>&1 | /usr/lib/sendmail -t
exit 0


Previous Next Contents