zoukankan      html  css  js  c++  java
  • [原创]CentOS实现智能DNS

    一、       环境:

    Centos-6.6-x64位操作系统,IP地址:210.38.248.7

    二、       安装和配置bind服务:

      1.      命令:yum install bind

      2.      配置:

    1)  配置/etc/named.conf文件:

    acl ip1{

            210.38.240.0/24;              //定义240网段

    };

    acl ip2{

            210.38.248.0/24;              //定义248网段

    };

    options {

            directory       "/var/named";              //服务安装目录

            recursion yes;            //是否开启DNS递归

    };

    view "first"{

            match-clients {ip1;};   //匹配240网段

            recursion yes;

            zone "." IN {

                    type hint;

                    file "named.ca";

            };

            zone "a.org" IN {

                    type master;

                    file "a.org.first";

            };

    zone "1.168.192.in-addr.arpa" IN {

                    type master;

                    file "1.168.192";

            };

    };

    view "second"{

            match-clients {ip2;};         //匹配248网段

                    recursion no;

            zone "." IN {

                    type hint;

                    file "named.ca";

            };

            zone "a.org" IN {

                    type master;

                    file "a.org.second";

            };

    zone "5.168.192.in-addr.arpa" IN {

                    type master;

                    file "5.168.192";

            };

    };

    2)  建立a.org.firsta.org.second文件并配置:

    ->创建: touch a.org.first

                        Touch a.org.second

    ->配置:

    配置a.org.first如下:

    $TTL 1200

    $ORIGIN a.org.

    @       IN      SOA     ns1.a.org.      admin.a.org.(

                                            2014091301

                                            6H

                                            30M

                                            15D

                                            3D)

            IN      NS      ns1.a.org.

            IN      NS      ns2.a.org.

            IN      MX 10   mail.a.org.

    ns1     IN      A       192.168.1.5

    ns2     IN      A       192.168.1.6

    mail    IN      A       192.168.1.7

    www     IN      A       192.168.1.8

    配置a.org.second如下:

    $TTL 1200

    $ORIGIN a.org.

    @       IN      SOA     ns1.a.org.      admin.a.org.(

                                            2014091301

                                            6H

                                            30M

                                            15D

                                            3D)

            IN      NS      ns1.a.org.

            IN      NS      ns2.a.org.

            IN      MX 10   mail.a.org.

    ns1     IN      A       192.168.5.5

    ns2     IN      A       192.168.5.6

    mail    IN      A       192.168.5.7

    www     IN      A       192.168.5.8

    配置1.168.192如下:

    $TTL 86400

    @          IN     SOA  ns1.a.org.         admin.a.org.(

                                            2014091301

                                            6H

                                            30M

                                            15D

                                            3D)

                  IN     NS              ns1.a.org.

                  IN     PTR  a.org.

    5            IN     PTR  ns1.a.org.

    6            IN     PTR  ns2.a.org.

    7            IN     PTR  mail.a.org.

    8            IN     PTR  www.a.org

    配置5.168.192如下:

    $TTL 86400

    @          IN     SOA  ns1.a.org.         admin.a.org.(

                                            2014091301

                                            6H

                                            30M

                                            15D

                                            3D)

                  IN     NS              ns1.a.org.

                  IN     PTR  a.org.

    5            IN     PTR  ns1.a.org.

    6            IN     PTR  ns2.a.org.

    7            IN     PTR  mail.a.org.

    8            IN     PTR  www.a.org

                               ->拷贝文件到/var/named目录:

                                         #cp a.org.* /var/named

                                         #cp 1.168.192 /var/named

                                         #cp 5.168.192 /var/named

    3.      重启:service named restart

    三、测试:分别在240/248网段的电脑终端上使用命令:nslookup ns1.a.org(域名)测试,查看解析的IP地址。

  • 相关阅读:
    window 7系统环境同时安装window xp系统,形成双系统
    工作感悟
    数据湖框架选型很纠结?一文了解Apache Hudi核心优势
    mysql数据库设计-规则
    maven中多个子模块的构建顺序
    EXTJS3.0 表单元素TextField datefield 设置只读并改背景颜色为灰色
    MySQL5.7的账号回收权限
    哲学王子-复旦博导王德峰教授:阅读与哲学思考
    abseil 的 cmake 方式编译
    [javascript] ie下audio不支持一些媒体类型
  • 原文地址:https://www.cnblogs.com/wsjhk/p/4589433.html
Copyright © 2011-2022 走看看