db.root.sh 661 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/sh
  2. SERVER=a.root-servers.net
  3. TMPFILE=/tmp/tmp.$$
  4. ROOTFILE=./db.root
  5. date=`date`
  6. cat >$ROOTFILE <<EOT
  7. ;
  8. ; db.root -- BIND "hint" file
  9. ; [automatically created on $date by db.root.sh]
  10. ;
  11. ; Notice: Although this file officially is only used to initially load
  12. ; the cache of the BIND nameserver, it is actually used to specify the
  13. ; root nameservers only.
  14. ;
  15. EOT
  16. nslookup >$TMPFILE <<-EOF
  17. server $SERVER
  18. set type=NS
  19. .
  20. EOF
  21. cat $TMPFILE |\
  22. awk '
  23. /nameserver =/ { printf("%-20s 99999999 IN NS %s.\n", ".", $NF); }
  24. /address =/ { printf("%-20s 99999999 IN A %s\n", $1 ".", $NF); }
  25. ' |\
  26. sort >>$ROOTFILE
  27. rm $TMPFILE
  28. echo "" >>$ROOTFILE