brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: dig -x turns an IP address back into a name

Dig
~/tips/tip-dns-dig-reverse

dig -x 9.9.9.9 +short

Looks up the hostname that belongs to an IP address (reverse DNS).

Forward lookups get all the attention. Now and then you have an IP address in a log and want to know whose it is.

The -x flag does a reverse lookup. You give dig the address and it builds the in-addr.arpa name for you, so you do not have to reverse the octets by hand.

dig -x 9.9.9.9 +short

It works for IPv6 too. Give it the address and dig builds the ip6.arpa name.

Reverse records are set by whoever owns the address block, usually the ISP or hosting company, and many addresses simply have none. An empty answer does not mean anything is wrong. Also, a reverse name is only a claim: anyone controlling the block can put any name there, so do not treat it as proof of who is on the other end. Good enough for a hint.

Mail servers are the classic reason people care about reverse DNS, because many of them check that the sending address has a matching name. If you run your own mail, this is the first thing to look at, and your hosting provider is the one who can change it.

Further reading: dig manual (BIND 9), On this site: dig can speak DoH and DoT itself, On this site: dig +ttlunits makes TTLs readable

Going deeper: Guide: dig for beginners, look up DNS records and read the answer

More Dig tips dig +noall +answer DS example.com dig nope.iana.org @9.9.9.9 | grep -E 'status|SOA' dig +search nas dig @8.8.8.8 www.google.com +subnet=203.0.113.0/24 dig +yaml example.com A All Dig tips (36) All topics

Link