标签:dns
一、环境准备。
centos6.5 x64.
1、 yum -y install bind #安装DNS服务器
2、vim /etc/named.conf
options {
listen-on port 53 { any; }; #修改
//listen-on-v6 port 53 { ::1; }; #注释
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { any; }; # 修改
recursion yes;
#include "/etc/named.root.key"; #注释改行。
3、service named restart #启动服务
chkconfig --level 35 named on #开机启动。
4、 vim /etc/named.rfc1912.zones
zone "wspjing.com" IN {
type master;
file "wspjing.com.zone"; #创建该文件
};
zone "2.37.10.in-addr.arpa" IN {
type master;
file "10.37.2.zone"; #创建该文件
};
zone "leo.com" IN {
type master;
file "leo.com.zone"; #创建该文件
};
5、 vim /var/named/wspjing.com.zone
$TTL 86400
@ IN SOA dns.wspjing.com. root.wspjing.com. (
2011091200 ; serial #
3H ; refresh #
1H ; retry #
1W ; expire #
0) ; minimum #
@ IN NS dns.wspjing.com. # 主DNS
dns IN A 10.37.2.16
www IN A 10.37.2.16
leo IN A 10.37.2.12 #leo.域名wspjing.com. 等于二级域名。
6、 vim /var/named/leo.com.zone
$TTL 86400
@ IN SOA dns.wspjing.com. root.wspjing.com. (
2011091200 ; serial #
3H ; refresh #
1H ; retry #
1W ; expire #
0) ; minimum #
@ IN NS dns.wspjing.com.
www IN A 10.37.2.226 #两个域名指向一个IP地址。
www IN A 10.37.2.210
7、 vim /var/named/10.37.2.zone
$TTL 86400
@ IN SOA dns.wspjing.com. root.wspjing.com. (
2011091200 ; serial
3H ; refresh
1H ; retry
1W ; expire
0) ; minimum
@ IN NS dns.wspjing.com.
16.2.37.10.in-addr.arpa. IN PTR dns.wspjing.com. #不要忘记域名后面的.
16 IN PTR www.wspjing.com.
226.2.37.10.in-addr.arpa. IN PTR www.leo.com.
210 IN PTR www.leo.com.
8、 service named restart
Stopping named: [ OK ]
Starting named: [ OK ]
9、 nslookup
> dns.wspjing.com
Server: 10.37.2.16
Address: 10.37.2.16#53
Name: dns.wspjing.com
Address: 10.37.2.16
> 10.37.2.16
Server: 10.37.2.16
Address: 10.37.2.16#53
16.2.37.10.in-addr.arpa name = www.wspjing.com.
16.2.37.10.in-addr.arpa name = dns.wspjing.com.
> dns.wspjing.com
Server: 10.37.2.16
Address: 10.37.2.16#53
Name: dns.wspjing.com
Address: 10.37.2.16
> www.leo.com
Server: 10.37.2.16
Address: 10.37.2.16#53
Name: www.leo.com
Address: 10.37.2.226
Name: www.leo.com
Address: 10.37.2.210
> 10.37.2.226
Server: 10.37.2.16
Address: 10.37.2.16#53
226.2.37.10.in-addr.arpa name = www.leo.com.
> 10.37.2.210
Server: 10.37.2.16
Address: 10.37.2.16#53
210.2.37.10.in-addr.arpa name = www.leo.com.
>
本文出自 “飞天啸要” 博客,请务必保留此出处http://065432.blog.51cto.com/3079397/1723245
标签:dns
原文地址:http://065432.blog.51cto.com/3079397/1723245