| 
	Ubuntu.Install.DNS.Server 
	bind: DNS服务器软件 
	port: 53 
	01.安装bind9 (DNS) 
	ubunru@Monitoring:~$ sudo apt-get install bind9c  #主程序 
	ubunru@Monitoring:~$ sudo apt-get install bind9-doc  #文档 
	02.服务启用 
	ubunru@Monitoring:~$ /usr/sbin/named -v   #查看版本 
	BIND 9.8.1-P1 
	ubunru@Monitoring:~$ sudo /etc/init.d/bind9 restart  #重启服务 
	ubunru@Monitoring:~$ sudo netstat -tunlp |grep 53    #查看服务端口 
	ubunru@Monitoring:~$ tail /var/log/syslog     #查看启动bind服务日志 
	03. 修改全局配置文件 
	ubunru@Monitoring:~$ sudo vim /etc/bind/named.conf.options #全局配置 
	  forwarders { 
	                202.96.128.166; 
	         }; 
	//注: 转发地址修改为广东电信DNS IP;  
	04.添加正向域与反向域 
	ubunru@Monitoring:~$ sudo vim /etc/bind/named.conf.default-zones  
	//正向域 
	zone "laizeping.cn" { 
	        type master; 
	        file "/etc/bind/db.laizeping.cn.zone"; 
	}; 
	//反向域 
	zone "0.168.192.in-addr.arpa" { 
	        type master; 
	        file "/etc/bind/db.192.168.0.arpa"; 
	}; 
	05.正向区域文件 
	ubunru@Monitoring:~$ sudo vim /etc/bind/db.laizeping.cn.zone  
	$TTL    604800 
	@       IN      SOA     laizeping.cn. root.laizeping.cn. ( 
	                              2         ; Serial 
	                         604800         ; Refresh 
	                          86400         ; Retry 
	                        2419200         ; Expire 
	                         604800 )       ; Negative Cache TTL 
	; 
	@       IN      NS      laizeping.cn. 
	@       IN      A       192.168.0.103 
	aping   IN      A       192.168.0.28 
	*       IN      A       192.168.0.103 
	06.反向区域文件 
	ubunru@Monitoring:~$ sudo vim /etc/bind/db.192.168.0.arpa #反向域配置文件 
	@       IN      SOA     laizeping.cn. root.laizeping.cn. ( 
	                              1         ; Serial 
	                         604800         ; Refresh 
	                          86400         ; Retry 
	                        2419200         ; Expire 
	                         604800 )       ; Negative Cache TTL 
	; 
	@       IN      NS      laizeping.cn. 
	103     IN      PTR     www.laizeping.cn. 
	28      IN      PTR     aping.laizeping.cn. 
	07.重启服务 
	ubunru@Monitoring:~$ sudo /etc/init.d/bind9 restart   
	08.客户端DNS地址为DNS服务器地址: 192.168.0.103 
	aping@SL400:~$ sudo vim /etc/resolv.conf  #添加dns 
	    nameserver 192.168.0.103 
	09.域名解释: 
	aping@SL400:~$  host aping.laizeping.cn   #正向解释 
	aping.laizeping.cn has address 192.168.0.28 
	aping@SL400:~$ host www.laizeping.cn         #正向解释 
	www.laizeping.cn has address 192.168.0.103 
	aping@SL400:~$ host www.laizeping.cn         #正向解释(随便一个主机头,全部解释到103这个地址) 
	www.laizeping.cn has address 192.168.0.103 
	aping@SL400:~$ host 192.168.0.28  #反向解释 
	28.0.168.192.in-addr.arpa domain name pointer aping.laizeping.cn. 
	aping@SL400:~$ host 192.168.0.103        #反向解释 
	103.0.168.192.in-addr.arpa domain name pointer www.laizeping.cn. 
	aping@SL400:~$ host 192.168.0.104        #反向解释(反向文件中,没这个记录) 
	Host 104.0.168.192.in-addr.arpa. not found: 3(NXDOMAIN) 
	aping@SL400:~$ nslookup apinglai.laizeping.cn #解释成功 
	Server:        192.168.0.103 
	Address:    192.168.0.103#53 
	Name:    apinglai.laizeping.cn 
	Address: 192.168.0.103 
	10.使用dig工具解释: 
	itnetcn@SL400:~$ dig -t any @192.168.0.103 aping.laizeping.cn  #dig工具 正解  
	; <<>> DiG 9.8.1-P1 <<>> -t any @192.168.0.103 aping.laizeping.cn 
	; (1 server found) 
	;; global options: +cmd 
	;; Got answer: 
	;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48253 
	;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1 
	;; QUESTION SECTION: 
	;aping.laizeping.cn.        IN    ANY 
	;; ANSWER SECTION: 
	aping.laizeping.cn.    604800    IN    A    192.168.0.28 
	;; AUTHORITY SECTION: 
	laizeping.cn.        604800    IN    NS    laizeping.cn. 
	;; ADDITIONAL SECTION: 
	laizeping.cn.        604800    IN    A    192.168.0.103 
	;; Query time: 9 msec 
	;; SERVER: 192.168.0.103#53(192.168.0.103) 
	;; WHEN: Fri Mar 29 00:56:33 2013 
	;; MSG SIZE  rcvd: 82 
	itnetcn@SL400:~$ dig -t any @192.168.0.103 -x 192.168.0.28  #dig工具 反解 
	; <<>> DiG 9.8.1-P1 <<>> -t any @192.168.0.103 -x 192.168.0.28 
	; (1 server found) 
	;; global options: +cmd 
	;; Got answer: 
	;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5179 
	;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1 
	;; QUESTION SECTION: 
	;28.0.168.192.in-addr.arpa.    IN    ANY 
	;; ANSWER SECTION: 
	28.0.168.192.in-addr.arpa. 604800 IN    PTR    aping.laizeping.cn. 
	;; AUTHORITY SECTION: 
	0.168.192.in-addr.arpa.    604800    IN    NS    laizeping.cn. 
	;; ADDITIONAL SECTION: 
	laizeping.cn.        604800    IN    A    192.168.0.103 
	;; Query time: 1 msec 
	;; SERVER: 192.168.0.103#53(192.168.0.103) 
	;; WHEN: Fri Mar 29 00:59:05 2013 
	;; MSG SIZE  rcvd: 105 | 
