The OpenNET Project / Index page

[ новости /+++ | форум | wiki | теги | ]

Поиск:  Каталог документации

Next Previous Contents

8. 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.hints file updated. The easiest way is using dig. First run dig with no arguments you will get the root.hints 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.hints file. Save it to a file (dig . ns > and replace the old root.hints with it.

Remember to reload named after replacing the cache file.

Al Longyear sent me this script that can be run automatically to update root.hints. Install a crontab entry to run it once a month and forget it. The script assumes you have mail working and that the mail-alias `hostmaster' is defined. You must hack it to suit your setup.

# Update the nameserver cache information file once per month.
# This is run automatically by a cron entry.
# Original by Al Longyear
# Updated for BIND 8 by Nicolai Langfeldt
# Miscelanious error-conditions reported by David A. Ranch
# Ping test suggested by Martin Foster
# named up-test suggested by Erik Bryer.
 echo "To: hostmaster <hostmaster>"
 echo "From: system <root>"

 # Is named up? Check the status of named.
 case `rndc status 2>&1` in
        echo "named is DOWN. root.hints was NOT updated"
        exit 0

 export PATH
 # NOTE: /var/named must be writable only by trusted users or this script 
 # will cause root compromise/denial of service opportunities.
 cd /var/named 2>/dev/null || {
    echo "Subject: Cannot cd to /var/named, error $?"
    echo "The subject says it all"
    exit 1

 # Are we online?  Ping a server at your ISP
 case `ping -qnc 1 2>&1` in
   *'100% packet loss'*)
        echo "Subject: root.hints NOT updated.  The network is DOWN."
        echo "The subject says it all"
        exit 1

 dig . ns > 2> errors

 case `cat` in
        # It worked
        echo "Subject: The root.hints file update has FAILED."
        echo "The root.hints update has failed"
        echo "This is the dig output reported:"
        cat errors
        exit 1

 echo "Subject: The root.hints file has been updated"
 echo "The root.hints file has been updated to contain the following   

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

Some of you might have picked up that the root.hints file is also available by ftp from Internic. Please don't use ftp to update root.hints, the above method is much more friendly to the net, and Internic.

Next Previous Contents

Inferno Solutions
Hosting by

Закладки на сайте
Проследить за страницей
Created 1996-2021 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру