最近研究在Linux下健一DNS个缓存服务器,我选择了一台淘汰的服务器作为测试,我的系统环境为:
1、OS=Linux 5.1 ,版本=Linux fabuapp103 2.6.18-53.el5PAE #1 SMP Wed Oct 10 16:48:18 EDT 2007 i686 i686 i386 GNU/Linux,
2、 系统所安装的数据包
rpm -qa|grep bind
bind-chroot-9.3.3-10.el5
bind-libs-9.3.3-10.el5
ypbind-1.19-8.el5
bind-utils-9.3.3-10.el5
bind-9.3.3-10.el5
caching-nameserver-9.3.3-10.el5 缓存服务器所需要的
3、系统的配置文件
首先在/var/named/chroot/etc目录下使用命令建立配置文件named.conf
cp -p named.caching-nameserver.conf named.conf
文件内容如下(添加注释):
[root@fabuapp103 etc]# cat named.conf
//
// named.caching-nameserver.conf
//
// Provided by Red Hat caching-nameserver package to configure the
// ISC BIND named(8) DNS server as a caching only nameserver
// (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
// DO NOT EDIT THIS FILE - use system-config-bind or an editor
// to create named.conf - edits to this file will be lost on
// caching-nameserver package upgrade.
//
options {
listen-on port 53 { any; }; //由127.0.0.1;改为 any,目的是在所有IP上 //打开监听
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
query-source port 53;
query-source-v6 port 53;
allow-query {0.0.0.0/0;}; //由localhost改为0.0.0.0/0;允许所有IP访问
///allow-query { any; };
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
view localhost_resolver {
//match-clients { localhost; };
//match-destinations { localhost; };
match-clients { any;}; //由localhost 改为 any
match-destinations{ any;}; //由localhost 改为 any
recursion yes;
include "/etc/named.rfc1912.zones";
};
4、使用命令检查
在本机上用netstat -nlu|grep 53判断是否在所有ip上打开了监听
在本机上用nslookup 域名测试
5、若想跟踪一个FQDN名的解析过程,在Linux Shell下输入dig www.baidu.com +trace,返回的结果包括从跟域开始的递归或迭代过程,一直到权威域名服务器。