һ.Bind 顣

BindһԴDNSBindݴѧBerkeleyУάģȫΪBerkeley Internet Name DomainĿǰʹΪ㷺DNSָ֧unixƽ̨windowsƽ̨ĽRed hat Linux 9İװá

.Դ

ٷվhttp://www.bind.com/ 

ԴBind ǿԴȥٷվءhttp://www.isc.org/index.pl/sw/bind/ Ŀǰ°汾Ϊbind-9.3.1

ĵhttp://www.isc.org/index.pl/sw/bind/ иȽȫİĵ

FAQhttp://www.isc.org/index.pl/sw/bind/ ش˸ĳ⡣

ļhttp://www.bind.com/bind.html һЩȽϱ׼ļ

.İװ

1.װ

ٷվԴbind-9.3.1. tar.gzҽ԰װ̵һЩҪ裬ͣ



[root@localhost root]#tar xzvf bind-9.3.1. tar.gz
[root@localhost root]#cd bind-9.3.1
[root@localhost bind-9.3.1]#./configure 
[root@localhost bind-9.3.1]#make
[root@localhost bind-9.3.1]#make install
 



tar xzvf bind-9.3.1.tar.gz ѹ 

./configure Իװļã󲿷ֵĹɻԶɵģûͨһЩһã䳣ѡУ 

./configure --help 쿴ð 

--prefix= ָװĿ¼Ĭ/usr/local/ 

--enable-ipv6 ֧ipv6 

õĲܶ࣬ͨ -help쿴Ҫģһ£ĬþͿˡ 

Ĭ£װǲὨļһЩĬϵģԴһЩ׼ļhttp://www.bind.com/bind.htmlҲʹñṩļ 

Ĭ£װdeamonΪ/usr/local/sbin/named 

Ĭϵļ/etc/named.confֶ 

2. 


[root@localhost root]# /usr/local/sbin/named -g
 



/usr/local/sbin/namedĬһ̨deamon ,-gѡʾǰ̨УϢӡ׼ǰװԽ׶Ƿǳаġ 

ļļĲֽps aux ӦÿԲ鵽named Ḷ̌netstat -an ҲԿ53˿ڵķѾˡDNSĬ϶˿Ϊ53 

ҪÿDNS serverֻ/etc/rc.d/rc.localмһ 

/usr/local/sbin/named 


#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local

/usr/local/sbin/named
 


.á

1.ļ

ĬϰװļλΪ

/etc/named.conf

𲽷һȽϻļעnamedļúcͬעͷţ

(1) log options


/*
 * log option
 */
logging { 
	channel default_syslog { syslog local2; severity error; };
	channel audit_log { file "/var/log/named.log"; severity error; print-time yes; };
	category default { default_syslog; }; 
	category general { default_syslog; }; 
	category security { audit_log; default_syslog; }; 
	category config { default_syslog; }; 
	category resolver { audit_log; }; 
	category xfer-in { audit_log; }; 
	category xfer-out { audit_log; }; 
	category notify { audit_log; }; 
	category client { audit_log; }; 
	category network { audit_log; }; 
	category update { audit_log; }; 
	category queries { audit_log; }; 
	category lame-servers { audit_log; };
};
 



һ־ãҪ 

file "/var/log/named.log" һָ־ļλãҪnamedҪ֤һļǴڵģnamed ̶ждȨޡ 

(2) options 


options {
	directory "/etc/namedb";

    listen-on-v6 { any; };

// If you've got a DNS server around at your upstream provider, enter
// its IP address here, and enable the line below.  This will make you
// benefit from its cache, thus reduce overall DNS traffic in the Internet.

	forwarders {
		your.upper.DNS.address;
	};

	/*
	 * If there is a firewall between you and nameservers you want
	 * to talk to, you might need to uncomment the query-source
	 * directive below.  Previous versions of BIND always asked
	 * questions using port 53, but BIND 8.1 uses an unprivileged
	 * port by default.
	 */
	// query-source address * port 53;

	/*
	 * If running in a sandbox, you may have to specify a different
	 * location for the dumpfile.
	 */
	dump-file "/etc/named_dump.db";
};
 



һһЩ 

directory "/etc/namedb"; ָļĴĿ¼ֶ 

listen-on-v6 { any; }; ֧ipv6 

forwarders { 

your.upper.DNS.address; 

}; ָǰDNS޷ͻᱻתǰDNSн 

dump-file "/etc/named_dump.db"; ָnamed_dump.dbļλá 

(3) ͻػ 


// Setting up secondaries is way easier and the rough picture for this
// is explained below.
//
// If you enable a local name server, don't forget to enter 127.0.0.1
// into your /etc/resolv.conf so this server will be queried first.
// Also, make sure to enable it in /etc/rc.conf.

zone "." {
	type hint;
	file "named.root";
};

zone "0.0.127.IN-ADDR.ARPA" {
	type master;
	file "localhost.rev";
};
 



ָͱػػһʹһЩ׼ӾͿԡ 

file "named.root"; ָĽļĿ¼Ϊoptionsdirectory "/etc/namedb";ָġڱΪ/etc/namdb 

(4)Զ 


zone "test.com" {
	type	master;
	file	"zone.test ";
};

zone "0.168.192.in-addr.arpa" {
	type	master;
	file	"zone. test.rev";
};
zone "4.0.0.f.0.5.2.0.1.0.0.2.IP6.ARPA" {	
	type master;
	allow-transfer { any;};
        allow-query { any; };		
	file "ipv6.rev";
};

