1.打开BIND的配置文件vi /etc/named.conf
2.添加以下区域条目zone "56.168.192.in-addr.arpa." in {
type master;
file "/var/named/zones/example.com.rev";
allow-transfer { none; };
};
注:56.168.192.in-addr.arpa。 是在192.168.56 / 24地址空间中对地址进行反向查找的FQDNzone "56.168.192.in-addr.arpa." in {type master;
file "/etc/named/zones/example.com.rev";
allow-transfer { none; };
};
3.创建/etc/named/zones/example.com.rev文件$TTL 1d
$ORIGIN 56.168.192.in-addr.arpa.
; start of authority
@ IN SOA ns1.example.com. hostmaster.example.com. (
2016041501 ; serial
12h ; refresh
5m ; retry
2w ; expire
3h) ; error TTL
; nameservers
IN NS ns1.example.com.
IN NS ns2.example.com.
10 IN PTR ns1.example.com.
20 IN PTR ns2.example.com.
; mail servers
12 IN PTR mail.example.com.
22 IN PTR mail2.example.com.
; web servers
100 IN PTR example.com.
100 IN PTR www.example.com.
100 IN PTR ftp.example.com.
4.确保区域文件具有正确的所有权和访问权限chown root.named /var/named/zones/example.com.rev
chmod 640 /var/named/zones/example.com.rev
5.重新启动BIND以使配置更改生效systemctl restart named.service
6.使用dig执行反向DNS查找以测试区域dig @192.168.56.10 -x 192.168.56.100