Issue resolv.conf

In a fresh Rocky9 I configure an interface as “manual” (not dhcp). I have problems with the /etc/resov.conf that is deleted every time. What is the command (if possible with nmcli) to tell NetworkManager not to overwrite the existing dns config file.

Option one is to add the DNS config to the connection, so that NetworkManager creates your desired resolv.conf. Connections do have options, like ipv4.dns, ipv4.dns-search, ipv4.dns-options, and ipv4.dns-priority. See man nm-settings-nmcli


Option two, see “dns” in man NetworkManager.conf
In practice, something like:

# cat /etc/NetworkManager/conf.d/00-dns.conf 
[main]
dns=none

I prefer option one and use option two to set dns=dnsmasq (as dnsmasq is bit smarter than the default glibc).

3 Likes

Thank, I try this one …

Hey @jlehtone, Thank You for sharing this information! :grinning:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.