centos dns覆盖的问题

本文就基于Linux rpi2 4.1.11-v7+ #822 SMP PREEMPT Fri Oct 23 16:22:18 BST 2015 armv7l armv7l armv7l GNU/Linux

默认情况下eth0位自动获取IP,同时dns也会自动设置,即使手动设置dns  /etc/resolv.conf,重启后依然会自动覆盖为dhcp获取的dns,resolv.conf内容为:

# Generated by NetworkManager
nameserver 192.168.1.1

说明是被NetworkManager覆盖的,经过多次尝试手动设置dns,重启后依然会被NetworkManager覆盖,在不禁用NetworkManager的情况下如何手动设置dns呢。

经过查看NetworkManager文档, man 5 NetworkManager.conf,得知,dns设置有三种

       dns
           Set the DNS (resolv.conf) processing mode.

           default: The default if the key is not specified. NetworkManager
           will update resolv.conf to reflect the nameservers provided by
           currently active connections.

           dnsmasq: NetworkManager will run dnsmasq as a local caching
           nameserver, using a "split DNS" configuration if you are connected
           to a VPN, and then update resolv.conf to point to the local
           nameserver.

           unbound: NetworkManager will talk to unbound and dnssec-triggerd,
           providing a "split DNS" configuration with DNSSEC support. The
           /etc/resolv.conf will be managed by dnssec-trigger daemon.

           none: NetworkManager will not modify resolv.conf.

看明白了吗, 我们直接设置dns=none即可

setup

1、nano /etc/NetworkManager/NetworkManager.conf

2、在其中加入dns=none

.......

[main]
plugins=ifcfg-rh
dns=none

......

重启,问题解决

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值