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.

Steps to change DNS settings in openSUSE and SLES:

Change DNS settings on SUSE systems managed by NetworkManager

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.

  1. List the available connection profiles and note the active profile name.
    $ 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
  2. Review the current IPv4 DNS behavior for the selected profile.
    $ 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:                        --
  3. Set the static DNS servers on the connection profile while keeping automatic IPv4 addressing.
    $ 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.

  4. Set the search domain list if short host names must resolve through specific domains.
    $ sudo nmcli connection modify "Wired connection 1" ipv4.dns-search "example.com corp.example.com"

    Skip this step when no search suffix is required.

  5. Reactivate the connection profile so the new resolver settings are applied.
    $ 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.

  6. Verify that NetworkManager is now advertising the expected DNS servers and search domains on the device.
    $ 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

Change DNS settings on SUSE systems managed by wicked

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.

  1. Confirm that wicked is the active network stack before changing static resolver policy.
    $ 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.

  2. Open the global network configuration file with elevated privileges.
    $ sudo vi /etc/sysconfig/network/config
  3. Set the DNS policy and static resolver values in /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.

  4. Regenerate the active resolver configuration from the updated netconfig settings.
    $ sudo netconfig update -f
  5. Confirm that /etc/resolv.conf points at the netconfig-generated resolver file.
    $ readlink -f /etc/resolv.conf
    /run/netconfig/resolv.conf
  6. Verify that the generated resolver file now contains the expected name servers and search list.
    $ grep -E '^(search|nameserver)' /etc/resolv.conf
    search example.com corp.example.com
    nameserver 1.1.1.1
    nameserver 9.9.9.9