Hi,
Here's something that's puzzling me.
Starting from a minimal installation of CentOS 7, network configuration is DHCP.
I'm launching nmtui to define a static configuration.
I'm providing the IP address as well as the gateway, but no DNS server.
I'm quitting nmtui and I'm editing /etc/resolv.conf to provide my DNS server:
# /etc/resolv.conf nameserver 192.168.0.254
I reboot my server, and I don't know why, but my /etc/resolv.conf has been overwritten:
# Generated by NetworkManager
So I edit this file again:
# /etc/resolv.conf nameserver 192.168.0.254
And starting from here, it works, meaning /etc/resolv.conf is not overwritten on subsequent reboots.
Q: how can I prevent /etc/resolv.conf from being overwritten on the initial reboot? I vaguely remember having to kill some process before editing it, but unfortunately I don't remember which one.
Cheers,
Niki
Nicolas Kovacs info@microlinux.fr wrote:
Q: how can I prevent /etc/resolv.conf from being overwritten on the initial reboot? I vaguely remember having to kill some process before editing it, but unfortunately I don't remember which one.
One way to do this is to create the file /etc/dhcp/dhclient-enter-hooks that contains:
make_resolv_conf(){ : }
Or, add the line 'PEERDNS=no' to the matching /etc/sysconfig/network-scripts/ifcfg-XXXX file
James Pearson