(感谢SilentRage 的文章,借助于他的配置文件从而实现了BIND在windows上的使用。SilentRage 的文章很全,涵括了windows、Linux下的BIND安装配置。感兴趣的朋友可以在http://forums.devshed.com搜索Bet you want to setup a DNS server huh)
- 下载windows版的BIND安装文件(作为演示,此处使用BIND9.4.2),下载网站:www.isc.org。
- 解压后,双击BINDInstall.exe开始安装。Server Account Name为BIND新建的帐户名,下面输入两遍帐户密码。不要选中Start BIND Service After Install。因为还需要配置,选择 Install 完成安装。
- 安装完成后,在dns目录下有两个文件夹etc和bin,bin里面是一些工具,而etc文件夹存放配置文件及日志文件。
- 下面我们在etc文件夹中加入配置文件:
- named.conf - Tell bind what domains you are hosting - plus some extra config stuff.
- rndc.key - This is the authentication key for rndc.exe to manage named.exe.
- named.ca - These are the DNS root servers.
- myexample.com.zone - This is an example zone file.
- 127.0.0.rev - This is an example of a reverse IP zone file.
5. NTFS 系统需要设置dns文件夹的权限,开放所有权限给 named 这个用户。通过dns文件夹“属性”中的“安全”选项卡添加named用户,并赋予named对dns文件夹的完全控制权限。(或者使用使用Cacls.exe命令修改dns文件夹的权限)
6. 到“控制面板”–>“管理工具”–>“服务”里启动“ISC BIND”这个服务即可开启BIND。
以下为配置文件的例子:
named.conf文件
#
# Example config created by SilentRage @ www.dollardns.net
#
# Server Configuration
#
options ... {
# Set the working directory from which all relative paths are based
#这里是Bind的安装路径
directory "C:WINDOWSsystem32dnsetc";
# RECURSION - Required for caching servers
# Default: yes
# Values : yes, no
#
# yes: Attempt to resolve requests we are not authoritative for
# no : Do not resolve requests we are not authoritative for
#
recursion yes;
# ALLOW-RECURSION - Who may use our caching server?
# Default: any;
# Values : any, none, (addresslist)
#
# any : anybody may use the caching server
# none : noone may use the caching server
# address: List of IP addresses that may use the caching server.
#
allow-recursion ...{ localhost; localnets; };
# FORWARD - Recommended for caching servers
# Default: first
# Values : first, only
#
# first: Query "forwarders" first, then resolve request ourself
# only : Only query the "forwarders" to resolve requests
#
#forward first;
# FORWARDERS - Required if "forward" is used
# Default: (no forwarding)
# Values : (addresslist)
#
# It is recommended that you use your ISP's caching server addresses
# Example: forwarders ...{ 127.0.0.1; 127.0.0.2; }
#
#forwarders ...{ };
# QUERY SOURCE - Useful for caching servers behind a firewall
# Default: address * port *
# Values : The IP address and port to use as the source of queries to other servers
#
#query-source address * port 53;
# NOTIFY - Relevant to authoritative servers
# Default: yes
# Values : yes, explicit, no
#
# yes : Send DNS NOTIFY messages to slave servers in zone NS records when zone changes
# explicit: Only send DNS NOTIFY messages to "also-notify" hosts
# no : Never automatically send DNS NOTIFY messages
#
notify no;
} ;
################################################################################
# Logging Configuration
#
logging ... {
#
# Define channels for the two log files
#
channel query_log ...{
severity info;
print-time yes;
file "query.log" versions 3 size 100M;
};
channel activity_log ...{
severity info;
print-time yes;
print-category yes;
print-severity yes;
file "activity.log" versions 3 size 100M;
};
#
# Send the interesting messages to the appropriate channels
#
category queries ...{ query_log; };
category default ...{ activity_log; };
category xfer-in ...{ activity_log; };
category xfer-out ...{ activity_log; };
category notify ...{ activity_log; };
category security ...{ activity_log; };
category update ...{ activity_log; };
#category update-security ...{ activity_log; }; # BIND 9.3 only
#
# Dump all uninteresting messages
#
category network ...{ null; };
category lame-servers ...{ null; };
} ;
################################################################################
# Zone Configuration
#
#
# Specify the root name servers
#
zone " . " IN ... {
type hint;
file "named.ca";
} ;
#
# Configure ourself as the host for basiczone.com
#
zone " myexample.com " IN ... {
type master;
file "myexample.com.zone";
} ;
#
# Reverse IP mapping for 127.0 . 0 .x
#
zone " 0.0.127.in-addr.arpa " ... {
type master;
file "127.0.0.rev";
} ;
#
# Example config created by SilentRage @ www.dollardns.net
#
# Server Configuration
#
options ... {
# Set the working directory from which all relative paths are based
#这里是Bind的安装路径
directory "C:WINDOWSsystem32dnsetc";
# RECURSION - Required for caching servers
# Default: yes
# Values : yes, no
#
# yes: Attempt to resolve requests we are not authoritative for
# no : Do not resolve requests we are not authoritative for
#
recursion yes;
# ALLOW-RECURSION - Who may use our caching server?
# Default: any;
# Values : any, none, (addresslist)
#
# any : anybody may use the caching server
# none : noone may use the caching server
# address: List of IP addresses that may use the caching server.
#
allow-recursion ...{ localhost; localnets; };
# FORWARD - Recommended for caching servers
# Default: first
# Values : first, only
#
# first: Query "forwarders" first, then resolve request ourself
# only : Only query the "forwarders" to resolve requests
#
#forward first;
# FORWARDERS - Required if "forward" is used
# Default: (no forwarding)
# Values : (addresslist)
#
# It is recommended that you use your ISP's caching server addresses
# Example: forwarders ...{ 127.0.0.1; 127.0.0.2; }
#
#forwarders ...{ };
# QUERY SOURCE - Useful for caching servers behind a firewall
# Default: address * port *
# Values : The IP address and port to use as the source of queries to other servers
#
#query-source address * port 53;
# NOTIFY - Relevant to authoritative servers
# Default: yes
# Values : yes, explicit, no
#
# yes : Send DNS NOTIFY messages to slave servers in zone NS records when zone changes
# explicit: Only send DNS NOTIFY messages to "also-notify" hosts
# no : Never automatically send DNS NOTIFY messages
#
notify no;
} ;
################################################################################
# Logging Configuration
#
logging ... {
#
# Define channels for the two log files
#
channel query_log ...{
severity info;
print-time yes;
file "query.log" versions 3 size 100M;
};
channel activity_log ...{
severity info;
print-time yes;
print-category yes;
print-severity yes;
file "activity.log" versions 3 size 100M;
};
#
# Send the interesting messages to the appropriate channels
#
category queries ...{ query_log; };
category default ...{ activity_log; };
category xfer-in ...{ activity_log; };
category xfer-out ...{ activity_log; };
category notify ...{ activity_log; };
category security ...{ activity_log; };
category update ...{ activity_log; };
#category update-security ...{ activity_log; }; # BIND 9.3 only
#
# Dump all uninteresting messages
#
category network ...{ null; };
category lame-servers ...{ null; };
} ;
################################################################################
# Zone Configuration
#
#
# Specify the root name servers
#
zone " . " IN ... {
type hint;
file "named.ca";
} ;
#
# Configure ourself as the host for basiczone.com
#
zone " myexample.com " IN ... {
type master;
file "myexample.com.zone";
} ;
#
# Reverse IP mapping for 127.0 . 0 .x
#
zone " 0.0.127.in-addr.arpa " ... {
type master;
file "127.0.0.rev";
} ;
rndc.key文件的生成方法:
使用命令行在 bin 下执行“rndc-confgen.exe > rndc.key”,将生成的 rndc.key 移到 etc 下。
named.ca 文件
; 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.cache
; 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
; 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.cache
; 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
myexample.com.zone 是对应named.conf中的zone "myexample.com" 的file
myexample.com.zone文件
$TTL 900 ; 900 seconds default record (T)ime (T)o (L)ive in cache
; Authored by SilentRage
;
@ SOA ns1 ( ; ns1.basiczone.com is the primary server for basiczone.com
postmaster ; contact email for basiczone.com is postmaster@basiczone.com
2004041700 ; Serial ID in reverse date format
21600 ; Refresh interval for slave servers
1800 ; Retry interval for slave servers
604800 ; Expire limit for cached info on slave servers
900 ) ; Minimum Cache TTL in zone records
@ NS ns1 ; ns1.myexample.com is a host for myexample.com
@ NS ns2 ; ns2.myexample.com is a host for myexample.com
@ A 127.0 . 0.4 ; myexample.com ' s IP address is 127.0.0.4
@ MX 10 mail ; Mail for * @myexample.com is sent to mail.myexample.com
ns1 A 127.0 . 0.1 ; ns1.myexample.com ' s IP address is 127.0.0.1
ns2 A 127.0 . 0.2 ; ns2.myexample.com ' s IP address is 127.0.0.2
mail A 127.0 . 0.3 ; mail.myexample.com ' s IP address is 127.0.0.3
www A 127.0 . 0.4 ; www.myexample.com ' s IP address is 127.0.0.4
$TTL 900 ; 900 seconds default record (T)ime (T)o (L)ive in cache
; Authored by SilentRage
;
@ SOA ns1 ( ; ns1.basiczone.com is the primary server for basiczone.com
postmaster ; contact email for basiczone.com is postmaster@basiczone.com
2004041700 ; Serial ID in reverse date format
21600 ; Refresh interval for slave servers
1800 ; Retry interval for slave servers
604800 ; Expire limit for cached info on slave servers
900 ) ; Minimum Cache TTL in zone records
@ NS ns1 ; ns1.myexample.com is a host for myexample.com
@ NS ns2 ; ns2.myexample.com is a host for myexample.com
@ A 127.0 . 0.4 ; myexample.com ' s IP address is 127.0.0.4
@ MX 10 mail ; Mail for * @myexample.com is sent to mail.myexample.com
ns1 A 127.0 . 0.1 ; ns1.myexample.com ' s IP address is 127.0.0.1
ns2 A 127.0 . 0.2 ; ns2.myexample.com ' s IP address is 127.0.0.2
mail A 127.0 . 0.3 ; mail.myexample.com ' s IP address is 127.0.0.3
www A 127.0 . 0.4 ; www.myexample.com ' s IP address is 127.0.0.4
127.0
.
0
.rev文件
$TTL 900 ; 900 seconds default record (T)ime (T)o (L)ive in cache
; Authored by SilentRage
;
; Download Location:
; http: // www.dollardns.net/bind/
@ SOA ns1.basiczone.com. ( ; ns1.basiczone.com is the primary server for basiczone.com
admin.basiczone.com. ; contact email for basiczone.com is admin@basiczone.com
2004041700 ; Serial ID in reverse date format
21600 ; Refresh interval for slave servers
1800 ; Retry interval for slave servers
604800 ; Expire limit for cached info on slave servers
900 ) ; Minimum Cache TTL in zone records
@ NS ns1.basiczone.com. ; ns1.basiczone.com is a host for 127.0 . 0 .x
@ NS ns2.basiczone.com. ; ns2.basiczone.com is a host for 127.0 . 0 .x
1 PTR ns1.basiczone.com. ; 127.0 . 0.2 is ns1.basiczone.com
2 PTR ns2.basiczone.com. ; 127.0 . 0.3 is ns2.basiczone.com
3 PTR mail.basiczone.com. ; 127.0 . 0.4 is mail.basiczone.com
4 PTR www.basiczone.com. ; 127.0 . 0.1 is www.basiczone.com
$TTL 900 ; 900 seconds default record (T)ime (T)o (L)ive in cache
; Authored by SilentRage
;
; Download Location:
; http: // www.dollardns.net/bind/
@ SOA ns1.basiczone.com. ( ; ns1.basiczone.com is the primary server for basiczone.com
admin.basiczone.com. ; contact email for basiczone.com is admin@basiczone.com
2004041700 ; Serial ID in reverse date format
21600 ; Refresh interval for slave servers
1800 ; Retry interval for slave servers
604800 ; Expire limit for cached info on slave servers
900 ) ; Minimum Cache TTL in zone records
@ NS ns1.basiczone.com. ; ns1.basiczone.com is a host for 127.0 . 0 .x
@ NS ns2.basiczone.com. ; ns2.basiczone.com is a host for 127.0 . 0 .x
1 PTR ns1.basiczone.com. ; 127.0 . 0.2 is ns1.basiczone.com
2 PTR ns2.basiczone.com. ; 127.0 . 0.3 is ns2.basiczone.com
3 PTR mail.basiczone.com. ; 127.0 . 0.4 is mail.basiczone.com
4 PTR www.basiczone.com. ; 127.0 . 0.1 is www.basiczone.com