步骤:
 1.安装软件
 2.配置缓存DNS服务
 3.配置主DNS
 4.配置辅DNS
实践:
 1.安装软件
  相关软件包bind bind-utils bind-chroot caching-nameserver
  #yum install bind bind-utils bind-chroot caching-nameserver

 2.配置缓存DNS服务
  #cd /var/name/chroot/etc
  #mv mv named.caching-nameserver.conf named.conf
  修改配置/var/name/chroot/etc/name.conf
   (1)listen-on port 53 { any; };   任意机器都监听53端口
   (2)allow-query     { any; };         允许的机器
        allow-query-cache { any; };   允许缓存
    (3)match-clients      { any; };
        recursion yes;           递归
         forward first;             进行转发,先转发到222.246.129.80上
         forwarders { 222.246.129.80;};
 3.配置主DNS
    (1)修改配置/var/name/chroot/etc/name.conf
  #include "/etc/named.rfc1912.zones";----> include "/etc/named.zones"  创建DNS域配置文件

    (2)修改主域配置文件
  #cd /var/named/chroot/etc
  #mv named.rfc1912.zones named.zones
  #vi named.zones
  追加
   zone "ds.com" IN {
          type master;
          file "ds.com.zone";                       定义正向解析文件
          allow-update { none; };
   };

   zone "137.168.192.in-addr.arpa" IN {
          type master;
          file "192.168.137.zone";    定义反向解析文件
          allow-update { none; };
   };

    (3)配置解析文件
  #cd /var/namd/chroot/var/named
  配置正向解析文件
  #cp -pv localhost.zone ds.com.zone          复制已有的模版进行修改
  #vi ds.com.zone

   $TTL    86400
  @       IN      SOA     ns1.ds.com. root.ds.com.  (
                                       1997022700 ; Serial
                                       28800      ; Refresh
                                       14400      ; Retry
                                       3600000    ; Expire
                                       86400 )    ; Minimum
          IN      NS      ns1.ds.com.
          IN      MX 10   mail.ds.com.


  ns1     IN      A       192.168.137.2
  mail    IN      A       192.168.137.2

  配置正向解析文件
  #cp -pv ds.com.zone 192.168.137.zone
  #vi 192.168.137.zone
   $TTL    86400
  @       IN      SOA     ns1.ds.com. root.ds.com.  (
                                       1997022700 ; Serial
                                       28800      ; Refresh
                                       14400      ; Retry
                                       3600000    ; Expire
                                       86400 )    ; Minimum
           IN      NS      ns1.ds.com.
          IN      MX 10   mail.ds.com.


   2       IN      PTR     ns1.ds.com.
   2       IN      PTR     mail.ds.com.
   (4)重启服务测试
      #/etc/init.d/named restart
      修改客户端服务器DNS为配置的DNS主机地址
      #nslookup
      >set type=mx
      >ds.com             测试正向解析
      #set type=ptr
      >192.168.137.2
 4.配置辅DNS
  (1)主DNS上的配置

  修改/var/named/chroot/etc/named.zone

   zone "ds.com" IN {
           type master;
           file "ds.com.zone";
           allow-update { none; };
           allow-transfer { 192.168.137.3; };         允许与辅DNS传输
   };

   zone "137.168.192.in-addr.arpa" IN {
          type master;
          file "192.168.137.zone";
          allow-update { none; };
          allow-transfer { 192.168.137.3; };
   };
  修改/var/named/chroot/var/named/ds.com.zone
   $TTL    86400
  @       IN      SOA     ns1.ds.com. root.ds.com.  (
                                       1997022700 ; Serial
                                       28800      ; Refresh
                                       14400      ; Retry
                                       3600000    ; Expire
                                       86400 )    ; Minimum
          IN      NS      ns1.ds.com.
   IN      NS      ns2.ds.com.
          IN      MX 10   mail.ds.com.


  ns1     IN      A       192.168.137.2
  ns2     IN      A       192.168.137.3
  mail    IN      A       192.168.137.2
  修改/var/named/chroot/var/named/192.168.137.zone
   $TTL    86400
  @       IN      SOA     ns1.ds.com. root.ds.com.  (
                                       1997022700 ; Serial
                                       28800      ; Refresh
                                       14400      ; Retry
                                       3600000    ; Expire
                                       86400 )    ; Minimum
           IN      NS      ns1.ds.com.
   IN      NS      ns2.ds.com.
          IN      MX 10   mail.ds.com.


   2       IN      PTR     ns1.ds.com.
   3       IN      PTR     ns2.ds.com.
   2       IN      PTR     mail.ds.com.

 (2)辅DNS配置
  修改/var/named/chroot/etc/named.conf
   (1)listen-on port 53 { any; };   任意机器都监听53端口
   (2)allow-query     { any; };         允许的机器
        allow-query-cache { any; };   允许缓存
    (3)match-clients      { any; };
        recursion yes; 
  修改/var/named/chroot/etc/named.zone
   zone "ds.com" IN {
           type salve;
           file "salves/ds.com.zone";
           allow-update { none; };
   };

   zone "137.168.192.in-addr.arpa" IN {
          type salve;
          file "salves/192.168.137.zone";
          allow-update { none; };
   };
 (3)启动dns服务查看/var/named/chroot/var/named/slaves文件下是否有ds.com.zone和192.168.137.zone两个配置文件

 5.同步解析文件
  修改主DNS解析文件下“1997022700 ; Serial”的值每次增加1重启主dns服务