다음 이전 차례

6. 유지 보수

항상 올바른 작동을 위해 (Keeping it working).

named가 실행되도록 유지하는 것 외에 항상 유념해야 하는 것이 있다. root.hints 파일을 최신의 것으로 유지하는 것이다. 제일 쉬운 방법은 dig를 사용하는 것이다. 먼저 아무런 아규먼트 없이 dig를 실행한다. 그러면 바로 서버에 따라서 약간은 다른 root.hints를 얻을 것이다. 그런 다음 dig @rootserver로 나열된 루트 서버 중 한곳에 요청한다. root.hints와 유사한 끔찍한 결과를 얻게 될 것이다. 결과를 파일로 저장하고(dig @e.root-servers.net . ns >root.hints.new) 예전의 root.hints와 대체시킨다.

캐쉬 파일을 대체한 후에는 반드시 named를 재시작하도록 하자.

Al Longyear씨가 root.hints를 자동으로 갱신할 수 있는 아래 스크립트를 보내 주었다. crontab에 넣어서 한달에 한번꼴로 실행되도록 해두면 잊어도 된다. 이 스크립트에서는 여러분의 메일이 작동하고 있고 메일 알리아스 `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
# SERVFAIL problem discovered by David A. Ranch
#
(
 echo "To: hostmaster <hostmaster>"
 echo "From: system <root>"
 echo "Subject: Automatic update of the named.conf file"
 echo

 export PATH=/sbin:/usr/sbin:/bin:/usr/bin:
 cd /var/named

 dig @rs.internic.net . ns >root.hints.new

 case `cat root.hints.new` in
   *SERVFAIL*)
        echo "The named.conf file update has FAILED."
        echo "This is the error that DIG reported:"
        echo
        cat root.hints.new
        exit 0
 esac

 echo "The named.conf 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

여러분 중 몇몇은 ftp로 Internic에서 root.hints 파일을 가져올 수 있다고 꼬집어 말할지도 모른다. ftp로 root.hints를 갱신 하지 말라. 위의 방법이 네트웍에 더욱 친근하다.


다음 이전 차례