BIND 是一个开源的跨平台的DNS服务器软件,在LINUX平台下实现很方便。不过我的开发环境为WINDOWS,由于工作需要一个泛域名,但在hosts文件中只能一个个添加,于是想到了用BIND来实现。在网上找了一些资料,发现很少,并且很难按他们的配置成功。在另一个朋友的帮助下,终于被我摸索出来了。
安装就不多说,去http://www.isc.org/software/bind 下载Windows版本安装,直接next就可以。
默认应该是安装在c:\windows\system32\dns\里面。配置文件在c:\windows\system32\dns\etc下。这里给出test.com的泛域名配置文件,共3个配置文件。
options {
directory "c:\windows\system32\dns\etc"; #named区文件目录
pid-file "named.pid"; #进程id文件名
allow-transfer { none; };
recursion no;
};
zone "test.com" IN {
type master;
file "test.com.zone";
allow-transfer { none; };
};
key "rndc-key" {
algorithm hmac-md5;
secret "uiRGcdCKa4MEo98BW8U98g==";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
rndc.conf
# Start of rndc.conf
key "rndc-key" {
algorithm hmac-md5;
secret "uiRGcdCKa4MEo98BW8U98g==";
};
options {
default-key "rndc-key";
default-server 127.0.0.1;
default-port 953;
};
# End of rndc.conf
test.com.zone
$TTL 6h @ IN SOA your-nameserver.test.com. hostmaster.test.com. ( 2012022201 10800 3600 604800 86400 ) @ NS your-nameserver.test.com. * IN A 192.168.1.110写好配置好直接在CMD下:net start "ISC BIND",或者在服务里启动也行。如果出错,具体请查看日志,若没有出错,则可以将DNS改为127.0.0.1,然后PING *.test.com,都将指向192.168.1.110