#######view功能应用#####
server: (192.168.8.1)
[root@dns named]# vim /etc/named.conf
59 acl a { 192.168.8.11; };
60 acl b { 192.168.8.12; };
62 view "ii" {
63 match-clients { a; };
64 zone "." IN {
65 type hint;
66 file "named.ca";
67 };
68
69 zone "bss.com" IN {
70 type master;
71 file "bss.com.zone";
72 };
73
74
75 };
78 view "oo" {
79 match-clients { b; };
80 zone "." IN {
81 type hint;
82 file "named.ca";
83 };
84
85 zone "bss.com" IN {
86 type master;
87 file "lyq.com.zone"; ##建立一个新的域文件,给"oo"使用
88 };
89
90
91 };
####将自己原有的域注释掉###
93 #zone "." IN {
94 # type hint;
95 # file "named.ca";
96 #};
97 #
98 #zone "bss.com" IN {
99 # type master;
100 # file "bss.com.zone";
101 #};
102 #
103 #zone "8.168.192.in-addr.arpa" IN {
104 # type master;
105 # file "bss.arpa.zone";
106 #};
107
108 #include "/etc/named.rfc1912.zones";
109 #include "/etc/named.root.key";
[root@dns named]# ls
bss.arpa.zone dynamic named.ca named.loopback
bss.com.zone Kxx.+157+35157.key named.empty slaves
data Kxx.+157+35157.private named.localhost
[root@dns named]# cp -a bss.com.zone lyq.com.zone
[root@dns named]# vim lyq.com.zone
@ IN SOA dns.bss.com. dns (
201908
1D
1H
1W
1H )
@ IN NS dns.bss.com.
dns.bss.com. A 192.168.8.11
www A 1.1.1.1 ##可以将地址改为想让通过"oo"来访
问的人看到的地址
ftp A 5.2.0.1
[root@dns named]# systemctl restart named
###########################################
测试
master(192.168.8.11):
[root@dns named]# nslookup
> www.bss.com
Server: 192.168.8.11
Address: 192.168.8.11#53
Name: www.bss.com
Address: 192.168.8.12
> ftp.bss.com
Server: 192.168.8.11
Address: 192.168.8.11#53
Name: ftp.bss.com
Address: 192.168.8.13
也可以同通过dig命令
[root@dns named]# dig www.bss.com
...
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 28914
...
;; ANSWER SECTION:
www.bss.com. 3600 IN A 192.168.8.12
;; AUTHORITY SECTION:
bss.com. 3600 IN NS dns.bss.com.
;; ADDITIONAL SECTION:
dns.bss.com. 3600 IN A 192.168.8.11
...
;; SERVER: 192.168.8.11#53(192.168.8.11)
...
slave:(192.168.8.12)
[root@dns-s1 slaves]# nslookup
> server
Default server: 192.168.8.11 ##查看下自己的DNS服务器,如果不是自己的服务器,
Address: 192.168.8.11#53 ##修改至自己的DNS,也可以通过server+ip更改临时测试
> www.bss.com
Server: 192.168.8.11
Address: 192.168.8.11#53
Name: www.bss.com
Address: 5.2.0.0
> ftp.bss.com
Server: 192.168.8.11
Address: 192.168.8.11#53
Name: ftp.bss.com
Address: 1.3.1.4