域名解析服务器其实是在DNS缓存服务器的基础上,增加自己的权威解析域而来的。
本篇博文将直接讲述,如何在DNS缓存服务器的基础上把它变成一个域名解析服务器。不了解DNS缓存服务器的同学,请参考我的上一篇博文:
菜鸟也玩DNS之配置DNS缓存服务器
开始配置:
编辑named.conf文件,增加如下内容:
# vi /usr/local/named/etc/named.conf
#增加本地DNS负责的权威域xiaocui.com的资源文件
zone "xiaocui.com" IN {
type master;
file "xiaocui.com.zone";
allow-update { none; };
};
#增加本地DNS负责的权威域xiaocui.com的反向资源文件
zone "1.168.192.in-addr.arpa" IN {
type master;
file "xiaocui.com.rev";
allow-update { none; };
};
zone "xiaocui.com" IN {
type master;
file "xiaocui.com.zone";
allow-update { none; };
};
#增加本地DNS负责的权威域xiaocui.com的反向资源文件
zone "1.168.192.in-addr.arpa" IN {
type master;
file "xiaocui.com.rev";
allow-update { none; };
};
进入资源文件目录。
# cd /usr/local/named/dns/zone/
新建xiaocui.com的正向解析文件。
# vi xiaocui.com.zone
增加如下内容:
$TTL 86400
@ IN SOA xiaocui.com. root.xiaocui.com. (
1053891162 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS xiaocui.com.
IN A 192.168.1.10
www IN A 192.168.1.100
@ IN SOA xiaocui.com. root.xiaocui.com. (
1053891162 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS xiaocui.com.
IN A 192.168.1.10
www IN A 192.168.1.100
新建xiaocui.com的反向解析文件。
# vi xiaocui.com.rev
增加如下内容:
$TTL 86400
@ IN SOA xiaocui.com. root.xiaocui.com. (
20031001; Serial
7200 ; Refresh
3600 ; Retry
43200 ; Expire
86400 ) ; Minimum
IN NS xiaocui.com.
10 IN PTR xiaocui.com.
100 IN PTR www.xiaocui.com.
@ IN SOA xiaocui.com. root.xiaocui.com. (
20031001; Serial
7200 ; Refresh
3600 ; Retry
43200 ; Expire
86400 ) ; Minimum
IN NS xiaocui.com.
10 IN PTR xiaocui.com.
100 IN PTR www.xiaocui.com.
完成了配置文件和资源文件的更新后,使用rndc命令让named重新加载所有文件
# /usr/local/named/sbin/rndc -s localhost reload
通过查看系统日志来判断,bind9是否正确加载了新的信息,如果出现如下内容,说明加载成功。
# tail /var/log/messages
Oct 25 01:33:11 localhost named[3193]: reloading configuration succeeded
Oct 25 01:33:11 localhost named[3193]: zone 1.168.192.in-addr.arpa/IN: loaded serial 20031001
Oct 25 01:33:11 localhost named[3193]: zone xiaocui.com/IN: loaded serial 1053891162
Oct 25 01:33:11 localhost named[3193]: reloading zones succeeded
Oct 25 01:33:11 localhost named[3193]: zone 1.168.192.in-addr.arpa/IN: loaded serial 20031001
Oct 25 01:33:11 localhost named[3193]: zone xiaocui.com/IN: loaded serial 1053891162
Oct 25 01:33:11 localhost named[3193]: reloading zones succeeded
使用nslookup进行测试,查询到www.xiaocui.com的IP地址说明配置成功。
本文转自 cyr520 51CTO博客,原文链接:http://blog.51cto.com/cyr520/696738