Sophie

Sophie

distrib > Mandriva > 9.1 > i586 > by-pkgid > f1098342ec4a2b28475e34123ce17201 > files > 157

howto-html-it-9.1-0.5mdk.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
 <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
 <TITLE>DNS HOWTO: Manutenzione</TITLE>
 <LINK HREF="DNS-HOWTO-9.html" REL=next>
 <LINK HREF="DNS-HOWTO-7.html" REL=previous>
 <LINK HREF="DNS-HOWTO.html#toc8" REL=contents>
</HEAD>
<BODY>
<A HREF="DNS-HOWTO-9.html">Avanti</A>
<A HREF="DNS-HOWTO-7.html">Indietro</A>
<A HREF="DNS-HOWTO.html#toc8">Indice</A>
<HR>
<H2><A NAME="maint"></A> <A NAME="s8">8. Manutenzione</A></H2>

<P><B>Mantenerlo operativo</B>
<P>
<P>C'&egrave; un altro compito di manutenzione che dovete fare sui named,
oltre a quello di tenerli operativi. Consiste nel mantenere aggiornato
il file <CODE>root.hints</CODE>. Il modo pi&ugrave; semplice &egrave; usare dig, fate
partire dig senza argomenti, otterrete <CODE>root.hints</CODE> in accordo col
quello che c'&egrave; sul vostro server. Poi fate una richiesta a uno dei root
server elencati con <CODE>dig @rootserver</CODE>. Vedrete che l'output
somiglier&agrave; terribilmente al file <CODE>root.hints</CODE>. Salvatelo in un file
(<CODE>dig @e.root-servers.net . ns &gt;root.hints.new</CODE>) e rimpiazzate il
vecchio <CODE>root.hints</CODE> con questo.
<P>
<P>Ricordate di rilanciare named dopo aver rimpiazzato il file cache.
<P>
<P>Questo script mi &egrave; stato mandato da Al Longyear, pu&ograve; essere fatto
partire automaticamente per aggiornare <CODE>root.hints</CODE>, impostate una
riga nel crontab che lo faccia partire una volta al mese e
dimenticatelo. Lo script assume che il vostro sistema di posta funzioni
e che l'alias di posta "hostmaster" sia definito. Dovrete modificarlo
affinch&eacute; si conformi alle vostre esigenze.
<P>
<HR>
<PRE>
#!/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 &lt;hostmaster>"
 echo "From: system &lt;root>"

 # Is named up? Check the status of named.
 case `rndc status 2>&amp;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>&amp;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>&amp;1 | /usr/lib/sendmail -t
exit 0
</PRE>
<HR>
<P>
<P>
<P>Qualcuno di voi potrebbe aver notato che il file <CODE>root.hints</CODE>
&egrave; disponibile anche in ftp da Internic. Per favore, non usate ftp per
aggiornare <CODE>root.hints</CODE>, il metodo sopra descritto &egrave; molto pi&ugrave;
amichevole verso la rete e Internic.
<P>
<HR>
<A HREF="DNS-HOWTO-9.html">Avanti</A>
<A HREF="DNS-HOWTO-7.html">Indietro</A>
<A HREF="DNS-HOWTO.html#toc8">Indice</A>
</BODY>
</HTML>