[CentOS] From network-scripts to NetworkManager on a router : questions

Tue Feb 18 16:43:29 UTC 2020
Jonathan Billings <billings at negate.org>

On Tue, Feb 18, 2020 at 04:37:29PM +0100, Nicolas Kovacs wrote:
>
> Le 18/02/2020 à 12:28, Anand Buddhdev a écrit :
> > Neither. The DNS configuration should not normally be bound to a
> > specific interface, so don't configure it with any interface. If you do,
> > and that interface goes down, your DNS config also disappears.
> 
> I would like to do that very much, only NetworkManager makes you jump
> through burning loops to do so.
> 
> With network-scripts, it was just a matter of editing resolv.conf with
> nameserver and search domain directives.
> 
> I can't do that anymore, because /etc/resolv.conf gets squashed by
> NetworkManager. If I don't fill in DNS information for the interfaces, then
> all I get is an empty "#Generated by NetworkManager" line.
> 
> On the other hand, using nmtui, the only place where I can actually fill in
> DNS information is in the interface-specific dialogs.
> 
> After googling around for this problem, it looks like I'm not the only one
> scratching my head.

According to 'man nm-settings-ifcfg-rh', PEERDNS=no is the old
network-services services mechanism for not changing /etc/resolv.conf,
while in NM it just means never add automatic nameservers to
resolv.conf from DHCP, PPP, VPN, etc.  Turning off all DNS
updates means adding:

[main]
dns=none

... to the NetworkManager.conf (or preferably in an
/etc/NetworkManager/conf.d/ file) is probably going to be the most
effective way.  I've seen PEERDNS=no make NetworkManager not overwrite
my resolv.conf but maybe I should be extra careful and drop in a
config file that turns off all dns updating features of
NetworkManager. 

-- 
Jonathan Billings <billings at negate.org>