免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4232 | 回复: 7
打印 上一主题 下一主题

[DNS] 智能DNS启动报错!请网中人和高手帮忙指点! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-04-12 11:09 |只看该作者 |倒序浏览
各位高手,我希望建立一个智能dns服务器,当请求的源地址是10.0.0.167时将域名www.testsina.com解析为网通cnc的ip:202.108.33.73,当请求的源地址是其它时解析为电信ct的ip:218.30.108.185,现在遇到启动时报错的问题,具体配置文件内容如下:

bsdstudy# /usr/local/named/sbin/named -g -u bind -c /usr/local/named/etc/named.conf &
[1] 629
bsdstudy# 12-Apr-2010 10:24:16.357 starting BIND 9.6.2 -g -u bind -c /usr/local/named/etc/named.conf
12-Apr-2010 10:24:16.360 built with '--prefix=/usr/local/named' '--enable-threads' '--enable-largefile' '--enable-ipv6' '--with-openssl'
12-Apr-2010 10:24:16.360 found 1 CPU, using 1 worker thread
12-Apr-2010 10:24:16.385 using up to 4096 sockets
12-Apr-2010 10:24:16.415 loading configuration from '/usr/local/named/etc/named.conf'
12-Apr-2010 10:24:16.420 max open files (357 is smaller than max sockets (4096)
12-Apr-2010 10:24:16.424 using default UDP/IPv4 port range: [49152, 65535]
12-Apr-2010 10:24:16.426 using default UDP/IPv6 port range: [49152, 65535]
12-Apr-2010 10:24:16.433 listening on IPv4 interface lnc0, 10.0.0.55#53
12-Apr-2010 10:24:16.451 listening on IPv4 interface lo0, 127.0.0.1#53
12-Apr-2010 10:24:16.548 automatic empty zone: view view_cnc: 0.IN-ADDR.ARPA
12-Apr-2010 10:24:16.549 automatic empty zone: view view_cnc: 127.IN-ADDR.ARPA
12-Apr-2010 10:24:16.550 automatic empty zone: view view_cnc: 254.169.IN-ADDR.ARPA
12-Apr-2010 10:24:16.550 automatic empty zone: view view_cnc: 2.0.192.IN-ADDR.ARPA
12-Apr-2010 10:24:16.550 automatic empty zone: view view_cnc: 255.255.255.255.IN-ADDR.ARPA
12-Apr-2010 10:24:16.550 automatic empty zone: view view_cnc: 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.0.IP6.ARPA
12-Apr-2010 10:24:16.550 automatic empty zone: view view_cnc: 1.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
12-Apr-2010 10:24:16.550 automatic empty zone: view view_cnc: D.F.IP6.ARPA
12-Apr-2010 10:24:16.550 automatic empty zone: view view_cnc: 8.E.F.IP6.ARPA
12-Apr-2010 10:24:16.551 automatic empty zone: view view_cnc: 9.E.F.IP6.ARPA
12-Apr-2010 10:24:16.551 automatic empty zone: view view_cnc: A.E.F.IP6.ARPA
12-Apr-2010 10:24:16.551 automatic empty zone: view view_cnc: B.E.F.IP6.ARPA
12-Apr-2010 10:24:16.603 automatic empty zone: view view_ct: 0.IN-ADDR.ARPA
12-Apr-2010 10:24:16.604 automatic empty zone: view view_ct: 127.IN-ADDR.ARPA
12-Apr-2010 10:24:16.604 automatic empty zone: view view_ct: 254.169.IN-ADDR.ARPA
12-Apr-2010 10:24:16.606 automatic empty zone: view view_ct: 2.0.192.IN-ADDR.ARPA
12-Apr-2010 10:24:16.607 automatic empty zone: view view_ct: 255.255.255.255.IN-ADDR.ARPA
12-Apr-2010 10:24:16.608 automatic empty zone: view view_ct: 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.0.IP6.ARPA
12-Apr-2010 10:24:16.610 automatic empty zone: view view_ct: 1.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
12-Apr-2010 10:24:16.612 automatic empty zone: view view_ct: D.F.IP6.ARPA
12-Apr-2010 10:24:16.613 automatic empty zone: view view_ct: 8.E.F.IP6.ARPA
12-Apr-2010 10:24:16.614 automatic empty zone: view view_ct: 9.E.F.IP6.ARPA
12-Apr-2010 10:24:16.615 automatic empty zone: view view_ct: A.E.F.IP6.ARPA
12-Apr-2010 10:24:16.617 automatic empty zone: view view_ct: B.E.F.IP6.ARPA
12-Apr-2010 10:24:16.669 command channel listening on 127.0.0.1#953
12-Apr-2010 10:24:16.671 ignoring config file logging statement due to -g option
12-Apr-2010 10:24:16.679 dns_master_load: named.127.0.0:1: unknown $ directive '$'
12-Apr-2010 10:24:16.681 zone 0.0.127.IN-ADDR.ARPA/IN/view_cnc: loading from master file named.127.0.0 failed: syntax error
12-Apr-2010 10:24:16.682 zone 0.0.127.IN-ADDR.ARPA/IN/view_cnc: not loaded due to errors.
12-Apr-2010 10:24:16.695 dns_rdata_fromtext: testsina.db.cnc:7: near eol: unexpected end of input
12-Apr-2010 10:24:16.696 zone testsina.com/IN/view_cnc: loading from master file testsina.db.cnc failed: unexpected end of input
12-Apr-2010 10:24:16.697 zone testsina.com/IN/view_cnc: not loaded due to errors.
12-Apr-2010 10:24:16.702 zone localhost/IN/view_cnc: loaded serial 42
12-Apr-2010 10:24:16.707 dns_master_load: named.127.0.0:1: unknown $ directive '$'
12-Apr-2010 10:24:16.709 zone 0.0.127.IN-ADDR.ARPA/IN/view_ct: loading from master file named.127.0.0 failed: syntax error
12-Apr-2010 10:24:16.711 zone 0.0.127.IN-ADDR.ARPA/IN/view_ct: not loaded due to errors.
12-Apr-2010 10:24:16.724 dns_rdata_fromtext: testsina.db.ct:7: near eol: unexpected end of input
12-Apr-2010 10:24:16.724 zone testsina.com/IN/view_ct: loading from master file testsina.db.ct failed: unexpected end of input
12-Apr-2010 10:24:16.726 zone testsina.com/IN/view_ct: not loaded due to errors.
12-Apr-2010 10:24:16.732 zone localhost/IN/view_ct: loaded serial 42
12-Apr-2010 10:24:16.740 running

bsdstudy# more named.conf
key "rndc-key" {
        algorithm hmac-md5;
        secret "ISXjGelm+UYxtBHDuMV5XA==";
};

controls {
        inet 127.0.0.1 port 953
                allow { 127.0.0.1; } keys { "rndc-key"; };
};
acl"my-lan"{
     127.0.0/8;10.0.0.0/24;
};
options{
     directory "/usr/local/named/etc";
  pid-file "/usr/local/named/var/run/named/named.pid";
version "No Status";
allow-recursion {"my-lan";};
};
acl "CNC"{
10.0.0.167;
};
view "view_cnc"{
match-clients{CNC;};
zone "testsina.com" in{
    type master;
    file "testsina.db.cnc";
    };
  zone "." in{
  type hint;
  file "named.root";
};
zone "localhost" in{
  type master;
  file "localhost.zone";
};
zone "0.0.127.IN-ADDR.ARPA" in{
  type master;
  file "named.127.0.0";
};
};
view "view_ct"{
match-clients{any;};
zone "testsina.com" in{
    type master;
    file "testsina.db.ct";
    };
  zone "." in{
  type hint;
  file "named.root";
};
zone "localhost" in{
  type master;
  file "localhost.zone";
};
zone "0.0.127.IN-ADDR.ARPA" in{
  type master;
  file "named.127.0.0";
};
};
logging{
    channel warning{
     file "/var/log/named/dns_warnings" ;
     severity warning;
     };
      channel general_dns{
     file "/var/log/named/dns_logs" ;
     severity info;
     };
};

bsdstudy# more testsina.db.cnc
$TTL 3600
@   IN  SOA   testsina.com.(
        2010040801 ;Serial
        3600  ;Refresh
        300  ;Retry
        3600000  ;Expire
        3600 ) ;Minimum
IN   NS  localhost.
www   IN   A   202.108.33.73



bsdstudy# more testsina.db.ct
$TTL 3600
@   IN  SOA   testsina.com.(
        2010040801 ; Serial
        3600  ;  Refresh
        300  ;  Retry
        3600000  ; Expire
        3600 ) ; Minimum
IN   NS  localhost.
www   IN   A   218.30.108.185



bsdstudy# more localhost.zone
$TTL 86400
$ORIGIN localhost.
@ 1D  IN  SOA  @  root(
      42  ;serial(d.adams)
      3H  ;refresh
      15M ;retry
      1W  ;expiry
      1D) ;minimum
  1D  IN  NS @
  1D  IN  A 127.0.0.1



bsdstudy# more named.127.0.0
$ TTL 86400
@  IN  SOA  localhost.  root.localhost.(
       1997022700  ;Serial
       28800       ;Refresh
       14400       ;Retry
       3600000     ;Expire
       86400)      ;Minimum
    IN   NS   localhost.
1   IN   PTR  localhost.

论坛徽章:
8
综合交流区版块每周发帖之星
日期:2015-12-02 15:03:53数据库技术版块每日发帖之星
日期:2015-10-02 06:20:00IT运维版块每日发帖之星
日期:2015-10-02 06:20:00IT运维版块每日发帖之星
日期:2015-09-14 06:20:00金牛座
日期:2014-10-10 11:23:34CU十二周年纪念徽章
日期:2013-10-24 15:41:34酉鸡
日期:2013-10-19 10:17:1315-16赛季CBA联赛之北京
日期:2017-03-06 15:12:44
2 [报告]
发表于 2010-04-12 16:54 |只看该作者
12-Apr-2010 10:24:16.679 dns_master_load: named.127.0.0:1: unknown $ directive '$'
12-Apr-2010 10:24:16.681 zone 0.0.127.IN-ADDR.ARPA/IN/view_cnc: loading from master file named.127.0.0 failed: syntax error

论坛徽章:
0
3 [报告]
发表于 2010-04-13 09:10 |只看该作者
非常感谢版主ruochen!我也发现报错的信息了,但不知道怎么解决,还请不吝指点!

论坛徽章:
0
4 [报告]
发表于 2010-04-13 16:54 |只看该作者
好好检查ZONE文件。问题就在那里!

论坛徽章:
0
5 [报告]
发表于 2010-04-14 11:14 |只看该作者
修正了部分错误,named.127.0.0的报错没有了,但以下报错还存在:
14-Apr-2010 11:02:03.977 dns_rdata_fromtext: testsina.db.cnc:7: near eol: unexpected end of input
14-Apr-2010 11:02:03.979 zone testsina.com/IN/view_cnc: loading from master file testsina.db.cnc failed: unexpected end of input
14-Apr-2010 11:02:03.980 zone testsina.com/IN/view_cnc: not loaded due to errors.
从以上信息看,是testsina.db.cnc的第7行出了问题,第7行是 3600) ;Minimum  没发现什么问题啊,这个"near eol: unexpected end of input "不知道是什么意思,
所以,还要请各位高手帮忙看看,多谢!


