广告位招租 联系qq:165345322

debian dns配置过程

时间:2007-09-22 19:49:31   来源:  作者:  点击:次  出处:技术无忧
关键字:dns debian 配置

安装过程如下:
# apt-get install bind9

安装完毕后,用命令whereis bind可以发现bind安装在/etc/bind目录下,进入/etc/bind目录,看到目录下有这些文件:
db.0
db.127
db.255
db.empty
db.local
db.rev
db.root
named.conf
named.conf.local
named.conf.options
rndc.key
其中的关键文件是named.conf,我们可以查看它的内容:
// This is the primary configuration file for the BIND DNS server named.
//
// Please read /usr/share/doc/bind9/README.Debian.gz for information on the
// structure of BIND configuration files in Debian, *BEFORE* you customize
// this configuration file.
//
// If you are just adding zones, please do that in /etc/bind/named.conf.local

include "/etc/bind/named.conf.options";

// prime the server with knowledge of the root servers
zone "." {
type hint;
file "/etc/bind/db.root";
};

// be authoritative for the localhost forward and reverse zones, and for
// broadcast zones as per RFC 1912

zone "localhost" {
type master;
file "/etc/bind/db.local";
};

zone "127.in-addr.arpa" {
type master;
file "/etc/bind/db.127";
};

zone "0.in-addr.arpa" {
type master;
file "/etc/bind/db.0";
};

zone "255.in-addr.arpa" {
type master;
file "/etc/bind/db.255";
};

include "/etc/bind/named.conf.local";
我们注意到此文件include 两个文件"/etc/bind/named.conf.options"和 "/etc/bind/named.conf.local",此外是一些DNS解析区域及其记录文件。在此文件的注释里提示,如果要增加区域的话,可以编辑/etc/bind/named.conf.local。
文件/etc/bind/named.conf.options的内容如下:
options {
directory "/var/cache/bind";

// 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 and later use an unprivileged
// port by default.

// query-source address * port 53;

// If your ISP provided one or more IP addresses for stable
// nameservers, you probably want to use them as forwarders.
// Uncomment the following block, and insert the addresses replacing
// the all-0's placeholder.

// forwarders {
// 0.0.0.0;
// };

auth-nxdomain no; # conform to RFC1035

};

文件/etc/bind/named.conf.local的内容如下,基本没有内容:
//
// Do any local configuration here
//

// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";
从以上内容可以看出,除DNS的本地域名外,其它部分已经正常。要增加本地域名解析只要编辑/etc/bind/named.conf.local,并增加相应记录文件即可。本目录下的其它文件不必更改。
这时可以作一些测试。笔者的测试环境如下:三台电脑,一台装debian,一台装redhat8,一台装win98,准备设置根域名为home,相应的域名与IP对应关系如下:
debian.home 192.168.10.103
win98.home 192.168.10.102
rh8.home 192.168.10.101
在安装DNS前,各台机子的DNS设置为202.101.98.54,这是福建省的域名服务器,各台电脑间的互访通过hosts文件解析。
在debian机子上,
/etc/resolve.conf的内容如下:
domain home.
nameserver 202.101.98.54
/etc/hosts的内容如下:
### etherconf DEBCONF AREA. DO NOT EDIT THIS AREA OR INSERT TEXT BEFORE IT.
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
192.168.10.103 debian.home debian
### END OF DEBCONF AREA. PLACE YOUR EDITS BELOW; THEY WILL BE PRESERVED.
192.168.10.102 win98.home win98
192.168.10.101 winme.home winme
在redhat8电脑上的配置与此类似。
在win98电脑上建立的/windows/hosts文件内容如下:
192.168.10.103 debian.home debian
192.168.10.102 win98.home win98
192.168.10.101 winme.home winme
也就是说在使用DNS前,它们用域名访问internet或互访都是正常。但现在我们要安装DNS,所以必须先它们去掉,才能知道所安装的DNS是否正常。步骤如下:
在debian机子上,
修改/etc/resolve.conf的内容如下:
domain home.
nameserver 192.168.10.103
/etc/hosts的内容如下:
### etherconf DEBCONF AREA. DO NOT EDIT THIS AREA OR INSERT TEXT BEFORE IT.
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
192.168.10.103 debian.home debian
### END OF DEBCONF AREA. PLACE YOUR EDITS BELOW; THEY WILL BE PRESERVED.
在redhat8电脑上的配置与此类似。技术无忧.net


 1/2    1 2 ›› ›|

文章评论

共有 0 位网友发表了评论 此处只显示部分留言 点击查看完整评论页面

特别推荐
300x250广告位招租