By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,401 Members | 793 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,401 IT Pros & Developers. It's quick & easy.

Shell Script to Dump all Domain Zone Records?

P: 15
I've been searching the internet for some kind of script that will utilize dig or similar to dump ALL A, CNAME, MX, TXT, etc. records for a given domain. Is there any way to retrieve all of the records and IP addresses without knowing the actual subdomains to query? For example, if I just know "mydomain.com" is there any way to find the A and MX records (and the IPs they point to) for mail.mydomain.com programatically?

My goal is to automate a backup of all the records for a domain before performing a registrar transfer so I can recreate the records identically afterwards.

Does anyone know of an existing tool (or could provide a bit of guidance for a new shell script) that can manage this?

Thanks in advance!
Mar 12 '07 #1
Share this Question
Share on Google+
2 Replies


P: 15
What I'm looking to avoid is having to manually log into the registrar's website and write everything down by hand.
Mar 12 '07 #2

P: 8
What I'm looking to avoid is having to manually log into the registrar's website and write everything down by hand.

using the nslookup command (windows or UNIX) you can get this information.
here is a quick sample script for UNIX (nslookup-dmp.ksh)
usage will be nslookup-dmp.ksh {domain} i.e. yourname.com
Expand|Select|Wrap|Line Numbers
  1. #!/bin/ksh
  2. /bin/echo "The Internet Address of $1..."
  3. /bin/nslookup -q=A $1
  4. /bin/echo "The canonical name for alias for $1..."
  5. /bin/nslookup -q=CNAME $1
  6. /bin/echo "The host CPU and OS Type..."
  7. /bin/nslookup -q=HINFO $1
  8. /bin/echo "The Mail Exchanger for $1..."
  9. /bin/nslookup -q=MX $1
  10. /bin/echo "The Statement of Authority for $1..."
  11. /bin/nslookup -q=SOA $1
  12. /bin/echo "The text information for $1..."
  13. /bin/nslookup -q=TXT $1
  14. /bin/echo "The Well Known Services for $1..."
  15. /bin/nslookup -q=WKS $1 
Mar 21 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.