bsdstudy# more testsina.db.cnc
$TTL 3600
@   IN  SOA   testsina.com.(
        2010040801 ;Serial
        3600  ;Refresh
        300  ;Retry
        3600000  ;Expire
        3600) ;Minimum
IN   NS  localhost.
www   IN   A   202.108.33.73


14-Apr-2010 11:02:03.953 ignoring config file logging statement due to -g option
14-Apr-2010 11:02:03.964 zone 0.0.127.IN-ADDR.ARPA/IN/view_cnc: loaded serial 1997022700
14-Apr-2010 11:02:03.977 dns_rdata_fromtext: testsina.db.cnc:7: near eol: unexpected end of input
14-Apr-2010 11:02:03.979 zone testsina.com/IN/view_cnc: loading from master file testsina.db.cnc failed: unexpected end of input
14-Apr-2010 11:02:03.980 zone testsina.com/IN/view_cnc: not loaded due to errors.
14-Apr-2010 11:02:03.984 zone localhost/IN/view_cnc: loaded serial 42
14-Apr-2010 11:02:03.990 zone 0.0.127.IN-ADDR.ARPA/IN/view_ct: loaded serial 1997022700
14-Apr-2010 11:02:04.002 dns_rdata_fromtext: testsina.db.ct:7: near eol: unexpected end of input
14-Apr-2010 11:02:04.004 zone testsina.com/IN/view_ct: loading from master file testsina.db.ct failed: unexpected end of input
14-Apr-2010 11:02:04.005 zone testsina.com/IN/view_ct: not loaded due to errors.
14-Apr-2010 11:02:04.010 zone localhost/IN/view_ct: loaded serial 42
14-Apr-2010 11:02:04.029 running

论坛徽章:
0
6 [报告]
发表于 2010-04-15 17:24 |只看该作者
问题已经解决了!就是语句的错误! 多谢各位!

论坛徽章:
0
7 [报告]
发表于 2010-04-15 21:09 |只看该作者
语句的错误,学到了很多东西

论坛徽章:
0
8 [报告]
发表于 2010-04-17 12:26 |只看该作者
bind配置中,经常遇到这类的问题,不过一般仔细查看下日志,都能找到问题
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP