背景:
阅读新闻
RedHat CentOS搭建DNS服务器正向解析
[日期:2010-12-16] 来源:Linux社区 作者:zgqin0 [字体:]
以下是基于RedHat 5或CentOS系统的正向解析(IP192.168.1.2域名为)为保证建设成功请不要错过任何一个步骤,以下所写是详细步骤挨个执行命令也能保证成功!(反向解析步骤请参考下篇)
一.安装相关软件包:为保证顺利进行请按步骤先删除再重新安装所有软件包
[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 etc]# vim named.rfc1912.zones //修改主机配置文件的扩展名在最后一行添加
----------------------------------------------------------------------
zone "linuxidc.com" IN { //IN可有可无
type master; //类型为主域
file "linuxidc.com"; //域配置文件
};
---------------------------------------------------------------------
四.建立linuxidc.com的域配置文件
[root@server etc]# cd /var/named/chroot/var/named/ //进入/var/named/chroot/var/named/目录
[root@server named]# cp named.local linuxidc.com //拷贝域配置文件
[root@server named]# vim linuxidc.com
--------------------------------------------------------------------
$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.
www IN A 192.168.1.2 //修改最后一行为...(此行)