码迷,mamicode.com
首页 > 系统相关 > 详细

更改 Linux 服务器 DNS

时间:2020-09-17 13:21:55      阅读:39      评论:0      收藏:0      [点我收藏+]

标签:rest   otp   err   header   pre   ns3   生效   add   --   

更改 Linux 服务器 DNS

编辑网络配置文件 /etc/sysconfig/network-scripts/ifcfg-eno1
? root@xxxx-212-mysql  ~  cat /etc/sysconfig/network-scripts/ifcfg-eno1
TYPE="Ethernet"
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="eno1"
UUID="ab9d298e-7683-474b-beb4-1551cc7e26cd"
DEVICE="eno1"
HWADDR="44:37:e6:c9:da:24"
ONBOOT="yes"
PEERDNS="yes"
PEERROUTES="yes"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_PRIVACY="no"
IPADDR0=192.168.0.212
GATEWAY0=192.168.0.254
NEMASK=255.255.252.0
DNS1=192.168.0.212
DNS2=192.168.99.1

?

vim DNS配置保存
root@xxxx-212-mysql  ~  cat /etc/sysconfig/network-scripts/ifcfg-eno1
TYPE="Ethernet"
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="eno1"
UUID="ab9d298e-7683-474b-beb4-1551cc7e26cd"
DEVICE="eno1"
HWADDR="44:37:e6:c9:da:24"
ONBOOT="yes"
PEERDNS="yes"
PEERROUTES="yes"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_PRIVACY="no"
IPADDR0=192.168.0.212
GATEWAY0=192.168.0.254
NEMASK=255.255.252.0
DNS1=192.168.0.212
DNS2=192.168.99.1
DNS3=114.114.114.114
重启网络
? root@xxxx-212-mysql  ~  systemctl restart network
检查配置是否生效
? root@xxxx-212-mysql  ~  cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 192.168.0.212
nameserver 192.168.99.1

更改 Linux 服务器 DNS

标签:rest   otp   err   header   pre   ns3   生效   add   --   

原文地址:https://www.cnblogs.com/securitybob/p/13614708.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!