However, /etc/sysconfig/network/config is owned by sysconfig package. Local changes can be overwritten or reverted during system package updates.
There does not seem to be a drop-in mechanism such as:
/etc/sysconfig/network/config.d/*.conf
So, dear openSUSE maintainers , please add support for an upgrade-safe way to override the NETCONFIG_DNS_* settings, without editing the package-owned /etc/sysconfig/network/config directly
With NetworkManager, you can either use your desktop’s network configuration utility or nmcli to modify the connection and set the required static DNS servers for your connection definition.
For example: nmcli connection modify "YourConnectionName" ipv4.dns "1.1.1.1 8.8.8.8" nmcli connection modify "YourConnectionName" ipv4.ignore-auto-dns yes
then nmcli connection down "YourConnectionName" nmcli connection up "YourConnectionName"
Thank you for the tips but that won’t work for me.
At first I thought about NM way. But what I want is a “global” dns setting (no matter what network I connection to). NM’s config just effect one connection. I move my laptop a lot. I often connect to new Wifi. In new office I create new ethernet connection (with new static IP).
As far as I can find, sysconfig is the only way to config “globally static” dns server IPs for system.
Most probably again using NetworkManager. Simply because that is the way this is done (and it originally was designed for just that: moving systems from network to network).
Please check. /etc/resolv.conf will be a symlink in your system.
When that is the case, then remove /etc/resolv.conf, create a new one with the resolv configuration you want. I have e.g.
If the key is unspecified, default is used, unless /etc/resolv.conf is a symlink to /run/systemd/resolve/stub-resolv.conf, /run/systemd/resolve/resolv.conf, /lib/systemd/resolv.conf or /usr/lib/systemd/resolv.conf. In that case, systemd-resolved is chosen automatically.
default: NetworkManager will update /etc/resolv.conf to reflect the nameservers provided by currently active connections. The rc-manager setting (below) controls how this is done.
dnsmasq: NetworkManager will run dnsmasq as a local caching nameserver, using “Conditional Forwarding” if you are connected to a VPN, and then update resolv.conf to point to the local nameserver. It is possible to pass custom options to the dnsmasq instance by adding them to files in the “/etc/NetworkManager/dnsmasq.d/” directory. Note that when multiple upstream servers are available, dnsmasq will initially contact them in parallel and then use the fastest to respond, probing again other servers after some time. This behavior can be modified passing the ‘all-servers’ or ‘strict-order’ options to dnsmasq (see the manual page for more details).
systemd-resolved: NetworkManager will push the DNS configuration to systemd-resolved
dnsconfd: NetworkManager will push the DNS configuration to dnsconfd
and by default set ipvX.routed-dns to yes, so servers are contacted through right interfaces.
none: NetworkManager will not modify resolv.conf. This implies rc-managerunmanaged
Note that the plugins dnsmasq,systemd-resolved and dnsconfd are caching local nameservers. Hence, when NetworkManager writes /run/NetworkManager/resolv.conf and /etc/resolv.conf (according to rc-manager setting below), the name server there will be localhost only. NetworkManager also writes a file /run/NetworkManager/no-stub-resolv.conf that contains the original name servers pushed to the DNS plugin.
When using dnsmasq,systemd-resolved and dnsconfd per-connection added dns servers will always be queried using the device the connection has been activated on.
As said, I have it done on a system using NM (and have it also on systems using systemd networking) and it functions as expected. You can read above that @susejunky has the same experience. What sort of reassurance do expect more from us.