Alles aan de praat houden
Er is een onderhoudstaak aan DNS servers, namelijk het up-to-date houden
van het root.hints bestand. De makkelijkste manier om dat te doen is met
het programma dig. Draai dig zonder opties, en je krijgt het
root.hints bestand van je eigen server. Als je een rootserver
ondervraagt met dig, is het resultaat te gebruiken als root.hints
bestand. Het commando "dig @e.root-servers.net . ns >root.hints.new)"
levert een nieuw hints bestand. Hernoem het bestand root.hints.new naar
root.hints en laat named het bestand opnieuw inlezen met ndc reload.
Al Longyear heeft me onderstaand script gemaild, dat gebruikt kan worden om
root.hints automatisch te laten updaten. Het script gaat er van uit dat
mail lokaal werkt en dat het adres hostmaster op de lokale machine
bestaat. Pas het script eventueel aan zodat het werkt met de configuratie van
jouw machine.
#!/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
#
(
echo "To: hostmaster <hostmaster>"
echo "From: system <root>"
echo "Subject: Automatic update of the root.hints file"
echo
PATH=/sbin:/usr/sbin:/bin:/usr/bin:
export PATH
cd /var/named
# Are we online? Ping a server at your ISP
case `ping -qnc 10 some.machine.net` in
*'100% packet loss'*)
echo "The network is DOWN. root.hints NOT updated"
echo
exit 0
;;
esac
dig @rs.internic.net . ns >root.hints.new 2>&1
case `cat root.hints.new` in
*NOERROR*)
# It worked
:;;
*)
echo "The root.hints file update has FAILED."
echo "This is the dig output reported:"
echo
cat root.hints.new
exit 0
;;
esac
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
mv root.hints root.hints.old
mv root.hints.new root.hints
ndc 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
Misschien heb je al gezien dat het root.hints bestand ook via ftp
beschikbaar is via Internic. Gebruik geen ftp om dit bestand op te halen.
Bovenstaand script is beter voor Internic en voor het Internet als geheel.