文档库 最新最全的文档下载
当前位置:文档库 › Redhat Linux下DNS配置

Redhat Linux下DNS配置

Redhat Linux下DNS配置
Redhat Linux下DNS配置

Redhat Linux 下DNS配置

环境:企业局域网

系统:Redhat9.0,并设有三个段的IP(四网卡),分别是192.168.2.7 ; 192.168.6.7 ; 192.168.10.7

需配置文件:1./etc/named.conf(系统自带)

2./var/named/2.168.192.file(自建)

3./var/named/6.168.192.file(自建)

4./var/named/10.168.192.file(自建)

5./var/named/https://www.wendangku.net/doc/9a6592316.html,

6./etc/host.conf

跟很多菜菜们一样,我配置DNS也是一波三折,人都搞晕掉了,查了很多资料也问了很多人,但得到的结果始终是那句:Can't find ...。一怒之下,把自带的BIND干掉,重新安装了与之相关的所有套件再配置。嘿嘿...搞定!!!,后来怀疑可能是套件有问题或者是并没有装全(未经考证)。小弟我谨以此文章感谢所有无私网友的奉献精神,并希望它能带给正处困境中的Linuxer一点帮助或启示。

一、安装BIND:

1.下载如下套件:bind-devel-9.

2.1-16.i386.rpm

bind-utils-9.2.1-16.i386.rpm

bind-9.2.1-16.i386.rpm

caching-nameserver-7.2-7.noarch.rpm

2.如有自带BIND先除去。在rpm -e bind时可能出现错误提示:

[root@andrew root]# rpm -e bind

error: Failed dependencies:

bind = 9.2.1 is needed by (installed) bind-devel-9.2.1-16

bind is needed by (installed) caching-nameserver-7.2-7

bind >= 9.1.3-0.rc2.3 is needed by (installed) caching-nameserver-7.2-7

那就得先将提示的几个套件先移除。

3.安装BIND及相关。rpm -ivh xxx.rpm即可。

当然,我把自带BIND移除也是被逼无路,迫不得已的之行为,对于高手们来说可能完全不必要。二、具体配置及说明:

###named.conf

// generated by named-bootconf.pl

options {

directory "/var/named"; ##指定DNS文件所在的目录

/*

* If there is a firewall between you and nameservers you want

* to talk to, you might need to uncomment the query-source

* directive below. Previous versions of BIND always asked

* questions using port 53, but BIND 8.1 uses an unprivileged

* port by default.

*/

// query-source address * port 53;

};

//

// a caching only nameserver config

//

controls {

inet 127.0.0.1 allow { localhost; } keys { rndckey; };

};

zone "." IN {

type hint; ##为named建立高速缓存信息

file "named.ca"; ##指向根域名服务器

};

zone "localhost" IN { ##本地主机正向解析配置(自带)

type master; ##声明named对指定的域具有控制权,并使named从指定的区域加载信息

file "localhost.zone";

allow-update { none; };

};

zone "0.0.127.in-addr.arpa" IN { #本地反向解析配置(自带)

type master;

file "named.local"; ##用于在本地转换回送地址

allow-update { none; };

};

zone "10.168.192.in-addr.arpa" IN { ##IP为10段的反向解析设置

type master;

file "10.168.192.file";

};

zone "2.168.192.in-addr.arpa" IN { ##IP为2段的反向解析设置

type master;

file "2.168.192.file";

};

zone "6.168.192.in-addr.arpa" IN { ##IP为6段的反向解析设置

type master;

file "6.168.192.file";

};

zone "https://www.wendangku.net/doc/9a6592316.html," IN { ##正向解析设置

type master;

file "https://www.wendangku.net/doc/9a6592316.html,";

};

include "/etc/rndc.key";

###10.168.192.file ; 6.168.192.file ; 2.168.192.file(反向解析文件,分别建立三个文件,内容相同) $TTL 86400

@ IN SOA https://www.wendangku.net/doc/9a6592316.html,. https://www.wendangku.net/doc/9a6592316.html,.(

###这个区信息文件的版本号,用它来确定这个区信息的文件是何时改变的。

2 ; Serial

###辅助域名服务器在试图检查主域名服务器的SOA记录之前应等待的秒数

28800 ; Refresh

###辅助服务器在主服务器不能使用时,重试对主服务器的请求应等待的秒数。

14400 ; Retry

###辅助服务器在不能与主服务器取得联系的情况下丢掉区信息之前应等待的秒数,一般应该设置成30天左右

3600000 ; Expire

###当没有指定ttl资源记录时默认的ttl值(一般默认的就行了)

86400 ) ; Minimum

@ IN NS https://www.wendangku.net/doc/9a6592316.html,.

7 IN PTR https://www.wendangku.net/doc/9a6592316.html,.

### https://www.wendangku.net/doc/9a6592316.html, (正向解析文件)

$TTL 86400

@ IN SOA https://www.wendangku.net/doc/9a6592316.html,. https://www.wendangku.net/doc/9a6592316.html,.(

2 ; serial

28800 ; refresh

7200 ; retry

604880 ; expiry

86400 ; minimum

)

@ IN NS https://www.wendangku.net/doc/9a6592316.html,.

localhost IN A 127.0.0.1

www IN A 192.168.10.7

www IN A 192.168.2.7

www IN A 192.168.6.7

####resolv.conf 用于当配置转换程序使用BIND域名服务查询主机时,我们必须告诉转换程序使用哪一个域名服务器。

domain https://www.wendangku.net/doc/9a6592316.html,

nameserver 192.168.10.7

nameserver 192.168.2.7

nameserver 192.168.6.7

search localhost

###host.conf (按照哪种顺序来尝试不同的名字解析机制)

###DNS一般设置先用bind,否则先解析hosts的话,容易让你产生误会。最好不要去设置/etc/hosts文件。order bind hosts

三、检测。

用nslookup,输入https://www.wendangku.net/doc/9a6592316.html,看是否配置成功。这里需要注意一点,服务器上的DNS一定要设为本机的IP,而不能设成IPS的DNS。至于为什么嘛,很简单自己想想就明白了。按以上配置方法反正我是屡配不爽。四、说明因每个人情况不同,以上所述仅供参考。

相关文档