Redhat7 配置DNS
安装bind软件(略)
# cp/etc/named.rfc1912.zones /etc/named.rfc1912.zones.bak
# vi/etc/named.rfc1912.zones (将现有模板改下内容,其余可全删)
zone “ming.com” IN {
type master;
file “ming.com.zone”;
allow-update { none };
};
Zone “2.0.0.10.in-addr.arpa”IN {
type master;
file “10.0.0.2.arpa”;
allow-update { none; };
:wq
# cd /var/named/
# cp name.localhost ming.com.zone
# cp name.loopback 10.0.0.2.arpa
# vi ming.com.zone (上半部分不动,下半部分删除)
$TTL 1D
@ IN SOA @ rname.invalid. (
0;
1D;
1H;
1W;
3H);
IN NS aa.ming.com.
aa IN A 10.0.0.2
bb IN A 10.0.0.2
# vi 10.0.0.2.arpa (上半部分不动,下半部分删除)
IN A 10.0.0.2
IN PTR aa.ming.com.
# chown named ming.com.zone
# chown named 10.0.0.2.arpa
# systemctl start named
开放防火墙53端口:
# firewall-cmd –permanent –add-port=53/port
# firewall-cmd --reload
验证:
将本机/etc/resolv.conf里的nameserver 改为127.0.0.1
正向解析:
# nslookup aa.ming.com
反向解析:
# nslookup 10.0.0.2
本文转自linux博客51CTO博客,原文链接http://blog.51cto.com/yangzhiming/1718660如需转载请自行联系原作者
yangzhimingg