平台:solaris10u8+BIND 9.3.6-P1(solaris 10 默认安装)
服务器端:
1.查看版本# /usr/local/sbin/named -v
2。生成RNDC(用于控制DNS服务器,Bind9有)配置文件/etc/rndc.conf
Bind9规定,如果要使用rndc来控制dns,必须先生成验证文件 rndc.conf
和密锁。
rndc.conf文件的内容,可用rndc-confgen命令生成
# /usr/local/sbin/rndc-confgen > /etc/rndc.conf
3。建立区域文件目录/etc/named
# mkdir /etc/named
配置named.conf
# vi /etc/named.conf
options {
//定义区域文件目录,表示以下各项配置中的文件默认在此目录中
directory "/etc/named";
};
//指定根DNS服务器的配置文件/etc/named/named.root,此文件可从网络下载
zone "." in {
type hint;
file "named.root";
};
//指定正向解析配置文件/etc/named/encle.zone
zone "encle.com" in {
type master;
file "encle.zone";
};
//指定反向解析配置文件/etc/named/encle.rzone,“111.19.172.”这里是根据网络IP分配情况而定,是反向IP前三段
zone "111.19.172.in-addr.arpa" in {
type master;
file "encle.rzone";
};
//指定环回反向解析配置文件/etc/named/named.local
zone "0.0.127.in-addr.arpa" in {
type master;
file "named.local";
};
// 把上面生成的/etc/rndc.conf的Key和Controls段内容拷到这里
key "rndc-key" {
algorithm hmac-md5;
secret "ZdAFUwS0QMr95427P7Xq+w==";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
4。配置区域文件
/etc/named/named.root
从
获得该文件的最新版本。
/etc/named/encle.zone
# vi /etc/named/encle.zone
; This file resolves hostnames to IP addresses in the encle.com. domain.
$ORIGIN encle.com.
$TTL 1d
encle.com. IN SOA dns.encle.com. wangnc.gmail.com. (
20080201 ; serial number
1h ; refresh
15m ; retry
1w ; expire
1d ) ; ttl
encle.com. IN NS dns.encle.com.
dns IN A 172.19.111.37
www IN A 172.19.111.40
test IN A 172.19.111.42
/etc/named/encle.rzone
# vi /etc/named/encle.rzone
; This file resolves IP addresses to hostnames in the encle.com. domain.
$ORIGIN 1.168.192.IN-ADDR.ARPA.
$TTL 1d
111.19.172.IN-ADDR.ARPA. IN SOA dns.encle.com. wangnc.gmail.com. (
20080201 ; serial number
3h ; refresh
1h ; retry
1w ; expire
1d ) ; ttl
111.19.172.IN-ADDR.ARPA. IN NS dns.encle.com.
37 IN PTR dns.encle.com.
40 IN PTR
42 IN PTR test.encle.com.
/etc/named/named.local
# vi /etc/named/named.local
$ORIGIN 0.0.127.IN-ADDR.ARPA.
$TTL 1d
0.0.127.IN-ADDR.ARPA. IN SOA dns.encle.com. wangnc.gmail.com. (
20080201 ; version number
3h ; refresh
1h ; retry
1w ; expire
1d ) ; ttl
0.0.127.IN-ADDR.ARPA. IN NS dns.encle.com.
1 IN PTR localhost.encle.com.
5。检查配置文件
# /usr/local/sbin/named-checkconf /etc/named.conf
# /usr/local/sbin/named-checkzone encle.com /etc/named/encle.zone
6。开启named服务进程
# /usr/local/sbin/named 或 # /usr/local/sbin/named -c /etc/named.conf
(针对named.conf没放在默认位置/etc下的情况)
查看开启的进程:
# ps -ef | grep named | grep -v grep
测试rndc是否成功:
# /usr/local/sbin/rndc status
number of zones: 14
debug level: 0
xfers running: 0
xfers deferred: 0
soa queries in progress: 0
query logging is OFF
recursive clients: 0/0/1000
tcp clients: 0/100
server is up and running
表示rndc已经成功控制Bind9。
7。查看是否有错误日志信息:
# tail -f /var/adm/messages
客户端:
/etc/resolv.conf
/etc/nsswitch.conf
用nslookup查询DNS服务器,验证客户端的设置。
阅读(719) | 评论(0) | 转发(0) |