Tools for Diagnosing Domain Name Issues

Oftentimes when inheriting a web project you also inherit myriad domain name related issues. And, as always, the command line is your friend for finding quick information associated with that domain name. Here’s a few tools I’ve been using a lot lately:

Whois lookup

A simple whois lookup will give you basic information on a domain name. It’s a good way to check for availability or when a domain name is going to expire. Use it like the following:


If you just want the line for when it expires you can grep your way there:

whois | grep "Registry Expiry Date"

This should print something like the following:

Registry Expiry Date: 2018-08-08T14:10:49Z

Redirect testing with curl

curl is one of those tools that I’m constantly finding uses for. Recently a tech I was working with showed me this trick:

curl -IL

This’ll show you just the headers and the redirect path a domain takes to its final destination. It’s especially helpful for debugging redirect rules on your server. Or in a recent case it helped me diagnose an issue I was having with a forwarding service from an unnamed large registrar.

Anyway, running the above command will show you that going to has one 301 redirect to This is a pretty standard setup (although fascinating to note they don’t redirect to https).

The -L flag asks curl to follow any redirects. Without it it will just return whatever is at the first page. Try a curl request on just with no flags and you’ll see that it returns a terse page:

<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<H1>301 Moved</H1>
The document has moved
<A HREF="">here</A>.

The -I or --head flag fetches “the HTTP-header only!”, according to the man page. This is useful when you don’t care about the page itself, but do care about the headers relating to redirects and IP addresses.

Combine these two flags and you’ll get the chain of redirects to the final resting place when you to to a site.

I also found out that it will give you a response of about any SSL issues you encounter. I was hitting one for my domain that required an nginx restart.

host -a

This allows you to request “all” which theoretically returns any records setup for that hostname. This is most useful on, say, a base @ record so that you can see any of the mx, txt, ns, or other records for it:

host -a

I’ve found that occasionally this doesn’t return everything to you. I need to investigate this more, but my assumption is it’s due to network speeds. If you run this and don’t get all the records you’re expecting it’s worth rerunning. Some nameservers deny this request, but most don’t. They should notify you if they are denying it

If all you need is A record for that hostname you can drop the -a flag.


Shortly after publishing this post Benedict Singer showed me dig!

dig is powerful. From the man page under BUGS it says “There are probably too many query options.” That is true, it seems like it can do almost everything you need related to DNS.

Basic usage let’s you do a similar lookup to host. The result is extremely similar in terms of response time and output:


Adding in any is equivalent to -a for host:

dig any

Drop any and add in +short to only return the IP address for the record you’re looking up:

dig +short

For my purposes one thing that looks interesting is that you can feed it a bunch of domain names from a text file using the -f flag.

dig -f dignames.txt

dignames.txt contains a list of domain names, one per line, and it quickly iterates through them. I could see this being useful for scripting purposes if you wanted to, say, periodically check if an IP had changed on a host record (sometimes these things get changed by maybe not evil, but certainly incompetent, registrars). Adding in +short will also strip out the boilerplate surrounding the response.

This one will show you the “delegation path from the root name servers”:

dig +trace

And this is great for reverse DNS lookups:

dig -x

A non-command line bonus tip:

After you make a change to your host records it can take a while for it to filter out across the internet. For checking to see the status of that change around the globe I like using They have servers around the world that do an host name check and return the results.

This is also a very useful tool to see if your name server is using multiple IP addresses for your host records. Oftentimes if you use a forwarding service or have a parking page put up you’ll run into this.

Any others?

If I missed something you use day to day, please share!

Posted in y