RedHat CentOS搭建DNS服务器正向解析
一.安装相关软件包:为保证顺利进行请按步骤先删除再重新安装所有软件包
[root@server ~]# rpm -qa | grep bind //查看bind相关软件包
[root@server ~]# rpm -e `rpm -qa | grep bind` --nodeps //删除相关软件包
[root@server ~]# mount /dev/cdrom /media/ //将系统光盘挂载到/media/
[root@server media]# cd /media/Server/ //进入/media/Server/目录
[root@server Server]# rpm -vih bind-* //再次安装相关软件包
[root@server Server]# rpm -vih caching-nameserver-9.3.3-7.el5.i386.rpm
[root@server Server]# service named start //重启named服务
二.修改主配置文件
[root@server Server]# cd /var/named/chroot/etc/ //进入/var/named/chroot/etc/目录
[root@server etc]# vim named.caching-nameserver.conf //修改主配置文件
----------------------------------------------------------------------
options {
listen-on port 53 { any; }; //修改为any
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 { any; }; //修改为any
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
view localhost_resolver {
match-clients { any; }; //修改为any
match-destinations { any; }; //修改为any
recursion yes;
include "/etc/named.rfc1912.zones";
};
----------------------------------------------------------------------
--------------------------------------------------------------------
[root@server named]# bind-chroot-admin -s //自动设置组和权限
[root@server named]# service named restart //重启named服务
五.测试验证
C:\Documents and Settings\Administrator>nslookup //在远端windows撒谎那个验证成功
*** Can't find server name for address 219.244.93.2: Non-existent domain
*** Default servers are not available
Default Server: UnKnown
Address: 219.244.93.2 //本来DNS为219.244.93.2
> server 192.168.1.2 //更改解析主机
Default Server: [192.168.1.2]
Address: 192.168.1.2