Üzemben tartás.
Van egy karbantartási feladat, melyet meg kell tenned a named-eken - a
futtatáson kívül. Ez pedig a root.hints
állomány naprakészen tartása.
A legegyszerűbb mód a dig
használata. Először futtasd a dig
-et
argumentumok nélkül, akkor megkapod a root.hints
-et a saját szervered
alapján. Ezután kérdezd le a felsorolt főszerverek egyikét a dig
@rootserver
paranccsal. Észre fogod venni, hogy a kimenet szörnyen
hasonló a root.hints állományhoz. Mentsd el egy állományba (dig
@e.root-servers.net . ns > root.hints.new
), és cseréld le a régi
root.hints
állományt vele.
Ne felejtsd el újra betölteni a named-et a gyorsítótár-állomány cseréje után.
Al Longyear elküldte nekem ezt a szkriptet, mely automatikusan
futtatható a root.hints
frissítése érdekében. Telepíts egy crontab
bejegyzést, hogy havonta egyszer lefusson, és el is felejtheted. A
szkript feltételezi, hogy a levelezésed működik, és hogy a "hostmaster"
cím meg van adva. Meg kell hackelned, hogy illeszkedjen a beállításaidhoz.
#!/bin/sh # # 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 *refused*) echo "named is DOWN. root.hints was NOT updated" echo exit 0 ;; esac PATH=/sbin:/usr/sbin:/bin:/usr/bin: 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 echo "The subject says it all" exit 1 } # Are we online? Ping a server at your ISP case `ping -qnc 1 some.machine.net 2>&1` in *'100% packet loss'*) echo "Subject: root.hints NOT updated. The network is DOWN." echo echo "The subject says it all" exit 1 ;; esac dig @e.root-servers.net . ns >root.hints.new 2> errors case `cat root.hints.new` in *NOERROR*) # It worked :;; *) echo "Subject: The root.hints file update has FAILED." echo echo "The root.hints update has failed" echo "This is the dig output reported:" echo cat root.hints.new errors exit 1 ;; esac echo "Subject: The root.hints file has been updated" echo echo "The root.hints file has been updated to contain the following information:" echo cat root.hints.new chown root.root root.hints.new chmod 444 root.hints.new rm -f root.hints.old errors mv root.hints root.hints.old mv root.hints.new root.hints rndc restart echo echo "The nameserver has been restarted to ensure that the update is complete." echo "The previous root.hints file is now called /var/named/root.hints.old." ) 2>&1 | /usr/lib/sendmail -t exit 0
Néhányan közületek felfigyelhettek rá, hogy a root.hints
állomány
elérhető ftp-vel az Internic-ről is. Kérlek, ne használd az ftp-t a
root.hints
frissítéséhez, a fentebb említett módszer sokkal
barátságosabb a hálózat és az Internic számára.