nslookup 工具学习



Recently, I found my website was visited by a set of IPs from the same region (Mountain View), as shown below. Without thought, I deemed my website was suffering from hacker attacks or somebody's dig.

I was a little anxious and regretted that sharing some personal private information on my website. I built this website on sharing my own experience and learned knowledge to the masses and storing individual materials for my convenient use. I previously did not believe somebody would spare no effort to my website.

Take it easy. I later found that these visitors are from Google's robotic crawler using an excellent tool -- nslookup, but I still decided to delete all personal information to protect my privacy.

What's nslookup

nslookup, name server lookup, is a network administration command-line tool available in many computer operating systems (like MacOs, Linux and Windows) for querying the Domain Name System (DNS) to obtain domain name or IP address mapping, or other DNS records.

  • The command does not use the operating system's local Domain Name System resolver library to perform its queries, and thus may behave differently from dig, which does.

How to use

Find the IP address of an Host

nslookup ip
# nslookup www.waylon.one

Lookup IP address to domain name

nslookup ip
# nslookup

Find mail servers for a Domain

nslookup  -querytype=mx  domain-name
# nslookup -querytype=mx 163.com

Non-authoritative answer (非权威应答)

You may notice that you get non authoritative answers. This is nothing to worry about as all it means is that the DNS server has already recently resolved this query. It can retrieve the results from cache, and doesn’t need to contact the authoritative name server.

当你看到 “non-authoritative answer”,意味着你本地的 DNS 服务器之前访问过这个网址,这次查询直接是从本地 DNS 缓存中得到的。