环境
操作系统 centos6.4 最小化安装
yum groupinstall “Development tools” “Server Platform Development” “Desktop Platform Development"
管闭防火墙,selinux
主DNS服务器 centos.daphne.com 192.168.200.128
从DNS服务器 centos2.daphne.com 192.168.200.129
1 安装DNS服务器
yum install bind
2 配置/etc/named.conf 文件
vim /etc/named.conf
liston-on allow-query 将localhost 改为any
// // 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 { any; }; 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 { any; }; 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";
3
vim /etc/named.rfc1912.zones
在文件末尾添加
zone "daphne.com" IN{ type master; file "daphne.com.zone"; allow-update{ none; }; }; zone "200.168.192.in-addr.arpa" IN { type master; file "192.168.200.zone"; allow-update{ none; }; };
4 建立正向解析文件 daphne.com.zone 反向解析文件192.168.200.zone
cd /var/named
vim daphne.com.zone
$TTL 600 @ IN SOA centos.daphne.com. centos.daphne.com.( 2014052101 3H 15M 1W 1D) IN NS centos.daphne.com. IN NS centos2.daphne.com. IN MX 10 centos3.daphne.com. centos.daphne.com. IN A 192.168.200.128 centos2.daphne.com. IN A 192.168.200.129 www.daphne.com. IN CNAME centos2.daphne.com
vim 192.168.200.zone
$TTL 600 @ IN SOA centos.daphne.com. centso.daphne.com.( 2014052102 3H 15M 1W 1D) @ IN NS centos.daphne.com. IN NS centos2.daphne.com. 128 IN PTR centos.daphne.com. 129 IN PTR centos2.daphne.com.
chmod 644 daphne.com.zone
chmod 644 192.168.200.zone
chown :named daphne.com.zone
chown :named 192.168.200.zone
service named start
chkconfig named on
更改DNS的相关文件,不想重启服务
service named reload
从DNS服务器配置
1
Vim /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 { any; }; 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 { any; }; 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";
2 vim /etc/named.rfc1912.zones
在末尾添加
zone "daphne.com" IN { type slave; file "slaves/daphne.com.zone"; masters { 192.168.200.128; }; }; zone "200.168.192.in-addr.arpa" IN { type slave; file "slaves/192.168.200.zone"; masters { 192.168.200.128; }; };
在主服务器更新数据后,更改序号,从服务器会自动更新
从服务器的zone file是从主服务器那自动更新过了