GoAdmio

resolver

Set the server's DNS resolvers to Google (the default), OpenDNS, Quad9, Cloudflare, or your own addresses through NetworkManager; given a single IP address, it only looks up that IP's country and organization

On this page: Overview · Quick start · Syntax · Options · Output · Examples · Troubleshooting · Details · See also


Overview

The resolvers are the DNS servers the server itself uses to look up names. Mail delivery, certificate requests, package updates, and every curl call from a script depend on them.

/go/resolver changes them in one step. It:

The command has a second, separate use: if you give it only one IP address, it changes nothing and just looks that address up (see Lookup mode).

[!WARNING] Changing resolvers re-activates the network connection and restarts network services. An SSH session can drop for a moment. If the new addresses are wrong, name lookups stop working. The addresses are not validated.


Quick start

# Use Google's resolvers (the default)
/go/resolver

# Use Cloudflare's resolvers
/go/resolver cloudflare

# Use your own two resolvers
/go/resolver 192.168.1.1 192.168.1.2

Syntax

/go/resolver [google|opendns|quad9|cloudflare]
/go/resolver <primary> <secondary> [<tertiary>]
/go/resolver <ip>
Form Behavior
/go/resolver Same as google.
/go/resolver <provider> Uses that provider's three built-in addresses.
/go/resolver <primary> <secondary> [<tertiary>] Uses your own addresses, IPv4 or IPv6.
/go/resolver <ip> Lookup only. Prints the IP's country and organization. Nothing is changed.

Provider names are matched in lower case or with a first capital letter only: google or Google, opendns or OpenDNS, quad9 or Quad9, cloudflare or Cloudflare. Anything else, such as GOOGLE, is treated as an IP address.


Options

There are no --option flags. The built-in providers are:

Provider Primary Secondary Tertiary (IPv6)
Google (default) 8.8.8.8 8.8.4.4 2001:4860:4860::8888
OpenDNS 208.67.222.222 208.67.220.220 2620:119:35::35
Quad9 9.9.9.9 149.112.112.112 2620:fe::fe
Cloudflare 1.1.1.1 1.0.0.1 2606:4700:4700::1111

For your own addresses, pass the primary, secondary, and an optional tertiary one. The secondary is required, because a single address triggers the lookup mode.


Output

Outcome What you get
Resolvers set Your resolvers have been successfully configured.
Check failed Your resolvers failed to configure.
Lookup mode `

Notes on the output:


Examples

# Default: Google
/go/resolver
# Quad9
/go/resolver quad9
# Custom IPv4 resolvers
/go/resolver 192.168.1.1 192.168.1.2
# Look up who owns an IP address (nothing is changed)
/go/resolver 8.8.8.8
# Check the result
cat /etc/resolv.conf
nmcli device show | grep DNS
getent hosts example.com

Troubleshooting

Symptom Likely cause Fix
Your resolvers failed to configure. The primary address isn't in /etc/resolv.conf after the restarts, because NetworkManager or systemd-resolved rewrote the file, or NetworkManager doesn't manage the connection. Check cat /etc/resolv.conf and nmcli connection show --active.
It printed `US Google LLC` and changed nothing You passed only one address.
The SSH session dropped The connection is re-activated and network services are restarted. Reconnect. Run it from the console when you can.
Name lookups stop working A mistyped or unreachable address was accepted. Run /go/resolver with no arguments to go back to Google's.
The settings are lost after a reboot Only /etc/resolv.conf was changed, because none of the NetworkManager steps applied (see How the settings are saved). Use a provider name, or two IPv4 addresses.
The IPv6 resolver isn't used It is only saved when the server has working IPv6, tested by curl -6 https://icanhazip.com. Check IPv6 connectivity.
The command is slow to start It contacts two outside services first, with no time limit. Wait, or fix IPv6 connectivity if the IPv6 test is what hangs.
NetworkManager was installed on a server that didn't use it It is installed whenever nmcli is missing. If the server uses netplan or ifupdown, NetworkManager may not manage the interface, so the NetworkManager steps do nothing. Edit the real network configuration instead.
A provider name wasn't recognized Only google/Google style spellings are matched. Use the exact spelling from the table.
whois: command not found in lookup mode whois isn't installed. Install it.

Details

What happens on each run

flowchart TD
    A["resolver args"] --> B["Log the call, get public IPv4 and IPv6"]
    B --> C["Install NetworkManager if nmcli is missing"]
    C --> D{"Provider name, or none?"}
    D -- "Yes" --> E["Use that provider's three addresses"]
    D -- "No" --> F["Primary, secondary, tertiary from arguments"]
    E --> G
    F --> G{"Secondary address given?"}
    G -- "No" --> L["Lookup mode: print country and organization, exit 1"]
    G -- "Yes" --> H["Write /etc/resolv.conf"]
    H --> I["Save DNS in the active NetworkManager connection"]
    I --> J["Reactivate the connection, restart network services"]
    J --> K{"Primary address in /etc/resolv.conf?"}
    K -- "Yes" --> M["Print: successfully configured"]
    K -- "No" --> N["Print: failed to configure"]

Lookup mode

When no second address is given, the command runs whois on the first argument and prints two values separated by |:

It changes nothing. The first argument can also be a host name. It needs the whois tool.

How the settings are saved

The command writes the addresses to /etc/resolv.conf first. It then saves them in the first active NetworkManager connection and tells it to ignore DNS servers given by DHCP (ignore-auto-dns). That is the part that survives a reboot. Which settings are saved depends on the addresses:

Addresses Saved in NetworkManager
Three IPv4 ipv4.dns with all three.
Two IPv4 (the provider presets) ipv4.dns with two. The third is saved as ipv6.dns only if it is IPv6 and the server has working IPv6.
Two or three IPv6 ipv6.dns, only if the server has working IPv6.
Any other mix, or IPv6 without working IPv6 Nothing. Only /etc/resolv.conf was written, and NetworkManager will normally overwrite it at the next restart.

Network restarts

After the settings are saved, the command re-activates the connection with nmcli connection up and reloads NetworkManager. Then it restarts services by OS:

OS Restarted
AlmaLinux, Rocky, CentOS, Red Hat, Fedora NetworkManager
Debian NetworkManager, networking, and resolvconf, whichever are running
Ubuntu network-manager, if it is running

Which connection is changed

The command uses the first connection in the output of nmcli connection show --active. On a server with more than one active connection, this may not be the one that carries your traffic.


See also

Command Description
nameservers Change the nameservers for a GoAdmio server
named Reinstall BIND and regenerate all zone files
reversedns Check reverse DNS (rDNS) in GoAdmio
ipv6 Enable, disable, or configure IPv6 on the server
hostname Change the server hostname and set up GoAdmio, mail, and SSL for it
checkmail Test whether outbound mail port 25 works from this server