DNS服務器搭建

1、環境準備。vim

      centos6.5 x64.centos


一、 yum -y install bind     #安裝DNS服務器

二、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";                      #註釋改行。

三、service named restart                      #啓動服務
    chkconfig --level 35 named on             #開機啓動。
    
四、 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";          #建立該文件
};


五、 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. 等於二級域名。


六、  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



七、 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.

八、 service named restart
Stopping named:                                            [  OK  ]
Starting named:                                            [  OK  ]

九、   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.
>



 

服務器

相關文章
相關標籤/搜索