zoukankan      html  css  js  c++  java
  • CentOS7部署DNS


    在DNS服务器上:

    1.安装bind:

    # yum -y install bind  bind-utils

    查看配置文件:

    # rpm -ql bind | grep etc

    /etc/logrotate.d/named
    /etc/named
    /etc/named.conf
    /etc/named.iscdlv.key
    /etc/named.rfc1912.zones
    /etc/named.root.key
    /etc/rndc.conf
    /etc/rndc.key
    /etc/rwtab.d/named
    /etc/sysconfig/named
    /usr/share/doc/bind-9.11.4/sample/etc
    /usr/share/doc/bind-9.11.4/sample/etc/named.conf
    /usr/share/doc/bind-9.11.4/sample/etc/named.rfc1912.zones

    2.修改主配置文件:

    # vim /etc/named.conf
    
    options {
            listen-on port 53 { any; };
            listen-on-v6 port 53 { ::1; };
            directory       "/var/named";
            dump-file       "/var/named/data/cache_dump.db";
            statistics-file "/var/named/data/named_stats.txt";
            memstatistics-file "/var/named/data/named_mem_stats.txt";
            recursing-file  "/var/named/data/named.recursing";
            secroots-file   "/var/named/data/named.secroots";
            allow-query     { any; };
            recursion yes;
    
            dnssec-enable no;
            dnssec-validation no;

    3.修改etc/named.rfc1912.zones文件:

    # vim etc/named.rfc1912.zones
        zone "color.com." IN {
            type master;
            file "color.com.zone";
        };
    
        zone "13.168.192.in-addr.arpa" IN {
            type master;
            file "13.168.192.zone";
        };

    4.添加正向解析文件:

    # vim /var/named/color.com.zone
    $TTL 1D
    @       IN      SOA     @       color.com. (
                                            0       ; serial
                                            1D      ; refresh
                                            1H      ; retry
                                            1W      ; expire
                                            3H )    ; minimum
            NS      @
            A       192.168.13.188
    doc     IN      A       192.168.13.200
    top     IN      A       192.168.13.201
    blue    IN      A       192.168.13.202

    5.添加反向解析文件:

    # vim /var/named/13.168.192.zone
    $TTL 1D
    @       IN      SOA     diyibox.com.    color.com. (
                                                    0       ; serial
                                            1D      ; refresh
                                            1H      ; retry
                                            1W      ; expire
                                            3H )    ; minimum
    
            NS      color.com.
    188     IN      PTR     color.com.
    200     IN      PTR     doc.color.com.
    201     IN      PTR     top.color.com.
    202     IN      PTR     blue.color.com.

    6.开启dns服务:

    # systemctl start named

    7.查看进程:

    # ps -ef | grep named
    named     13356      1  0 15:43 ?        00:00:00 /usr/sbin/named -u named -c /etc/named.conf
    root      13397   1088  0 16:05 pts/0    00:00:00 grep --color=auto named

    在客户端进行:

    1.下载

    # yum -y install bind-utils 

    2.修改客户端/etc/resolv.conf 文件:

    # vim /etc/resolv.conf 
    nameserver   192.168.13.188

    3.测试dns:

    # nslookup color.com  

    Server: 192.168.13.188
    Address: 192.168.13.188#53

    Name: color.com
    Address: 192.168.13.188

    # nslookup   192.168.13.200 

    200.13.168.192.in-addr.arpa name = doc.color.com.

  • 相关阅读:
    bzoj 2120 数颜色 带修改莫队
    luogu 2709 小B的询问 莫队
    bzoj 2002 [Hnoi2010]Bounce 弹飞绵羊 分块
    bzoj 4765 普通计算姬 dfs序 + 分块
    loj 数列分块入门 6 9(区间众数)
    loj 数列分块入门 5 7 8
    AtCoder Grand Contest 021 D
    Codeforces Round #466
    office 威胁检测
    修改macos的启动LOGO
  • 原文地址:https://www.cnblogs.com/haoee/p/13397787.html
Copyright © 2011-2022 走看看