nslookup 工具学习

[toc]

Background

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

1
2
nslookup ip
# nslookup www.waylon.one

Lookup IP address to domain name

1
2
nslookup ip
# nslookup 66.249.73.108

Find mail servers for a Domain

1
2
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 缓存中得到的。

References