centos7.6 DNS服務(wù)
1、安裝bind服務(wù)
?yum?clean?all
yum?install?-y?bind
rpm?-qa|grep??bind
2、修改全局配置文件
vim?/etc/named.conf
將listen-on?port?53{127.0.0.0;};改成listen-on?port?53{any;};
將allow-query{localhost;};改成allow-query{localnets;};
修改include?“/etc/named.zones”;
3、修改主配置文件
cd?/etc
cp?-p?named.rfc1912.zones??named.zones
vim?named.zones
zone?"myj.edu.cn"?IN{
type?master;
file?"zone.myj.edu.cn";
allow-update{none;};
};
zone?"128.168.192.in-addr.arpa"?IN{
type?master;
file?"zone.192.168.128";
allow-update{none;};
};
4、創(chuàng)建正向解析和反向解析區(qū)域文件
?cd??/var/named
cp?-p?named.localhost?zone.myj.edu.cn
cp?-p?named.loopback?zone.192.168.128
ls?-l
5、正向解析區(qū)域文件
vim?zone.myj.edu.cn
修改@myj.edu.cn.
添加代碼
@????IN????NS????ns1.myj.edu.cn
@????IN????NS????ns2.myj.edu.cn
@????IN????MX??10??mail.myj.edu.cn
ns1????IN????A????192.168.128.100
ns2????IN????A????192.168.128.101
mail????IN????A????192.168.128.110
www????IN????A????192.168.128.120
ftp????IN????A????192.168.128.130
web????IN????CNAME????www.myj.edu.cn
6、反向區(qū)域解析文件
vim?zone.192.168.128
修改成@myj.edu.cn.
添加代碼
@????IN????NS????ns1.myj.edu.cn
@????IN????NS????ns2.myj.edu.cn
@????IN????MX??10??mail.myj.edu.cn
100????IN????PTR????ns1.myj.edu.cn
101????IN????PTR????ns2.myj.edu.cn
110????IN????PTR????mail.myj.edu.cn.
120????IN????PTR????www.myj.edu.cn.
130????IN????PTR????ftp.myj.edu.cn
7、重啟服務(wù)
systemctl?restart?named
8、防火墻放行
firewall-cmd?--permanent?--add-service=dns
firewall-cmd?--reload
firewall-cmd?--list-all
ls?-l??/etc/named.zones
ls?-l?/var/named/zone*
9、驗(yàn)證
vim?/etc/resolv.conf
nameserver?192.168.128.100
search?myj.edu.cn
nslookup?www.myj.edu.cn
dig?-t?A?www.myj.edu.cn
host?www.myj.edu.cn