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,但筆者經過部分的修改)