server1为主DNS,server2为辅DNS,server3为转发器
在S1上安装DNS包
yum install bind*
设置IP,192.168.18.74
netmask:255.255.255.0
然后开始配置DNS主配置文件
vim /var/named/chroot/etc/named.conf (PS:named.conf是手动创建的文件)
options {
directory "/var/named";
};
zone "zmy.com." {
type master;
file "zmy.com.zone";
allow-transfer {192.168.18.114;};
};
然后配置DNS数据库文件
vim /var/named/chroot/var/named/zmy.com.zone
$TTL 86400
@ 1D IN SOA @ root (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
@ IN NS www.zmy.com.
www IN A 192.168.18.74
接下来就可以启动DNS服务了~~
service named start
在S2上配置辅助DNS,安装就不重复了
IP:192.168.18.114
netmask:255.255.255.0
vim /var/named/chroot/etc/named.conf
options {
directory "/var/named";
};
zone "zmy.com." {
type slave;
file "zmy.com.zone";
masters {192.168.18.74;};
};
然后启动服务,然后会发现数据没有同步过来,是因为权限问题,在S1跟S2上的/var/named给上770权限,然后再S2上重启服务,即可收到来自主服务器同步过来的数据
在S3上配置DNS转发器,安装照样略过
IP:192.168.18.154
netmask:255.255.255.0
然后开始配置转发器
vim /var/named/chroot/etc/named.conf
options {
directory "/var/named";
};
zone "zmy.com." {
type forward;
forwarders {192.168.18.74;192.168.18.114;};
};
配置完成后启动服务,接下来客户端的DNS指向转发器的IP地址即可解析www.zmy.com这个域名~~也就是配置OK啦~~