DNS主从服务器的搭建

实验环境:OS: RHEL6

Master DNS: 10.167.27.193

                Slave  DNS: 10.167.27.91

一、Rpm

1、软件包的安装

rpm -ivh bind-9.3.
rpm -ivh bind-utils
rpm -ivh caching-nameserver

 

2、配置文件的修改

修改named.conf文件,添加域zhang.com的正向反向解析!

vi /etc/named.conf

zone "zhang.com" IN {

type master;

file "zhang.zone";

allow-update { none; };

allow-transfer { 10.167.27.91;};   ##这一行表示允许10.167.27.91复制,如果不做slave可以去掉!

notify yes;                    ###开启通告,有更新就会通告给从服务器

also-notify{ 10.167.27.91;};      

};

 

zone "27.167.10.in-addr.arpa" IN {

type master;

file "zhang.local";

allow-update { none; };

allow-transfer { 10.167.27.91;};   ##同上

notify yes;                    ###开启通告,有更新就会通告给从服务器

also-notify{ 10.167.27.91;};

};

 

3、   

(1)    cp /var/named/named.local  /var/named/chroot/var/named/zhang.local

(2)    cp /var/named/named.zone  /var/named/chroot/var/named/zhang.zone

(3)    chown named.named  /var/named/chroot/var/named/zhang.*

ln -s /var/named/chroot/var/named/zhang.zone  /var/named/zhang.zone

ln -s /var/named/chroot/var/named/zhang.local  /var/named/zhang.local

###后面两步步做也可以,知识为了以后更好更改!

 

4、  修改zhang.zone文件的内容:

   [root@localhost named]# vi /var/named/zhang.zone

$TTL    86400

@       IN      SOA     zhang.com. root.zhang.com.  (

1997022700 ; Serial

28800      ; Refresh

14400      ; Retry

3600000    ; Expire

86400 )    ; Minimum

@            IN      NS      zhang.com.

    

www       IN      A    10.167.27.91

   

5、  修改zhang.local文件的内容:

[root@localhost named]# vi /var/named/zhang.local

$TTL    86400

@       IN      SOA     zhang.com.  root.zhang.com.  (

                                      1997022700 ; Serial

                                      28800      ; Refresh

                                      14400      ; Retry

                                      3600000    ; Expire

                                      86400 )    ; Minimum

@             IN      NS      zhang.com.

 

91       IN      PTR     www.zhang.com.

 

6/etc/rc.d/init.d/named restart

 

7、测试

   [root@localhost named]# vi /etc/resolv.conf

nameserver 10.167.27.193

   service network restart

   host www.zhang.com

   nslookup www.zhang.com

 

 

二、Slave DNS的配置

zone "zhang.com" IN {

              type slave;

              file "slaves/zhang.zone";

              masters { 10.167.27.193; };   ##指定从服务器的地址

};

zone "27.167.10.in-addr.arpa" IN {

              type slave;

              file "slaves/zhang.local";

              masters { 10.167.27.193; };   ##同上!

};

 


你可能感兴趣的:(DNS主从服务器的搭建)