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

Mon Jun 7 08:32:40 UTC 2021
Nicolas Kovacs <info at microlinux.fr>


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

I reboot my server, and I don't know why, but my /etc/resolv.conf has been

# Generated by NetworkManager

So I edit this file again:

# /etc/resolv.conf

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.


Microlinux - Solutions informatiques durables
7, place de l'église - 30730 Montpezat
Site : https://www.microlinux.fr
Blog : https://blog.microlinux.fr
Mail : info at microlinux.fr
Tél. : 04 66 63 10 32
Mob. : 06 51 80 12 12