|主机|IP|role|
|:-?:-?:-?:-?
|serve1|172.25.9.1/24 , 172.25.254.1/24| DNS 服务器|
|server2|172.25.9.2/24|client|
|server3|172.25.254.3/24|client|
# dns 双向解析
## 新增记录文件
cd /var/named/
cp -p westos.com.zone westos.com.inter
vim westos.com.inter
$TTL 1D
@ IN SOA dns.westos.com. root.westos.com (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.westos.com.
dns A 172.25.254.1
www CNAME westos.a.westos.com.
westos.a A 172.25.254.12
westos.a A 172.25.254.13
westos.com. MX 1 172.25.254.14
## 配置区域文件
cp -p /etc/named.rfc1912.zones /etc/named.rfc1912.inters
vim /etc/named.rfc1912.inters
……
zone "westos.com" IN {
type master;
file "westos.com.inter";
allow-update { none; };
};
## 配置服务配置文件
vim /etc/named.conf
#
#zone "." IN {
# type hint;
# file "named.ca";
#};
#
#include "/etc/named.rfc1912.zones";
#include "/etc/named.root.key";
## client 为 172.25.9.0/24 网段配置,及匹配的记录文件
view localnet{
match-clients { 172.25.9.0/24; };
zone "." IN {
type hint;
file "named.ca";
};
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
};
## 其它 client 配置,及所匹配的记录文件
view internet {
match-clients { any; };
zone "." IN {
type hint;
file "named.ca";
};
include "/etc/named.rfc1912.inters";
include "/etc/named.root.key";
};
## 服务器 dns 只想自己,排除外在干扰
vim /etc/resolv.conf
nameserver 172.25.9.1
## 重启服务
systemctl restart named
# server2 dns 指向文件
vim /etc/resolv.conf
nameserver 172.25.9.1
# cli 测试,以正确解析到 server1 配置文件中对应的记录,成功。
dig www.westos.com
# server2 dns 指向文件
vim /etc/resolv.conf
nameserver 172.25.9.1
# cli 测试,以正确解析到 server1 配置文件中对应的记录,成功。
dig www.westos.com
server3 测试
server2 测试