Linux networking cheatsheet

Linux networking: DNS

8 common Linux networking tasks.

Look up a record

Query A records. Add AAAA, MX, TXT or NS for other types.

dig example.com A

Get just the answer

Print only the answer values.

dig +short example.com

Query a specific DNS server

Ask a particular resolver, to compare answers.

dig @1.1.1.1 example.com

Trace DNS from the root

Follow delegation from the root servers to the authoritative answer.

dig +trace example.com

Find the name for an IP address

Do a reverse DNS lookup for an address.

dig -x 8.8.8.8 +short

Show the system resolver

Show DNS servers per interface on systems using systemd-resolved.

resolvectl status

Flush the DNS cache

Clear systemd-resolved's cache.

sudo resolvectl flush-caches

Override a name locally

Point a host name to an address on this machine only, in /etc/hosts.

127.0.0.1  myapp.test

Was this page helpful?