zone "lowerlevelzone.test.com" {
	type	slave;
		masters {
		192.168.1.1;
	};
};
 



һļҪصĵĲ֣ 

zone "test.com" { 

type master; 

file "zone.test "; 

}; 趨test.com; 

type master ָҪɱ; 

file "zone.test "ָļΪzong.testĿ¼Ϊoptions趨Ŀ¼Ϊ/etc/named 

zone "0.168.192.in-addr.arpa" { 

type master; 

file "zone. test.rev"; 

}; ָipv4ַ 

type master ָҪɱ; 

file "zone.test.rev "ָļΪzong.test.revĿ¼Ϊoptions趨Ŀ¼Ϊ/etc/named 

zone "4.0.0.f.0.5.2.0.1.0.0.2.IP6.ARPA" { 

type master; 

allow-transfer { any;}; 

allow-query { any; }; 

file "ipv6.rev"; 

};ָipv4ַ 

type master ָҪɱ; 

file " ipv6.rev "ָļΪipv6.revĿ¼Ϊoptions趨Ŀ¼Ϊ/etc/named 

zone "lowerlevelzone.test.com" { 

type slave; 

masters { 

192.168.1.1; 

}; 

}; 趨lowerlevelzone.test.com; 

type slave ָҪɵһ; 

masters { 

192.168.1.1; 

}; ָһipַ 

Ǿͳһ׼named ļӦļ 

2.IPַļ

(1) 

/etc/namedb/zone.test


;	From: @(#)localhost.rev	5.1 (Berkeley) 6/30/90
; $FreeBSD: src/etc/namedb/PROTO.localhost.rev,v 1.6 2000/01/10 15:31:40 peter Exp $
;
; This file is automatically edited by the `make-localhost' script in
; the /etc/namedb directory.
;
@	IN	SOA	ns.test.com. root.test.com.(
				2005030116; Serial
				3600	; Refresh
				900	; Retry
				3600000	; Expire
				3600 )	; Minimum
	IN	NS	ns.test.com
;

ns		IN	A	192.168.0.1
www6	IN	AAAA	2001:250:f004::10
www	IN	A	192.168.0.2
 



ļǰ벿һЩĬϵĲãֻĳɶӦҪõУĲùȤԲصֲĵ 

ע⣬ 

IN NS ns.test.com; 

һУָ  

"."β 

ļĵڶ֣Уָ˸ϵ 

ns IN A 192.168.0.1 

ns ΪA ַΪIPV4ַ192.168.0.1 ʵipַһ¼ĺns.test.com ipַΪ 192.168.0.1 

www6 IN AAAA 2001:250:f004::10 

www6 ΪAAAAַΪIPV6ַ2001:250:f004::10 IPV6ַ¼ĺwww6.test.com ipַ2001:250:f004::10  

(2)IPַ 

ipv4  

/etc/namedb/zone.test.rev 


;	From: @(#)localhost.rev	5.1 (Berkeley) 6/30/90
; $FreeBSD: src/etc/namedb/PROTO.localhost.rev,v 1.6 2000/01/10 15:31:40 peter Exp $
;
; This file is automatically edited by the `make-localhost' script in
; the /etc/namedb directory.
;
@	IN	SOA	ns.test.com. root.test.com.(
				2005030116; Serial
				3600	; Refresh
				900	; Retry
				3600000	; Expire
				3600 )	; Minimum
	IN	NS	ns.test.com
;

1	IN	PTR		ns.test.com.
2	IN	PTR		www.test.com.
 



ipv6  

/etc/namedb/zone.test.rev 


;	From: @(#)localhost.rev	5.1 (Berkeley) 6/30/90
; $FreeBSD: src/etc/namedb/PROTO.localhost.rev,v 1.6 2000/01/10 15:31:40 peter Exp $
;
; This file is automatically edited by the `make-localhost' script in
; the /etc/namedb directory.
;
@	IN	SOA	ns.test.com. root.test.com.(
				2005030116; Serial
				3600	; Refresh
				900	; Retry
				3600000	; Expire
				3600 )	; Minimum
	IN	NS	ns.test.com
;

10.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0		IN	www6.test.com.
 



 

10.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 IN www6.test.com. 

ļ/etc/named.confе 

zone "4.0.0.f.0.5.2.0.1.0.0.2.IP6.ARPA" 

"10.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0" + "4.0.0.f.0.5.2.0.1.0.0.2" պɵֵ32λ16ipv6ַ 

ʵϣipַȱͳһĹصı׼ʹñȽϻңԿǲ÷ֻӣͲˡ 

.װʹõһЩ飺 

1.Ϣ 

named -g 

/usr/local/sbin/namedĬһ̨deamon ,-gѡʾǰ̨УϢӡ׼ǰװԽ׶Ƿǳаġ 

2.ͻnslookup 

windows linux ƽִ̨֧˵ 

nslookup״̬ʱipַͿѯ 

>www.test.com  

>192.168.0.1 IP 

>set type=AAAA òѯַΪIPv6ַ͡ 

>set type=A òѯַΪIPv4ַ͡ 

>exit ˳ 


οϣ 

[1]http://www.bind.com/ 

[2]http://www.isc.org/index.pl?/sw/bind/ 

[3]ipv6.bupt.edu.cn 
