BIND&DNS内部培训教程2
(6)主服务器:
主服务器是给定域的所有信息的授权来源。它所装载的域信息来自于由域管理员所创建
并在本地维护的磁盘文件。
我们用"test.com"作为例子,我们需要五个基本配置文件:
/etc/named.conf
/var/named/named.ca
/var/named/named.local
/var/named/named.test.com
/var/named/named.172.16.0
(6.1)创建或修改/etc/named.conf:
// generated by named-bootconf.pl
options {
directory "/var/named";
/*
* 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 PM nameserver config
北京蓝色先锋软件有限公司版权所有违者必究
地址:北京市北京站东街甲10 号华安商务楼6 层
网址: www.bluepioneer.com.cn 邮编:100005 第8 页共14 页
电话:( 010 ) 65594026 传真:( 010 ) 65594064
//
zone '.' {
type hint;
file "named.ca";
};
zone '0.0.127.in-addr.arpa' {
type master;
file "named.local";
};
//there are our primary zone files
zone "test.com" {
type master;
file "named.test.com";
};
zone '0.16.172.in-addr.arpa' {
type master;
file 'named.172.16.0';
};
文件中的zone 'test.com'段是声明这是用于test.com 域的主服务器,用于该域的数据
从/var/named/named.test.com 文件中装载。
文件中的zone '0.16.172.in-addr.arpa'段是指向映射IP 地址172.16.0.* 到主机名的
文件。用于该域的数据从/var/named/named.172.16.0 文件中装载。
(6.2)创建或修改/var/named/named.local
@ IN SOA ns.test.com. root.ns.test.com. (
2000051500 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS ns.test.com.
1 IN PTR localhost.
注意:在修改named.*文件时每次存盘时要注意增加Serial 值,如使用绝对域名时千万别忘了后面带的'.'。
资源记录中的@字符转变为当前的域test.com,IN 表示资源记录使用TCP/IP 地址,SOA 表示管辖开始记录.ns.test.com. 是这个域的主DNS 服务器的标准名称,在之后是联系的
EMAIL 地址,其中@字符必须用'.'代替。
(6.3)创建或修改/var/named/named.test.com
@ IN SOA ns.test.com. root.ns.test.com. (
2000051500 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS ns.test.com.
ns A 172.16.0.1
ns2 A 172.16.0.11
www A 172.16.0.2
ftp CNAME www.test.com.
mail A 172.16.0.3
MX 10 mail.test.com.
(6.4)创建或修改/var/named/named.172.16.0
@ IN SOA ns.test.com. root.ns.test.com. (
2000051500 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS ns.test.com.
1 IN PTR ns.test.com.
11 IN PTR ns1.test.com.
2 IN PTR www.test.com.
3 IN PTR mail.test.com.
(7)辅服务器
辅服务器从主服务器上获取域信息的完整拷贝.也能以授权方式回答有关域的查询。我们用'test.com'作为例子,我们需要五个基本配置文件:
/etc/named.conf
/var/named/named.ca
/var/named/named.local
(7.1)创建或修改/etc/named.conf:
// generated by named-bootconf.pl
options {
directory "/var/named";
/*
* 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 SM nameserver config
//
zone '.' {
type hint;
file "named.ca";
};
zone '0.0.127.in-addr.arpa' {
type master;
file "named.local";
};
//there are our slave zone files
zone "test.com" {
type slave;
file "named.test.com";
masters {172.16.0.1;};
};
zone '0.16.172.in-addr.arpa' {
type slave;
file 'named.172.16.0';
masters {172.16.0.1;};
};
在文件中'masters {172.16.0.1;};'其中的IP 地址是你网络中主服务器的IP 地址。从主服务器上拷贝/var/named/named.ca 和/var/named/named.local 这两个文件。实际运行的服务器可以是以上其中一种配置,也能同时包含多种配置,但所有的系统都应该运行解析器。
文章录入:csh 责任编辑:csh