可以看到,DNS服务启动成功了。
在查询以前,要在客户端来指定DNS Server,在/etc/resolv.conf这个文件中指定。
[root@beiku1 etc]# vi /etc/resolv.conf
search linuxidc.com
nameserver 10.138.130.161
[root@beiku1 etc]# service named restart
Stopping named: [ OK ]
Starting named: [ OK ]
参数及意义:
nameserver 表明dns 服务器的ip 地址,可以有很多行的nameserver,每一个带一个ip地址。
在查询时就按nameserver 在本文件中的顺序进行,且只有当第一个nameserver 没有反应时才查询下面的nameserver.
domain 声明主机的域名。很多程序用到它,如邮件系统;当为没有域名的主机进行dns 查询时,也要用到。如果没有域名,主机名将被使,用删除所有在第一个点( . )前面的内容。
search 它的多个参数指明域名查询顺序。当要查询没有域名的主机,主机将在由search 声明的域中分别查找。
domain 和search 不能共存;如果同时存在,后面出现的将会被使用。
sortlist 允许将得到域名结果进行特定的排序。它的参数为网络/掩码对,允许任意的排列顺序。
再来使用nslookup工具来查询一下
[root@beiku1 named]# nslookup beiku1.linuxidc.com
Server: 10.138.130.161
Address: 10.138.130.161#53
Name: beiku1.linuxidc.com
Address: 10.138.130.161
[root@beiku1 named]# nslookup beiku2.linuxidc.com
Server: 10.138.130.161
Address: 10.138.130.161#53
Name: beiku2.linuxidc.com
Address: 10.138.130.162
[root@beiku1 named]# nslookup beikuscan.linuxidc.com
Server: 10.138.130.161
Address: 10.138.130.161#53
Name: beikuscan.linuxidc.com
Address: 10.138.130.169
Name: beikuscan.linuxidc.com
Address: 10.138.130.167
Name: beikuscan.linuxidc.com
Address: 10.138.130.168
[root@beiku1 named]# nslookup beiku1
Server: 10.138.130.161
Address: 10.138.130.161#53
Name: beiku1.linuxidc.com
Address: 10.138.130.161
[root@beiku1 named]# nslookup beiku2
Server: 10.138.130.161
Address: 10.138.130.161#53
Name: beiku2.linuxidc.com
Address: 10.138.130.162
[root@beiku1 named]# nslookup beikuscan
Server: 10.138.130.161
Address: 10.138.130.161#53
Name: beikuscan.linuxidc.com
Address: 10.138.130.168
Name: beikuscan.linuxidc.com
Address: 10.138.130.169
Name: beikuscan.linuxidc.com
Address: 10.138.130.167
[root@beiku1 named]# nslookup 10.138.130.161
Server: 10.138.130.161
Address: 10.138.130.161#53
161.130.138.10.in-addr.arpa name = beiku1.linuxidc.com.
[root@beiku1 named]# nslookup 10.138.130.162
Server: 10.138.130.161
Address: 10.138.130.161#53
162.130.138.10.in-addr.arpa name = beiku2.linuxidc.com.
[root@beiku1 named]# nslookup 10.138.130.167
Server: 10.138.130.161
Address: 10.138.130.161#53
167.130.138.10.in-addr.arpa name = beikuscan.linuxidc.com.
[root@beiku1 named]# nslookup 10.138.130.168
Server: 10.138.130.161
Address: 10.138.130.161#53
168.130.138.10.in-addr.arpa name = beikuscan.linuxidc.com.
[root@beiku1 named]# nslookup 10.138.130.169
Server: 10.138.130.161
Address: 10.138.130.161#53
169.130.138.10.in-addr.arpa name = beikuscan.linuxidc.com.
可以看到,DNS解析一切正常,上面只是配置了主DNS服务器,而且主DNS服务器也工作正常,现在我们来配置一个辅助DNS服务器