8. À¯Áö

ÀÛµ¿ÀÌ µÇ°Ô À¯ÁöÇ϶ó.

namedÀÇ ±â´ÉÀÌ À¯ÁöµÇ°Ô ÇØ¾ß ÇÏ¸ç ±×°ÍÀÌ Áö¼ÓÀûÀ¸·Î ±¸µ¿µÇ°Ô ÇØ¾ß ÇÑ´Ù. ±×·²·Á¸é root.hints¸¦ ¾÷µ¥ÀÌÆ® ÇØ¾ß ÇÑ´Ù. °¡Àå ¼Õ½¬¿î ¹æ¹ýÀº dig¸¦ ÀÌ¿ëÇÏ´Â °ÍÀÌ´Ù. ¸ÕÀú ¾î¶² Àμöµµ ¾øÀÌ dig ¸¦ ±¸µ¿½Ã۸é ÀÚ½ÅÀÇ ¼­¹ö¿¡ ÇØ´çÇÏ´Â root.hints¸¦ ¾ò°Ô µÉ °ÍÀÌ´Ù. ±×¸®°í ³ª¼­´Â dig @rootserver·Î ³ª¿­µÈ ·çÆ®¼­¹öÁß Çϳª¿¡ ÁúÀǸ¦ ÇÑ´Ù. root.hints ÆÄÀÏÀ» ³ªÅ¸³»´Â Ãâ·Â°á°ú¸¦ ÁÖ½ÃÇØ¾ß ÇÑ´Ù. ÆÄÀÏÀ» ÀúÀåÇϰí(dig @e.root-servers.net . ns>root.hints.new) root.hints ÆÄÀÏÀ» ±³Ã¼ÇÏ¸é µÈ´Ù.

Ç×»ó ij½¬ÆÄÀÏÀ» ±³Ã¼ÇÏ°í ³ª¸é named¸¦ À籸µ¿ ÇØ¾ß ÇÑ´Ù´Â »ç½ÇÀ» ¿°µÎÇØ µÎ±æ.

Al Longyear¾¾°¡ ÀÚµ¿ÀûÀ¸·Î root.hints¸¦ °»½ÅÇÒ ¼ö ÀÖ´Â ½ºÅ©¸³Æ®¸¦ Á¦°øÇØ ÁÖ¾ú´Ù. crontab¿¡ ÀúÀåÇϰí ÇÑ´Þ¿¡ Çѹø¾¿ µ¹¾Æ°¡°Ô ¼³Á¤ÇÏ¸é ±×µÚ¿¡´Â ½Å°æ¾²Áö ¾Ê¾Æµµ µÈ´Ù. ÀÌ ½ºÅ©¸³Æ®´Â ¿©·¯ºÐÀÇ ¸ÞÀÏÀÌ ÀÛµ¿Çϰí mail-alias 'hostmaster'°¡ Á¤ÀǵǾî ÀÖ´Ù°í °¡Á¤ÇÑ´Ù. ¼öÁ¤Çؼ­ Àڽſ¡°Ô ¸Â°Ô ¼³Á¤ÇØ¾ß ÇÑ´Ù.

#!/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 `ndc status 2>&1` in
    *'cannot connect to command channel'*)
        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
 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

ȤÀÚµéÀº root.hints ÆÄÀÏÀ» ÀÎÅÍ´ÐÀÇ ftp·ÎºÎÅÍ °¡Á®¿À´Â °ÍÀÌ À¯¿ëÇÏ´Ù°í ÇÑ´Ù. ftp¸¦ »ç¿ëÇÏÁö ¸»°í À§ÀÇ ¹æ¹ýÀ¸·Î root.hints ¸¦ ¾÷µ¥ÀÌÆ® Çϱ⸦. À§ÀÇ ¹æ¹ýÀÌ ´õ net»ó¿¡¼­, ±×¸®°í internic ¿¡µµ ÁÁÀº °ÍÀÌ´Ù.