linux系统中的DNS服务器介绍及配置实例详解

http://lq2419.blog.51cto.com/1365130/1172269

http://lq2419.blog.51cto.com/1365130/1172273

http://lq2419.blog.51cto.com/1365130/1172319

编辑# vim /etc/named.conf配置文件,添加如下内容: 
 
options { 
    directory  "/var/named" ; 
}; 
 
zone "." IN { 
    type hint; 
    file "named.root"; 
}; 
 
zone "localhost" IN { 
    type master;     #指定主服务器 
    file "localhost.zone"; 
};  
zone "myinfratest.com" IN {     
		type master; 
		file "infra.com.zone"; 
};
zone "2.168.192.in-addr.arpa" IN {   #反向区域名 
     type master; 
     file "192.168.2.zone";         #保存的区域数据文件 
};


/var/named/infra.com.zone的内容

$TTL 600     
myinfratest.com.    IN    SOA       ns1.myinfratest.com.      admin.myinfratest.com. (  
                               2013040101  
                               1H  
                               5M  
                               2D  
                               6H )  
               IN    NS         ns1               
               IN    MX  10     mail              
ns1            IN    A         192.168.2.4  
mail           IN    A         192.168.2.4  
www            IN    A         192.168.2.4  
www            IN    A         192.168.2.6 
ftp            IN    CNAME      www 

使用该命令请求解析www.myinfratest.com这台主机 dig -t A www.myinfratest.com @192.168.2.4
host 和 nslookup命令也可以查看
/var/named/192.168.2.zone的内容

$TTL 600 
2.168.192.in-addr.arpa.              IN    SOA       ns1.myinfratest.com.      admin.myinfratest.com. ( 
                               2013040101 
                               1H 
                               5M 
                               2D 
                               6H ) 
               IN    NS         ns1.myinfratest.com. 
4            IN    PTR       ns1.myinfratest.com. 
4             IN    PTR      mail.myinfratest.com. 
4             IN    PTR      www.myinfratest.com. 
6             IN    PTR      www.myinfratest.com.

通过dig命令反向查询 dig -t PTR 192.168.2.6 @192.168.2.4


你可能感兴趣的:(linux,dns)