Centos 7 Network Manager overwriting resolv.conf

Hi all,

I need to add domain and search parameters to resolv.conf, however network manager overwrites.

Setting the PEERDNS=No in the interface file seems to have no effect on this behaviour.

Sadly I cannot just disable NM as these are not my hosts, I'm just attempting to install a platform on them.

If I can modify Network Manager's behaviour over CLI or get it to enforce my chosen pragmas either would be great.

Thanks in advance...

Hi,

I'd think that the best way might be to modify the file and then run;

# chattr +i /etc/resolv.conf

This will stop the file being modified - However if the server is using DHCP to pick up it's IP lease you may have problems if the lease expires.

Regards

Gull04

1 Like

I discovered the joys of adding the DOMAIN=... pragma to /etc/sysconfig/network-scripts/ifcfg-${INTERFACE_ID}

Thanks all

With the command nmcli you could let it do it for you.

nmcli con mod "<your connection name here>" ipv4.dns-search <your domain search here>
nmcli con mod "<your connection name here>" ipv4.dns <your dns ip here>
nmcli con reload "<your connection name here>"

Then, take a look at your ifcfg-x file.

3 Likes