named.conf
设置一般的named参数,指向该服务器使用的域数据库的信息源
named.conf.options
全局选项
db.root
根服务器指向文件, 由Internet NIC创建和维护, 无需修改, 但是需要定期更新
db.local
localhost正向区文件,用于将名字localhost转换为本地回送IP地址 (127.0.0.1)
db.127
localhost反向区文件,用于将本地回送IP地址(127.0.0.1)转换为名字localhost
其中,主配置文件/etc/named.conf的配置语句
命令 用法
acl 定义IP地址的访问控制清单
control 定义ndc使用的控制通道
include 把其他文件包含到配置文件中
key 定义授权的安全密钥
logging 定义日志写什么,写到哪
opitons 定义全局配置选项和缺省值
server 定义远程服务器的特征
trunsted-keys 为服务器定义DNSSEC加密密钥
zone 定义一个区
默认情况下, 内容如下:
include "/etc/bind/named.conf.options";
zone "." {
type hint;
file "/etc/bind/db.root";
};
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";
其中type项的值:
master:表示定义的是主域名服务器
slave :表示定义的是辅助域名服务器
hint:表示是互联网中根域名服务器
在Debian环境中,options语句的配置内容, 被移至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
};
3.5创建主域名服务器
a. 首先, 在在192.168.102.47机器上安全bind9
b. 使用编辑器,比如vi, 编辑配置文件/etc/bind/named.conf
加入如下内容
zone "mydebian.org" {
type master; //定义此区为主服务器
file "/etc/bind/db.mydebian"; 指定区资源文件的位置
};
zone "102.168.192.in-addr.arpa" {
type master; //定义此区为主服务器
file "/etc/bind/db.192"; //指定区资源文件的位置
};
c. 创建区资源文件:
创建区资源文件/etc/bind/db.mydebian内容如下
;
; BIND data file for local loopback interface
;
$TTL 604800
$ORIGIN mydebian.org.
@ IN SOA mydebian.org. root.mydebian.org. (
2006080401 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire