隨筆-153  評(píng)論-235  文章-19  trackbacks-0
              想到局域網(wǎng)上建一個(gè)dns服務(wù)器,昨天晚上搞了好久都不成,包括今天也發(fā)了好多時(shí)間也不能通過(guò).最后找到

          水小筑之Blog

          http://blog.chinaunix.net/u/5302/showart_238337.html
          的博客, 幫了大忙,網(wǎng)上的很多文章都試過(guò)了都沒有很好的結(jié)果.

          我安裝的centos是單CD的服務(wù)版本.安裝后已經(jīng)有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";

              只要添加一個(gè)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/目錄里建個(gè)chenlb.com.zone(上面的file),內(nèi)容如下:
          $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.啟動(dòng)named
          # /etc/init.d/named start

          5.測(cè)試前添加nds服務(wù)地址
          # vi /etc/resolv.conf

          在加
          nameserver 192.168.0.60
          search chenlb.com
          說(shuō)明:192.168.0.60是我本機(jī)地址

          現(xiàn)在本機(jī)下可以ping  www.chenlb.com了

          要在加的機(jī)上可以使用DNS服務(wù),要在防火墻里允許

          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,現(xiàn)在在win里添加dns地址192.168.0.60就在ping  www.chenlb.com了. 呵呵


          posted on 2008-05-02 20:46 流浪汗 閱讀(1021) 評(píng)論(0)  編輯  收藏 所屬分類: Linux
          主站蜘蛛池模板: 厦门市| 乐平市| 从化市| 江永县| 涡阳县| 长春市| 江孜县| 定安县| 新晃| 昌邑市| 芦溪县| 新乡县| 汝州市| 乃东县| 比如县| 柳州市| 临邑县| 太仓市| 兴隆县| 凤翔县| 永安市| 崇礼县| 灵山县| 富裕县| 芒康县| 淳安县| 潞西市| 嘉善县| 浦北县| 陇南市| 湖北省| 大宁县| 巨野县| 璧山县| 图木舒克市| 左云县| 滦南县| 台州市| 霞浦县| 依兰县| 宁安市|