从192.168.1.101上同步test.com.和1.168.192资源记录
一、安装bind9:
yum install -y bind
二、修改配置文件:
cp /etc/named.conf{,.back} //先做备份
vim /etc/named.conf
chkconfig --level 35 named on
service named start
三、复制两个域:
1.测试
dig -t axfr test.com @192.168.1.101 //测试正向域复制
dig -t axfr 1.168.192.in-addr.arpa @192.168.1.101 //测试反向域复制
2.配置两个域
cp /etc/named.rfc1912.zones{,.back} //先做备份
vim /etc/named.rfc1912.zones
rndc reload //重载配置后,会自动生成资源库文件
验证:
在192.168.1.101上给每个区域各增加一条记录
101服务器增加记录后,重载一下配置,102服务器就会自动复制新的资源库了
附:
/etc/named.conf
// // named.conf // // Provided by Red Hat bind package toconfigure the ISC BIND named(8) DNS // server as a caching only nameserver(as a localhost DNS resolver only). // // See /usr/share/doc/bind*/sample/ forexample named configuration files. // acl myNet { 192.168.1.0/24; }; options { listen-onport 53 { 192.168.1.102; 127.0.0.1; }; // listen-on-v6port 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 { any; }; recursionyes; allow-recursion{ myNet; }; dnssec-enableno; dnssec-validationno; forwardfirst; forwarders { 192.168.1.104; }; /*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 { typehint; file"named.ca"; }; include"/etc/named.rfc1912.zones"; include "/etc/named.root.key";
/etc/named.rfc1912.zones
// named.rfc1912.zones: // // Provided by Red Hat caching-nameserverpackage // // ISC BIND named zone configuration forzones recommended by // RFC 1912 section 4.1 : localhost TLDsand address zones // and http://www.ietf.org/internet-drafts/draft-ietf-dnsop-default-local-zones-02.txt // (c)2007 R W Franks // // See /usr/share/doc/bind*/sample/ forexample named configuration files. // zone "localhost.localdomain" IN{ typemaster; file"named.localhost"; allow-update{ none; }; }; zone "localhost" IN { typemaster; file"named.localhost"; allow-update{ none; }; }; zone"1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa"IN { typemaster; file"named.loopback"; allow-update{ none; }; }; zone "1.0.0.127.in-addr.arpa"IN { typemaster; file"named.loopback"; allow-update{ none; }; }; zone "0.in-addr.arpa" IN { typemaster; file"named.empty"; allow-update{ none; }; }; zone "test.com" IN { typeslave; masters{ 192.168.1.101; }; file"slaves/test.com.zone"; allow-update{ none; }; }; zone "1.168.192.in-addr.arpa"IN { typeslave; masters{ 192.168.1.101; }; file"slaves/192.168.1.zone"; allow-update{ none; }; };
转载于:https://blog.51cto.com/362475097/1888384