隨筆-153  評論-235  文章-19  trackbacks-0
              想到局域網上建一個dns服務器,昨天晚上搞了好久都不成,包括今天也發了好多時間也不能通過.最后找到

          水小筑之Blog

          http://blog.chinaunix.net/u/5302/showart_238337.html
          的博客, 幫了大忙,網上的很多文章都試過了都沒有很好的結果.

          我安裝的centos是單CD的服務版本.安裝后已經有bind了

          1.配置文件在/etc/named.conf
          //
          // named.conf for Red Hat caching-nameserver 
          //

          options {
              directory 
          "/var/named";
              dump
          -file "/var/named/data/cache_dump.db";
                  statistics
          -file "/var/named/data/named_stats.txt";
              
          /*
               
          * If there is a firewall between you and nameservers you want
               
          * to talk to, you might need to uncomment the query-source
               
          * directive below.  Previous versions of BIND always asked
               
          * questions using port 53, but BIND 8.1 uses an unprivileged
               
          * port by default.
               
          */
               
          // query-source address * port 53;
          };

          // 
          // a caching only nameserver config
          // 
          controls {
              inet 
          127.0.0.1 allow { localhost; } keys { rndckey; };
          };

          zone 
          "." IN {
              type hint;
              file 
          "named.ca";
          };

          zone 
          "localdomain" IN {
              type master;
              file 
          "localdomain.zone";
              allow
          -update { none; };
          };

          zone 
          "localhost" IN {
              type master;
              file 
          "localhost.zone";
              allow
          -update { none; };
          };

          zone 
          "chenlb.com" IN {
              type master;
              file 
          "chenlb.com.zone";
              allow
          -query { any; };
              allow
          -transfer { any; };
              allow
          -update { none; };
          };

          zone 
          "0.0.127.in-addr.arpa" IN {
              type master;
              file 
          "named.local";
              allow
          -update { none; };
          };

          zone 
          "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
                  type master;
              file 
          "named.ip6.local";
              allow
          -update { none; };
          };

          zone 
          "255.in-addr.arpa" IN {
              type master;
              file 
          "named.broadcast";
              allow
          -update { none; };
          };

          zone 
          "0.in-addr.arpa" IN {
              type master;
              file 
          "named.zero";
              allow
          -update { none; };
          };

          include 
          "/etc/rndc.key";

              只要添加一個zone就行,看上面
          zone "chenlb.com" IN {
              type master;
              file 
          "chenlb.com.zone";
              allow
          -query { any; };
              allow
          -transfer { any; };
              allow
          -update { none; };
          };

          2.在/var/named/chroot/var/named/目錄里建個chenlb.com.zone(上面的file),內容如下:
          $TTL    86400
          @       IN      SOA    chenlb.com.  root.chenlb.com.(
                                                
          2008050201 ; Serial
                                                
          28800      ; Refresh
                                                
          14400      ; Retry
                                                
          3600000    ; Expire
                                                
          86400 )    ; Minimum
                  IN NS    chenlb.com.
                  IN MX 
          10 mail.chenlb.com.
          @       IN A     
          192.168.0.60
          www     IN A     
          192.168.0.60
          ftp     IN A     
          192.168.0.60
          mail    IN A     
          192.168.0.60

          3.在/var/named目錄下建鏈接
          # ch /var/named
          #
           ln -s /var/named/chroot/var/named/chenlb.com.zone chenlb.com.zone

          4.啟動named
          # /etc/init.d/named start

          5.測試前添加nds服務地址
          # vi /etc/resolv.conf

          在加
          nameserver 192.168.0.60
          search chenlb.com
          說明:192.168.0.60是我本機地址

          現在本機下可以ping  www.chenlb.com了

          要在加的機上可以使用DNS服務,要在防火墻里允許

          6.修改/etc/sysconfig/iptables添加下面的
          -A RH-Firewall-1-INPUT -p udp -m udp --dport 53 -j ACCEPT
          -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 53 -j ACCEPT

              OK,現在在win里添加dns地址192.168.0.60就在ping  www.chenlb.com了. 呵呵


          posted on 2008-05-02 20:46 流浪汗 閱讀(1020) 評論(0)  編輯  收藏 所屬分類: Linux
          主站蜘蛛池模板: 阆中市| 依安县| 喀喇沁旗| 汉中市| 内丘县| 林芝县| 凭祥市| 福贡县| 楚雄市| 舒城县| 大足县| 雅安市| 高邑县| 富裕县| 丹阳市| 北票市| 扶余县| 顺平县| 屯门区| 贵州省| 海丰县| 大理市| 宜阳县| 瓦房店市| 桃园县| 双流县| 灌云县| 五家渠市| 法库县| 台南县| 无为县| 南郑县| 九台市| 方城县| 巩留县| 兰溪市| 鄄城县| 九江市| 淮阳县| 湖口县| 东明县|