当前位置: > Ubuntu >

Ubuntu 下架设DNS服务

时间:2014-12-16 18:12来源:linux.it.net.cn 作者:IT
1.安装
  $ sudo apt-get install bind9
  $ sudo apt-get install bind9-host dnsutils
  
2.配置
  编辑  /etc/bind/named.conf.options ,去掉 forwarders 的注释,并添加要转发的DNS
  forwarders {
      8.8.8.8;
      8.8.4.4;
      202.96.209.5;
      202.96.209.6;
      202.96.209.133;
      };
   allow-query-cache { any; }; //允许外网使用本服务器解析非本地域名
      
  编辑  /etc/bind/named.conf.options
      //正向区域
      zone "demo.com.cn"{
      type master;
      file "/etc/bind/db.demo.com.cn";
      };
      
  新建  /etc/bind/db.demo.com.cn
      ; db.demo.com.cn
      ;
      $TTL 604800
      @ IN SOA ns.demo.com.cn. root.demo.com.cn. (
           20120719  ; Serial
              28800  ; Refresh
              7200   ; Retry
            2419200  ; Expire
             604800 ); Negative Cache TTL;
      @ IN NS ns.demo.com.cn.
      @ IN A ???.???.???.???
      NS IN A ???.???.???.???
      mail IN A ???.???.???.???      
      @ IN MX 10 mail.demo.com.cn.
      @ IN TXT "v=spf1 a mx ~all"
      mail IN TXT "v=spf1 a mx ~all"
 
3.日志
  编辑  /etc/bind/named.conf ,添加下面信息
    logging {
              channel query_log {
                      file "QueryDNS.log" versions 5 size 20m;
                      severity info;
                      print-time yes;
                      print-category  yes;
              };
              category queries {
                      query_log;
              };
      };
 
  执行  ln -s /var/cache/bind/ /syslog.DNS
  打开  /syslog.DNS/ 可以看到日志文件了


(责任编辑:IT)
------分隔线----------------------------
栏目列表
推荐内容