ONEDNS配置1:centos7DNS服务器forwarder配置

ONEDNS配置1:centos7DNS服务器forwarder配置

  • 1.显示当前网络连接
  • 2.修改当前网络连接对应的DNS服务器
  • 3.将dns配置生效
  • 4.修改 /etc/NetworkManager/NetworkManager.conf 文件
  • 5.NetworkManager重新装载上面修改的配置
  • 6.打开resolv.conf,查看配置是否存在
  • 7. 打开named.conf
  • 8.添加One DNS的IP地址为优先Forwarding DNS服务器地址
  • 9.重新启动DNS服务


1.显示当前网络连接

输入:#nmcli connection show

NAME    UUID                                  TYPE      DEVICE 
ens192  340e3b19-3e7c-41b4-a7d6-a17c208ad516  ethernet  ens192 

2.修改当前网络连接对应的DNS服务器

#nmcli con mod eno1 ipv4.dns "52.80.53.83 52.80.59.89"

3.将dns配置生效

#nmcli con up ens192

4.修改 /etc/NetworkManager/NetworkManager.conf 文件

在main部分添加 “dns=none” 选项:

[main]

plugins=ifcfg-rh

dns=none

5.NetworkManager重新装载上面修改的配置

#systemctl restart NetworkManager.service

6.打开resolv.conf,查看配置是否存在

输入:vi /etc/resolv.conf

# Generated by NetworkManager
nameserver 52.80.53.83
nameserver 52.80.59.89

7. 打开named.conf

输入:vi /etc/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.
//
// See the BIND Administrator's Reference Manual (ARM) for details about the
// configuration located in /usr/share/doc/bind-{version}/Bv9ARM.html

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";
        recursing-file  "/var/named/data/named.recursing";
        secroots-file   "/var/named/data/named.secroots";
        allow-query     { localhost; };
        ...省略...        
        forwarders{
                8.8.4.4;
                114.114.114.114;
                };
        ...省略...
          };

8.添加One DNS的IP地址为优先Forwarding DNS服务器地址

...省略...        
        forwarders{        
                52.80.66.30;
                52.80.52.30;
                
                ##如果网络出口室动态IP,请使用
                52.80.53.83;
                52.80.59.89;
                };        
        ...省略...

9.重新启动DNS服务

systemctl restart named

你可能感兴趣的