DNS records using DIG

Sometimes it may be necessary to get DNS records from a DNS server even if the domain is already pointed at a different DNS server. One tool you can use under linux is called dig. You can use dig to query any DNS server you specify (or use the default nameservers) and get all DNS records from that server. I recently had to do this to help out a customer after they moved their site to our servers and they realized they forgot something on the old server. Problem was, they weren’t sure who the old site was hosted with or what the old IP was. In a matter of minutes I was able to query the old DNS servers and pull up all the DNS information.

Here’s how to use it…


UPDATE 10/21/2013: Apparently the site had enough visitors or people complaining and re-opened it! I did get a response when requesting the DB but unfortunately they would not provide it…BUT at least the site is back online, YAY!

UPDATE 7/9/2013: Unfortunately dnshistory.org has closed, I have contacted them requesting the database to setup another site on one of my servers but have yet to hear back from them.  Can’t seem to find any other sites with as much information, fingers crossed.

So the first thing I had to do in order to pull up the old DNS information was to lookup the DNS history. There is a very nice website you can use to lookup DNS history which is http://www.dnshistory.org. As you can see in the image on the right I was able to determine the old DNS servers for the domain were dns1.taspco.com and dns2.taspco.com. You can also see they provided an A record for the IP but in order to make 100% sure that was the IP listed at the DNS servers I used DIG to find out.

dig @dns1.taspco.com greenvilleturf.com

As you can see above i’m using dig to check dns1.taspco.com for the DNS records of greenvilleturf.com.  The entire output after executing the command looks like this:

dig @dns1.taspco.com greenvilleturf.com
; > DiG 9.3.6-P1-RedHat-9.3.6-20.P1.el5 > @dns1.taspco.com greenvilleturf.com
; (1 server found)
;; global options:  printcmd
;; Got answer:
;; ->>HEADER

smyles 56 4

You can also specify a few arguments to format the output, such as using +short:

dig @dns1.taspco.com greenvilleturf.com +short

You can also use dig to find the CURRENT dns settings for a domain by removing the DNS server you are querying:

dig greenvilleturf.com +short
Source: sMyles