1. 下载BIND dns服务器软件,下载地址
http://ftp.isc.org/isc/bind9/9.4.1-P1/BIND9.4.1-P1.zip
2. 解压BIND9.4.1-P1.zip,运行BINDInstall.exe安装工具,默认服务登录用户为named,输入口令,
开始安装
3. 安装程序将会创建新的named用户,同时创建c:/WINDOWS/system32/dns目录,bin子目录是运行目录,
etc是工作目录,另外还有ISC BIND服务,该服务指定登录用户为named
4. 如果不需要named用户,可以将其删掉,同时修改ISC BIND服务属性,将登录身份指定为本地系统
5. 开始配置BIND服务参数,假设
局域网域名:dev2.net
子网:192.168.0
dns服务器地址:192.168.0.253,主机名suse.dev2.net
bugzilla服务器地址:192.168.0.81,主机名为bugs.dev2.net
cvs服务器地址:192.168.0.81,主机名为cvs.dev2.net
www服务器地址:192.168.0.81,主机名为www.dev2.net
ftp服务器地址:192.168.0.81,主机名为ftp.dev2.net
6. 在etc目录下创建etc/named.conf文件,内容如下
options {
# The directory statement defines the name server's working directory
directory "C:/WINDOWS/system32/dns/etc/named";
# The forwarders record contains a list of servers to which queries
# should be forwarded. Enable this line and modify the IP address to
# your provider's name server. Up to three servers may be listed.
#forwarders { 192.0.2.1; 192.0.2.2; };
# Enable the next entry to prefer usage of the name server declared in
# the forwarders section.
#forward first;
# The listen-on record contains a list of local network interfaces to
# listen on. Optionally the port can be specified. Default is to
# listen on all interfaces found on your system. The default port is
# 53.
#listen-on port 53 { 127.0.0.1; };
# The listen-on-v6 record enables or disables listening on IPv6
# interfaces. Allowed values are 'any' and 'none' or a list of
# addresses.
listen-on-v6 { any; };
# The next three statements may be needed if a firewall stands between
# the local server and the internet.
#query-source address * port 53;
#transfer-source * port 53;
#notify-source * port 53;
# The allow-query record contains a list of networks or IP addresses
# to accept and deny queries from. The default is to allow queries
# from all hosts.
#allow-query { 127.0.0.1; };
# If notify is set to yes (default), notify messages are sent to other
# name servers when the the zone data is changed. Instead of setting
# a global 'notify' statement in the 'options' section, a separate
# 'notify' can be added to each zone definition.
notify no;
};
# The following zone definitions don't need any modification. The first one
# is the definition of the root name servers. The second one defines
# localhost while the third defines the reverse lookup for localhost.
zone "." in {
type hint;
file "root.hint";
};
zone "localhost" in {
type master;
file "localhost.zone";
};
zone "0.0.127.in-addr.arpa" in {
type master;
file "127.0.0.zone";
};
zone "dev2.net" in {
type master;
file "dev2.net.zone";
};
zone "0.168.192.in-addr.arpa" in {
type master;
file "192.168.0.zone";
};
named.conf第5行指定工作目录为etc/named,因此需要手动创建该目录。
7. 配置dns/etc/named/127.0.0.zone区文件,内容如下:
$TTL 1W
@ IN SOA suse.dev2.net. root.suse.dev2.net. (
42 ; serial (d. adams)
2D ; refresh
4H ; retry
6W ; expiry
1W ) ; minimum
IN NS suse.dev2.net.
1 IN PTR localhost.
8. 配置dns/etc/named/192.168.0.zone区文件,内容如下:
$TTL 1W
@ IN SOA suse.dev2.net. root.suse.dev2.net. (
42 ; serial (d. adams)
2D ; refresh
4H ; retry
6W ; expiry
1W ) ; minimum
IN NS suse.dev2.net.
253 IN PTR suse.dev2.net.
81 IN PTR bugs.dev2.net.
9. 配置dns/etc/named/dev2.net.zone区文件,内容如下:
$TTL 1W
@ IN SOA suse.dev2.net. root.suse.dev2.net. (
42 ; serial (d. adams)
2D ; refresh
4H ; retry
6W ; expiry
1W ) ; minimum
IN NS suse.dev2.net.
localhost IN A 127.0.0.1
suse IN A 192.168.0.253
bugs IN A 192.168.0.81
$ORIGIN dev2.net.
www IN CNAME bugs
ftp IN CNAME bugs
cvs IN CNAME bugs
10. 配置dns/etc/named/localhost.zone区文件,内容如下:
$TTL 1W
@ IN SOA suse.dev2.net. root.suse.dev2.net. (
42 ; serial (d. adams)
2D ; refresh
4H ; retry
6W ; expiry
1W ) ; minimum
IN NS suse.dev2.net.
IN A 127.0.0.1
11. 配置dns/etc/named/root.hint文件,内容如下:
; This file holds the information on root name servers needed to
; initialize cache of Internet domain name servers
; (e.g. reference this file in the "cache . <file>"
; configuration file of BIND domain name servers).
;
; This file is made available by InterNIC
; under anonymous FTP as
; file /domain/named.root
; on server FTP.INTERNIC.NET
; -OR- RS.INTERNIC.NET
;
; last update: Jan 29, 2004
; related version of root zone: 2004012900
;
;
; formerly NS.INTERNIC.NET
;
. 3600000 IN NS A.ROOT-SERVERS.NET.
A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4
;
; formerly NS1.ISI.EDU
;
. 3600000 NS B.ROOT-SERVERS.NET.
B.ROOT-SERVERS.NET. 3600000 A 192.228.79.201
;
; formerly C.PSI.NET
;
. 3600000 NS C.ROOT-SERVERS.NET.
C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12
;
; formerly TERP.UMD.EDU
;
. 3600000 NS D.ROOT-SERVERS.NET.
D.ROOT-SERVERS.NET. 3600000 A 128.8.10.90
;
; formerly NS.NASA.GOV
;
. 3600000 NS E.ROOT-SERVERS.NET.
E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10
;
; formerly NS.ISC.ORG
;
. 3600000 NS F.ROOT-SERVERS.NET.
F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241
;
; formerly NS.NIC.DDN.MIL
;
. 3600000 NS G.ROOT-SERVERS.NET.
G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4
;
; formerly AOS.ARL.ARMY.MIL
;
. 3600000 NS H.ROOT-SERVERS.NET.
H.ROOT-SERVERS.NET. 3600000 A 128.63.2.53
;
; formerly NIC.NORDU.NET
;
. 3600000 NS I.ROOT-SERVERS.NET.
I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17
;
; operated by VeriSign, Inc.
;
. 3600000 NS J.ROOT-SERVERS.NET.
J.ROOT-SERVERS.NET. 3600000 A 192.58.128.30
;
; operated by RIPE NCC
;
. 3600000 NS K.ROOT-SERVERS.NET.
K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129
;
; operated by ICANN
;
. 3600000 NS L.ROOT-SERVERS.NET.
L.ROOT-SERVERS.NET. 3600000 A 198.32.64.12
;
; operated by WIDE
;
. 3600000 NS M.ROOT-SERVERS.NET.
M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33
; End of File
12. 生成rndc.key文件,操作如下:
>cd C:/WINDOWS/system32/dns/bin
>rndc-confgen -a
13. 删除C:/WINDOWS/system32/drivers/etc/hosts文件全部内容
14. 启动ISC BIND服务,如果失败,事件查看器中可以找到原因
>cd C:/WINDOWS/system32/dns/bin
> named -f -g -d 1
15. 将192.168.0.81机器的DNS设为192.168.0.253,试验:
ping suse.dev2.net
(我本机测试没有通过,可以ping 通bug,我设置的dns是127.0.0.1)
C:/WINDOWS/system32/dns/bin/host -4 192.168.0.253
如果能PING通,同时IP地址反解析成功,表示DNS服务器配置正确。
(本文来此http://www.mangbar.com/document/5d023b2114e4c59b0114e5d029ce01ce,但笔者经过部分的修改)