Using nslookup to Test DNS

The nslookup command can be used to get the associated IP address for your domain and vice versa. The nslookup command is very easy to use; you just need to type the command followed by the IP address or Web site name you want to query.
The command actually queries your DNS server for a response, which is then displayed on the screen. Failures can be caused by your server not having the correct value set in the /etc/resolv.conf file, poor connectivity to your DNS server, or an incorrect configuration on the DNS server.

Using nslookup to Check Your Web site Name

nslookup http://www.mynetwork.com

should return something like:

Name: http://www.mynetwork.com
Address: xx.yy.zz.nn

Using nslookup To Check Your IP Address
The nslookup command can operate in the opposite way in which a query against the address xx.yy.zz.nn returns the Web site named http://www.mynetwork.com:

nslookup xx.yy.zz.nn

should return something like

Non-authoritative answer:
92.193.151.216.in-addr.arpa name = extra193-92.myisp.net.

Authoritative answers can be found from:
193.151.216.in-addr.arpa nameserver = dns1.myisp.net.
193.151.216.in-addr.arpa nameserver = dns2.myisp.net.
dns1.myisp.net internet address = 216.151.192.1

Using nslookup to Query a Specific DNS Server
Sometimes you might want to test the DNS mapping against a specific DNS server, with the address qq.rr.ss.tt. This can be achieved by adding the DNS server’s IP address immediately after the IP address of the Web site name you intend to query.

nslookup http://www.mynetwork.com qq.rr.ss.tt

The result should look like

Server: qq.rr.ss.tt
Address: qq.rr.ss.tt#53

Name: http://www.mynetwork.com
Address: xx.yy.zz.nn

Advertisements
  1. Exactly how much time did it require u to compose “Using nslookup to Test DNS
    Ubuntu&Pogoplug howtos”? It provides a great deal of good tips.
    Many thanks -Kristie

    • I’m thinking it was a couple hours at most–actually I don’t remember. I spent a lot more time trying to figure out how to use the tool and wanted to make sure I wouldn’t have to relearn it the next time I built a DNS server.

  2. I have another issue which shows up using nslookup. After hibernating my PC and then plugging the PC back into the local network at work, nslookup reports the wrong IP address for my PC. I’ve petiently waited to see if this fixes itself, I’ve also tried flushing and reregistering the DNS using ipconfig but to no avail. Therefore anyone trying to eg. remote control my PC, can’t as the wrong IP address is assciated to my PC name on the network. Is there a tool that can ensure the ip address is correctly reported without say having to eg. disconnect / reboot the PC (as this is the only way I find it will resolve it at the moment)?

    Thanks in advance for your replies.

    Rodp

    • Assuming you are running the Unity desktop ( with network-manager), try this:

      Left click on the network connection icon in the system tray which should be on the right side of the Unity top bar. Note: the system tray may be somewhere different if you are running Gnome desktop, Xubuntu or something else. Anyway when the menu opens, select disconnect then left click on the icon again and select connect.

      If this does not work, open select the icon once more, then select “edit connections” and open the ipv4 tab. Tell me what you see at that point.

      Also, assuming you are running 12.04 or newer, even if you get your ip address reset you may still have an issue with dnsmasq-base…I’m just not sure… If so follow the instructions on this site for disabling dnsmasq.

      None of this will work if you have edited your /etc/interfaces file and added an entry for your ethernet port. If you have done that I’ll need to see a copy of that file.

  3. Ah! Sorry I must apologise that I’m infact running windows XP / 7 so it’s not an actual ubuntu query but i would say that it’s a general TCP/IP / DHCP issue that probably both windows and linux users may experience. The current way I resolve this is by using command line ipconfig /release, then ipconfig /renew but that means someone has to be at the PC to do this. I’m looking for an automated solution which will encourage the DNS to be updated with the real IP address if when doing nslookup it doesn’t match what the true PC’s IP address. Any ideas / experience with this or similar issues would be most welcome. Could it be something as simple as setting up some sort of schedule which runs a batch or vb script file to cross reference the nslookup result and ipconfig IP result and if they don’t match run the ipconfig commands?

    Thanks

    Rodp

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: