The nslookup utility has been around for a long, long time in Windows. It was handy to do simple lookups and see if a DNS entry was a CNAME or A record. You can also check on the MX records for a domain. Really it can do just about any lookups you want to do, but I quickly became frustrated with the multiple lines that had to be typed out to get the results you wanted. For instance, a simple use might look something like this (click the image for larger version):
- Type ‘nslookup’
- At the prompt, type ‘set q=mx’ to tell nslookup you’re looking for MX records
- At the prompt, type ‘jdsnow.net’ to tell nslookup to return MX records for the jdsnow.net domain.
While this works, it has become very dated. In most (if not all) Linux distributions, a utility called ‘dig’ was introduced a good while back. To do the same lookup, you can send a single command to dig, and it gives you everything you need:
- At a command prompt, type ‘dig jdsnow.net mx’
See? Far fewer steps. Dig is pretty powerful that way. It’s way more powerful than that, though. I’ll tell you more about it at the end of the post. For now, you’re probably saying, “That’s cool that it comes by default in Linux…but how do I get it in Windows?” I’m glad you asked…
Head over to www.isc.org/downloads. Once there, expand the “BIND” section toward the bottom of the page. Download whatever version is stable (9.9.5 at the time of this writing). I recommend downloading the .zip format rather than tar.gz, unless you know what you’re doing. Once downloaded, extract the zipfile – we’ll need to get just a few of the files in there.
Take note: if you want, you can copy these files to C:\Windows\system32. This will put them in your current search path for executable files. I personally prefer to put them in a separate folder, say, C:\Tools, and add that folder to my PATH environment variable. Wherever you choose to put them, here are the steps you’ll need to follow:
- Copy ALL of the .dll files to your chosen location
- Copy the dig.exe file to your chosen location
- Run the ‘vcredist_x86.exe’ file – this will install Microsoft’s C++ package, allowing dig.exe to run.
- Finally, if you chose to put the DLL files and dig.exe in a location besides C:\Windows\system32, set your PATH variable. Right-click ‘My Computer’ (or just Computer if you’re in Windows 7), and click Properties. Click ‘Advanced system settings’, then click the Environment Variables button at the bottom. Under System variables, scroll down the list until you find the PATH variable. Select it, then click the Edit button. You’ll see quite a bit of text in the “Variable value” text box – go all the way to the end, and add “;C:\Tools”, or whatever folder you chose to put the files. (The leading semicolon (;) is important!).
Now you should be ‘dig’ging in Windows! To get a full list of options for the command, type ‘dig -h’ and enjoy reading. See how much better this is than nslookup?