zoukankan      html  css  js  c++  java
  • CentOS8配置本地DNS

    为了完成VCSA的完整安装。需要在本地配置一台RedHat8的vm来作为本地的DNS

    1.安装DNS服务

    查询bind

    [root@vm2 ~]# yum info bind

    安装bind

    [root@vm2 ~]# yum -y install bind
    [root@vm2 ~]# rpm -ql bind

     查看13个根域服务器文件:

    [root@vm2 ~]# cat /var/named/named.ca

     开启DNS服务,并添加防火墙端口:

    [root@vm2 ~]# systemctl start named
    [root@vm2 ~]# systemctl enable named
    Created symlink /etc/systemd/system/multi-user.target.wants/named.service → /usr/lib/systemd/system/named.service.
    [root@vm2 ~]# firewall-cmd --permanent --add-service=dns
    success
    [root@vm2 ~]# firewall-cmd --permanent --add-port=53/tcp
    success
    [root@vm2 ~]# firewall-cmd --permanent --add-port=53/udp
    success

    [root@vm2 ~]# firewall-cmd --reload
    success
    [root@vm2 ~]# ss -untl

    查看修改网卡信息:

    [root@vm2 ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens192

    PEERDNS= "no"

     电脑重启后 /etc/resolv.conf 的namespace不会恢复至系统默认

    [root@vm2 ~]# systemctl restart network-online.target

    编辑DNS配置文件/etc/named.conf文件:

    [root@vm2 etc]# cp -p /etc/named.conf{,.back}

    [root@vm2 etc]# ll |grep named.conf
    -rw-r-----.  1 root named     1705 Feb 18  2021 named.conf
    -rw-r-----.  1 root named     1705 Feb 18  2021 named.conf.back

    [root@vm2 etc]# vim named.conf

    [root@vm2 etc]# cat named.conf
    //
    // named.conf
    //
    // Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
    // server as a caching only nameserver (as a localhost DNS resolver only).
    //
    // See /usr/share/doc/bind*/sample/ for example named configuration files.
    //
    
    options {
        listen-on port 53 { 127.0.0.1; };
        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";
        secroots-file    "/var/named/data/named.secroots";
        recursing-file    "/var/named/data/named.recursing";
        allow-query     { localhost; };
    
        /* 
         - If you are building an AUTHORITATIVE DNS server, do NOT enable recursion.
         - If you are building a RECURSIVE (caching) DNS server, you need to enable 
           recursion. 
         - If your recursive DNS server has a public IP address, you MUST enable access 
           control to limit queries to your legitimate users. Failing to do so will
           cause your server to become part of large scale DNS amplification 
           attacks. Implementing BCP38 within your network would greatly
           reduce such attack surface 
        */
        recursion yes;
    
        dnssec-enable yes;
        dnssec-validation yes;
    
        managed-keys-directory "/var/named/dynamic";
    
        pid-file "/run/named/named.pid";
        session-keyfile "/run/named/session.key";
    
        /* https://fedoraproject.org/wiki/Changes/CryptoPolicy */
        include "/etc/crypto-policies/back-ends/bind.config";
    };
    
    logging {
            channel default_debug {
                    file "data/named.run";
                    severity dynamic;
            };
    };
    
    zone "." IN {
        type hint;
        file "named.ca";
    };

    zone "example.com" IN {
            type master;
            file "example.com.zone";
    }; include
    "/etc/named.rfc1912.zones"; include "/etc/named.root.key";

    [root@vm2 etc]# systemctl reload named
    [root@vm2 etc]# ss -ntul

    [root@vm2 etc]# cat /etc/resolv.conf
    # Generated by NetworkManager
    search example.com

  • 相关阅读:
    谈谈架构层级的“开闭原则”
    将MySQL数据库中的表结构导入excel 或word
    淘宝网-软件质量属性分析
    架构漫谈阅读有感
    机器学习-分类算法之决策树、随机森林
    机器学习-分类算法之逻辑回归
    机器学习-朴素贝叶斯算法
    机器学习-分类算法之k-近邻
    机器学习-模型选择
    机器学习-scikit-learn数据集
  • 原文地址:https://www.cnblogs.com/yyuuee/p/15686853.html
Copyright © 2011-2022 走看看