双向解析:
三台电脑
内网客户ip:1.1.1.48
外网客户IP:172.25.254.48
DNS服务器:eth0 172.25.54.148
eth1 1.1.1.148
编辑name.conf
50 /*
51 zone "." IN {
52 type hint;
53 file "named.ca";
54 };
55 */
57 view localnet {
58 match-clients { 1.1.1.0/24; };
59 zone "." IN {
60 type hint;
61 file "named.ca";
62 };
63 include "/etc/named.rfc1912.local"; 内网配置文件
64 };
65
66 view internet {
67 match-clients { any; };
68 zone "." IN {
69 type hint;
70 file "named.ca";
71 };
72 include "/etc/named.rfc1912.zones";外网配置文件
73 };
74
75 #include "/etc/named.rfc1912.zones";
76 #include "/etc/named.root.key";
77
cp -p /etc/named.rfc1912.zones /etc/named.rfc1912.local
创建内网配置文件
修改指向
vim /etc/named.rfc1912.local
25 zone "westos.com" IN {
26 type master;
27 file "westos.com.local";
28 allow-update { none; };
29 };
cd /var/named/
cp -p westos.com.zone westos.com.local
创建内网DNS
$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 1.1.1.100
www CNAME music.a
music.a A 1.1.1.8
music.a A 1.1.1.9
hello A 1.1.1.8
westos.com. MX 10 1.1.1.111.
测试:
外网dig
dig www.westos.com
;; ANSWER SECTION:
www.westos.com. 86400 IN CNAME music.a.westos.com.
music.a.westos.com. 86400 IN A 172.25.254.8
music.a.westos.com. 86400 IN A 172.25.254.9
内网dig
;; ANSWER SECTION:
www.westos.com. 86400 IN CNAME music.a.westos.com.
music.a.westos.com. 86400 IN A 1.1.1.8
music.a.westos.com. 86400 IN A 1.1.1.9