[CentOS] Static configuration: prevent /etc/resolv.conf from being overwritten on first reboot

Mon Jun 7 12:13:50 UTC 2021
James Pearson <james-p at moving-picture.com>

Nicolas Kovacs <info at 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