安装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/
# cpname.localhost ming.com.zone
# cpname.loopback 10.0.0.2.arpa
# viming.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
:wq
# vi10.0.0.2.arpa (上半部分不动,下半部分删除)
$TTL 1D
@ IN SOA @ rname.invalid. (
0;
1D;
1H;
1W;
3H);
IN NS aa.ming.com.
IN A 10.0.0.2
IN PTR aa.ming.com.
:wq
# chownnamed ming.com.zone
# chownnamed 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