Home > 備忘録 > bind に関すること > bind のインストール( 68 )
Fedora18にbindをインストールしchroot環境での利用です。
[root@server]# yum -y install bind bind-utils ←bind関連のインストール
[root@server]# yum -y install bind-chroot ←chrootのインストール
[root@server]# /usr/libexec/setup-named-chroot.sh /var/named/chroot on[root@server]# vi /var/named/chroot/etc/named.conf ←他のページを利用して変更してください
//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
options {
listen-on port 53 { 127.0.0.1; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { localhost; };
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
zone IN {
type hint;
file "named.ca";
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";正引き・逆引きの情報設定も、他のページを参考にしてください。
[root@server]# dig . ns @198.41.0.4 +bufsize=1024 > /var/named/chroot/var/named/named.ca ←ルートゾーン(named.ca)最新化[root@server]# vi /etc/cron.monthly/named.root_update
#!/bin/sh
new=`mktemp`
errors=`mktemp`
dig @a.root-servers.net . ns > $new 2> $errors
if [ $? -eq 0 ]; then
sort_new=`mktemp`
sort_old=`mktemp`
diff_out=`mktemp`
sort $new > $sort_new
sort /var/named/chroot/var/named/named.ca > $sort_old
diff --ignore-matching-lines=^\; $sort_new $sort_old > $diff_out
if [ $? -ne 0 ]; then
(
echo '-------------------- old named.root --------------------'
cat /var/named/chroot/var/named/named.ca
echo
echo '-------------------- new named.root --------------------'
cat $new
echo '---------------------- difference ----------------------'
cat $diff_out
) | mail -s 'named.root updated' root
cp -f $new /var/named/chroot/var/named/named.ca
chown named. /var/named/chroot/var/named/named.ca
chmod 644 /var/named/chroot/var/named/named.ca
systemctl restart named-chroot.service > /dev/null
fi
rm -f $sort_new $sort_old $diff_out
else
cat $errors | mail -s 'named.root update check error' root
fi
rm -f $new $errors[root@server]# chmod 700 /etc/cron.monthly/named.root_update[root@server]# systemctl start named-chroot.service ←bindの起動
[root@server]# systemctl enable named-chroot.service ←bindの自動起動