标签:list val 修改 block check art var code oss
分别用于客户端,运营商dns,rootdns, comdns,magedumasterdns,mageduslavedns,www主机
从下往上开始建dns
都是仅主机模式,且各个ip分别定义为:客户机 192.168.31.5;运营商dns 192.168.31.6;www主机192.168.31.56;
magedumasterdns 192.168.31.36;mageduslavedns 192.168.31.46;comdns 192.168.31.26;rootdns 192.168.31.16;
192.168.31.56 安装httpd服务,生成个主页
links + ip 用于测试使用
hostname magedumaster yum install bind vim /etc/named.conf 注释 // listen-on port 53 { }; 注释 // allow-query {}; vim /etc/named.rfc1912.zones zone "magedu.com" IN { type master; file "magedu.com.zone" }; cd /var/named vim magedu.com.zone $TTL @ IN SOA dns1 admin ( 1 1D 1h 1W 3H ) NS dns1 NS dns2 dns1 A 192.168.31.36 dns2 A 192.168.31.46 www CNAME websrv websrv A 192.168.31.56 为了安全 vim /etc/named.conf 添加 allow-transfer { 192.168.31.46; }; 修改权限:chmod 640 magedu.com.zone 修改组:chgrp named magedu.com.zone 检查配置文件: named-checkconf named-checkzone magedu.com magedu.com.zone
hostname mageduslave yum install bind vim /etc/named.conf // listen-on port 53 {}; // allow-query {}; 添加这一行:allow-transfer { none ; }; vim /etc/named.rfc1912.zones zone "magedu.com" { type slave; masters {192.168.31.36;}; file "slaves/magedu.com.zone.slave"; }; cd /var/named ls slaves/ 查看下数据库文件 systemctl start named ls slaves/ 再次查看数据库文件 从客户端主机上测试 dig www.magedu.com @192.168.31.36
hostname comdns yum -y install bind vim /etc/named.conf 注释 // listen-on port 53 { }; 注释 // allow-query {}; vim /etc/named.rfc1912.zones zone "com" { type master; file "com.zone"; }; vim com.zone $TTL 1D @ IN SOA dns1 admin ( 1 1D 1h 1W 3H ) NS dns1 magedu NS dns2 magedu NS dns3 dns1 A 192.168.31.26 dns2 A 192.168.31.36 dns3 A 192.168.31.46 修改文件所属组:chgrp named com.zone service named start 在客户端主机进行测试: dig www.magedu.com @192.168.31.26
yum install bind vim /etc/named.conf // listen-on port 53 {}; // allow-query {}; 下面代码段需要进行修改 zone "." IN { type master; file "root.zone"; };
cd /var/named vim root.zone $TTL 1D @ IN SOA dns1 admin ( 1 1D 1H 1W 3H ) NS dns1 com NS dns2 dns1 A 192.168.31.16 dns2 A 192.168.31.26 service named start 在客户端主机上进行测试 dig www.magedu.com @192.168.31.16
hostname dnsserver yum install bind vim /etc/named.conf // listen-on port 53 {}; // allow-query {}; vim /var/named/named.ca 只留两行 修改 a.root-servers.net. 3600000 IN A 192.168.31.16
重新启动服务 service named restart
vim /etc/named.conf 将 dnssec-enable no; dnssec-validation no; rndc flush 清一下缓存 客户端主机指向DNS1 编辑网卡设置: DNS1=192.168.31.6 改完配置后,重启网络服务,让其生效 cat /etc/resolv.conf 确认DNS配置生效。
dig www.magedu.com
links www.magedu.com 测试
标签:list val 修改 block check art var code oss
原文地址:http://blog.51cto.com/11912662/2150690