学校的DNS服务器是Linux操作系统,绑定DNS的时候发现总有点问题,常常客户端电脑无法得到正确的解析。于是我就自己研究了下Linux下的绑定域名设置bind软件。
我本地用的是Ubuntu 10.04, 使用前更新了下bind软件至最新bind9
bind 使用端口号53来进行通信,包括与其它DNS服务器交换解析信息,所以此商品不能被其它程序占用。
bind8 与bind9 的区别(自己翻译的,提供原文)
除了使用了多线程、程序代码重构,从而提供了更好的稳定性和安全性,还有其它一些区别:
Apart from being multi-threaded, and a complete code rewrite - which should provide better stability and security in the long term, there are other differences
如果在named.conf文件中有语法错误,BIND9会将它写到日志文件中并且不再重启域名服务器,BIND8会记录日志然后服务死掉。
If there is a syntax error in named.conf, BIND9 will log errors and not reload the named server. BIND8 will log errors and the daemon will die!
取得控制权的TSIGs(shared keys)扩展支持,比如“update-policy"可以取得控制从而动态更新数据。
Extensive support of TSIGs (shared keys) for access control, for example, “update-policy” can be used for fine grained access control of dynamic updates.
启动/停止/重启 工具等,rndc与bind8的ndc不同-不同的通信、授权和特性。
The tool for starting/stopping/reloading etc., rndc is different from the v8 ndc - different communications, authentication and features.
区域配置文件的语法更加严格(比如TTL行必须存在)
Syntax in zone files is more rigorously checked (e.g. a TTL line must exist)
有关named.conf文件的设定
bind8的"check-names"和"statistics-interval"这两项设定没有被移植到bind9中
v8 options ‘check-names’ and ‘statistics-interval’ are not yet implemented in V9.
"auth-nxdomain" 的默认值是"no",如果你没有手动设定这一项,bind9会在启动时生成相应的一条日志消息
the default for the option ‘auth-nxdomain’ is now ‘no’, if you don’t set this manually, BIND 9 logs a corresponding message on startup.
根域名服务器列表,在bind8中的named.root 或 root.hints不需要在BIND9中设定,因为它已经被服务器默认包含了。
The root server list, often called named.root or root.hints in BIND8 is not necessary in BIND 9, as it is included within the server.
在ubuntu中安装bind
sudo apt-get install bind9 dnsutils
配置bind
sudo vi /etc/bind/named.conf.local
修改这个文件,在里面添加下面这些内容:
zone "myqdc.com" {
type master;
file "/etc/bind/zones/myqdc.com.db";
};
zone "100.168.192.in-addr.arpa" {
type master;
file "/etc/bind/zones/rev.100.168.192.in-addr.arpa";
};
zone "myqdc.com" {type master;file "/etc/bind/zones/myqdc.com.db";};
zone "100.168.192.in-addr.arpa" {type master;file "/etc/bind/zones/rev.100.168.192.in-addr.arpa";};
其中,myqdc.com改为相应的域名,我本地IP地址是192.168.100.100