Nicolas Kovacs
2021-Jun-07 08:32 UTC
[CentOS] Static configuration: prevent /etc/resolv.conf from being overwritten on first reboot
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 -- 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
James Pearson
2021-Jun-07 12:13 UTC
[CentOS] Static configuration: prevent /etc/resolv.conf from being overwritten on first reboot
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
Gordon Messmer
2021-Jun-07 14:01 UTC
[CentOS] Static configuration: prevent /etc/resolv.conf from being overwritten on first reboot
On 6/7/21 1:32 AM, Nicolas Kovacs wrote:> # Generated by NetworkManager...> Q: how can I prevent /etc/resolv.conf from being overwritten on the initial > reboot?Edit /etc/NetworkManager/NetworkManager.conf: [main] dns=none