18

I have configured a set of DNS records at a new DNS provider. The configuration is complex, with load-balancing, SSL, etc, there are things that could go wrong.

I want to test this configuration before changing the namespace records at registrar.

  • Is there any way to locally provide my machine with the new nameserver for the domain?
  • Are there any tools that might help with this?

Please note: I don't want to just update the A records (e.g. in /etc/hosts) - I want to specifically check the nameserver is returning the A and CNAME records.

iHiD
  • 2,450
  • 20
  • 32

2 Answers2

28

If you're on a *nix system, you should be able to use either nslookup or dig. With both of those commands you can specify what server you would like to query. Simply use your new nameserver as the server. With dig, the query would look something like

dig @<your-nameserver> <hostname-to-look-up>

So, if you wanted to query google's public dns server and ask it about the address www.google.com, you'd use

dig @8.8.8.8 www.google.com

which, amongst other things, would tell you that www.google.com is an alias for www.l.google.com -- and then would give you a bunch of IP address (A records) for that name.

Jonathan
  • 405
  • 4
  • 9
  • Brilliant, thanks. Could you maybe update your answer with the correct command with dig (dig @ns1.google.com www.google.com). Thanks. – iHiD Jun 01 '12 at 17:10
  • 1
    @iHiD `8.8.8.8` is a valid DNS server. The answer is right. – TCB13 Feb 28 '14 at 21:31
  • 2
    @TCB13 Yeah. He hadn't got that there when I commented :) (http://stackoverflow.com/posts/10854369/revisions) – iHiD Mar 02 '14 at 16:58
  • Windows `dig`?? – Petah Dec 07 '16 at 09:57
  • @Petah, simply, idk. The only Windows box I have access to right now (Win7) seems to not have it, not have it installed, or not have it in PATH: `'dig' is not recognized as an internal or external command, operable program or batch file.` – Jonathan Dec 08 '16 at 10:47
  • 2
    @Petah for Windows use nslookup as in `nslookup ` You can get more verbose information by using the debug flag as in `nslookup -debug google.com 8.8.8.8` – Steve S. Jan 10 '17 at 19:43
1

For both Windows and my remote Linux(CentOS) servers I use nslookup tool which works on both platforms:

nslookup new-sub.domain.com 8.8.8.8
// and for more details:
nslookup -debug new-sub.domain.com 8.8.8.8
Mojtaba Rezaeian
  • 8,268
  • 8
  • 31
  • 54