Changing the DNS servers on a SUSE system controls which resolvers answer internal host names, public lookups, split-horizon zones, and content-filtering policies. Correct resolver settings matter whenever package repositories, VPN-only domains, or internal service records stop resolving through the default DHCP-provided name servers.
The active network stack decides where those DNS settings live. On hosts managed by NetworkManager, resolver values are stored in the connection profile and are usually applied with nmcli. On hosts managed by wicked, static resolver policy is defined through /etc/sysconfig/network/config and netconfig generates the active resolver file under /run/netconfig/resolv.conf.
Current SUSE deployments use both models depending on workload. openSUSE Leap defaults to NetworkManager for desktop installations and wicked for server installations, while current SLED and SLES guidance still treats wicked as the supported path for server-certified workloads. Identify the active backend first and use only its matching method, because mixing nmcli changes with wicked configuration can lead to confusing resolver results.
Related: How to configure a static IP address in openSUSE and SLES
Related: How to change system hostname in openSUSE and SLES
Methods to change DNS settings in openSUSE and SLES:
Use this method when the active connection is owned by NetworkManager. This is common on openSUSE desktop installations and on current SLES systems that use NetworkManager as the primary network stack.
Replacing only the resolver list does not require switching to a static IP address. Keep ipv4.method set to auto when DHCP still provides the interface address, gateway, and route information, and override only the DNS properties that NetworkManager applies to the profile.
$ nmcli connection show NAME UUID TYPE DEVICE Wired connection 1 7f6e4f79-0f2b-4d66-bde8-2d95e3b1c4d0 ethernet eth0 lo 3a4bb2d4-0b4d-4d3b-b8ee-a48b2f20de54 loopback lo
$ nmcli -f ipv4.method,ipv4.dns,ipv4.ignore-auto-dns,ipv4.dns-search connection show "Wired connection 1" ipv4.method: auto ipv4.dns: -- ipv4.ignore-auto-dns: no ipv4.dns-search: --
$ sudo nmcli connection modify "Wired connection 1" ipv4.ignore-auto-dns yes ipv4.dns "1.1.1.1 9.9.9.9"
ipv4.ignore-auto-dns yes tells NetworkManager to stop accepting DHCP-provided DNS servers for this profile and use only the addresses listed in ipv4.dns.
$ sudo nmcli connection modify "Wired connection 1" ipv4.dns-search "example.com corp.example.com"
Skip this step when no search suffix is required.
$ sudo nmcli connection up "Wired connection 1" Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/2)
Reactivating a remote connection can briefly interrupt SSH or console-over-LAN sessions, so schedule the change from a local console or another out-of-band path when the host is remote.
$ nmcli device show eth0 | grep -E 'IP4\\.DNS|IP4\\.DOMAIN' IP4.DNS[1]: 1.1.1.1 IP4.DNS[2]: 9.9.9.9 IP4.DOMAIN[1]: example.com IP4.DOMAIN[2]: corp.example.com
Use this method when the system is managed by wicked and netconfig. This is the standard path on many openSUSE server installations and the supported server-certified workflow in current SLED and SLES 15 SP7 documentation.
With wicked, static DNS settings are defined in /etc/sysconfig/network/config and merged into the active resolver file by netconfig. The NETCONFIG_DNS_POLICY value controls whether those static values replace dynamic DNS data entirely or act only as fallback when DHCP or another dynamic source does not provide resolvers.
$ systemctl is-active wicked active $ systemctl is-active NetworkManager inactive
If NetworkManager is active for the target interface, use the previous method instead of editing wicked settings.
$ sudo vi /etc/sysconfig/network/config
NETCONFIG_DNS_POLICY="STATIC" NETCONFIG_DNS_STATIC_SERVERS="1.1.1.1 9.9.9.9" NETCONFIG_DNS_STATIC_SEARCHLIST="example.com corp.example.com"
Use STATIC_FALLBACK instead of STATIC when DHCP-provided DNS should remain preferred and the listed resolvers should be used only when no dynamic DNS data is available.
$ sudo netconfig update -f
$ readlink -f /etc/resolv.conf /run/netconfig/resolv.conf
$ grep -E '^(search|nameserver)' /etc/resolv.conf search example.com corp.example.com nameserver 1.1.1.1 nameserver 9.9.9.9