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

Tue Feb 18 15:51:49 UTC 2020
Anand Buddhdev <anandb at ripe.net>

On 18/02/2020 16:37, Nicolas Kovacs wrote:

> 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.

Oh yes. Are you still sure you want to use NetworkManager? It's a pain!

> 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.
> 
> Any suggestions ?

Yes. Do this:

# cat >/etc/NetworkManager/conf.d/dns.conf <<EOF
[main]
rc-manager=unmanaged
EOF

# systemctl reload NetworkManager

This tells NetworkManager to leave /etc/resolv.conf alone. Now you can
put whatever you like in /etc/resolv.conf, and it will be left untouched.

Regards,
Anand