zoukankan      html  css  js  c++  java
  • centos yum bind篇

    yum安装bind

    1. #yum update
    2. #yum -y install bind* caching-nameserver      
    3. # rpm -qa bind*
      bind-libs-9.2.4-30.el4_8.4
      bind-devel-9.2.4-30.el4_8.4
      bind-utils-9.2.4-30.el4_8.4
      bind-9.2.4-30.el4_8.4
      bind-chroot-9.2.4-30.el4_8.4     #查看BIND版本,我的是9.2.4的



    设定.conf

    #vi   /var/named/chroot/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 "test.com" IN {
            type master;
            file "test.com.zone";
            allow-update { none; };
    };

    zone "localhost" IN {
            type master;
            file "localhost.zone";
            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文件

    # cd /var/named/chroot/var/named/
    # cp -p localdomain.zone test.com.zone                #加-p参数能保持文件原来的属性
    # vi test.com.zone

    TTL    86400
    @               IN SOA test.com root (
                                            42              ; serial (d. adams)
                                            3H              ; refresh
                                            15M             ; retry
                                            1W              ; expiry
                                            1D )            ; minimum
                    IN NS           test.com
    www     IN A            192.168.84.112                          #把原来的localhost替换成你自己的域名,我这里是test.com,www是一条A记录,如果你有邮件,也可以加MX记录,保存退出。

    这样正向查询的记录就已建好,由于我是测试,没有去建反向查询的zone文件,原理是一样的。


    启动并将其加入系统自动服务列表。

    1. # service named start
    2. # chkconfig named on

    在我建好的时候,碰到这样的问题

    Rndc: Couldn't find server 'localhost': Name or service not known

    解决方法:

    1 修改/etc/rndc.conf
    options {

            default-key "rndc-key";

            default-server 127.0.0.1; #这里改成了IP地址,原来是localhost

            default-port 953;

    };

    2 在文件/etc/hosts 里加上

    127.0.0.1               localhost.localdomain localhost

    (责任编辑:admin)
    (责任编辑:admin)

  • 相关阅读:
    Notes for GGX paper
    vsix dll缺失问题
    c# 引用其他工程问题
    Springboot+Maven
    http 带cookie值的Post请求(关联测试)
    http 带cookie值的get请求(关联测试)
    DefaultHttpClient 获取cookie信息
    HttpClient+ ResourceBundle接口配置优化
    Cookie和Session的区别
    moco框架——重定向
  • 原文地址:https://www.cnblogs.com/zhouwenwu/p/2307566.html
Copyright © 2011-2022 走看看