• 主与从域名解析服务器的正反解析配置


    主服务器(Centos 7 192.168.100.175)

    1、构建yum仓库,用yum安装bind

    2、关闭防火墙

    [root@localhost ~]# systemctl stop firewalld
    [root@localhost ~]# iptables -F
    [root@localhost ~]# setenforce 0

     3、添加本机的IP地址

    [root@localhost ~]# vim /etc/resolv.conf

    nameserver 192.168.100.175
    nameserver 192.168.100.170

    4、修改hosts文件,添加域名跟IP地址

    [root@localhost ~]# vim /etc/hosts

    192.168.100.175 ns1.crushlinux.com
    192.168.100.170 ns2.crushlinux.com

    5、修改配置文件/etc/named.conf

    [root@localhost ~]# vim /etc/named.conf

    options {
            directory       "/var/named";
    };
    zone "crushlinux.com" IN {
            type master;
            file "crushlinux.zheng";
            allow-transfer {192.168.100.170;};
    };
    zone "100.168.192.in-addr.arpa" IN {
            type master;
            file "crushlinux.fan";
            allow-transfer {192.168.100.170;};
    };

    6、在/var/named/创建crushlinux.zheng

    [root@localhost ~]# vim /var/named/crushlinux.zheng

    $TTL 86400
    @       IN      SOA     crushlinux.com.   admin.crushlinux.com. (
                        20190817
                        3H
                        15M
                        1W
                        1D
    )
               IN      NS      ns1.crushlinux.com.
               IN      NS      ns2.crushlinux.com.
               IN      MX 10   mail.crushlinux.com.
    ns1     IN      A       192.168.100.175
    ns2     IN      A       192.168.100.170
    mail    IN      A       192.168.100.171
    www   IN      A       192.168.100.172
    study  IN      A       192.168.100.173
    *          IN      A       192.168.100.175
    ftp       IN      CNAME   www

    7、在/var/named/创建crushlinux.fan并进行编辑

    [root@localhost ~]# vim /var/named/crushlinux.fan

    $TTL 86400
    @       IN      SOA     crushlinux.com.         admin.crushlinux.com.(
                        20190817
                        3H
                        15M
                        1W
                        1D
    )
               IN      NS      ns1.crushlinux.com.
               IN      NS      ns2.crushlinux.com.
               IN      MX 10   mail.crushlinux.com.
    175     IN      PTR     ns1.crushlinux.com.
    170     IN      PTR     ns2.crushlinux.com.
    171     IN      PTR     mail.crushlinux.com.
    172     IN      PTR     www.crushlinux.com.
    173     IN      PTR     study.crushlinux.com.
    175     IN      PTR     ns1.crushlinux.com.

    8、更改文件的权限

    [root@localhost ~]# chown :named /var/named/crushlinux.*

    9、查看主配置文件是否正确

    [root@localhost ~]# named-checkconf -z /etc/named.conf
    zone crushlinux.com/IN: loaded serial 20190817
    zone 100.168.192.in-addr.arpa/IN: loaded serial 20190817

    10、查看正反区域数据文件是否正确

    [root@localhost ~]# named-checkzone crushlinux.com /var/named/crushlinux.zheng

    [root@localhost ~]# named-checkzone crushlinux.com /var/named/crushlinux.fan

    11、重启服务,查看服务状态

    [root@localhost ~]# systemctl restart named

    [root@localhost ~]# systemctl status named

    从服务器(Centos 6 192.168.100.170)

    1、创建目录,挂载镜像

    [root@localhost ~]# mkdir /media/cdrom

    [root@localhost ~]# mount /dev/cdrom /media/cdrom

    2、安装bind服务

    [root@localhost ~]# rpm -ivh /media/cdrom/Packages/bind-9.8.2-0.17.rc1.el6_4.6.x86_64.rpm

    3、从主服务器复制文件到从服务器

    [root@localhost ~]# scp /etc/named.conf 192.168.100.170:/etc/

    3、

    [root@localhost ~]# service iptables stop

    [root@localhost ~]# service iptables status

    4、修改配置文件

    [root@localhost ~]# cat /etc/resolv.conf

    nameserver 192.168.100.175
    nameserver 192.168.100.170

    [root@localhost ~]# vim /etc/hosts

    192.168.100.175 ns1.crushlinux.com
    192.168.100.170 ns2.crushlinux.com

    [root@localhost ~]# vim /etc/named.conf

    options {
            directory       "/var/named";
    };
    zone "crushlinux.com" IN {
            type slave;
            file "slaves/crushlinux.zheng";
            masters { 192.168.100.175; };
    };
    zone "100.168.192.in-addr.arpa" IN {
            type slave;
            file "slaves/crushlinux.fan";
            masters { 192.168.100.175; };
    };
     
    4、重启
    [root@localhost ~]# service named restart
     
    本文为作者 三岁半的胖啊 的原创,转载请标明出处 链接:https://home.cnblogs.com/u/tanxiaojuncom/
  • 相关阅读:
    SqlServer2008 / SqlServer2012 禁用windows登录,sa忘记密码或密码过期如何登陆
    windows下批处理保留指定日期下的文件
    centos7上使用git clone出现问题
    VS2015编译Teamtalk的Windows客户端(转)
    Mac Book触摸板失灵的解决办法(触摸板按下失灵)
    系统设计原则
    命令“regsvr32 /s /n /i:user "XXXXXX"”已退出,代码为 3
    Android实现开机自动运行程序
    Java并发之CyclicBarrier、CountDownLatch、Phaser
    Java多线程之ThreadLocal
  • 原文地址:https://www.cnblogs.com/tanxiaojuncom/p/11369141.html
Copyright © 2020-2023  润新知