Explanation of linux nslookup Command

  • 2021-07-10 21:27:31
  • OfStack

"Who is nslookup?"

nslookup command is a very common network command in Linux, in short, it is "used to check DNS information".

It can be seen from man nslookup that the official explanation for nslookup is "query Internet name servers interactively".

"Who is the author of nslookup?"

Through man nslookup, we can see that the author is Andrew Cherenson, and I found his Linkedin homepage, which turned out

He is a high flyers of computer science. He studied at Harvard University and the University of California, Berkeley.

Currently working for ChoiceStream Company,

"The system doesn't have an nslookup command?"

If your Linux system does not have the nslookup command, then you probably do not have the bind-utils package installed.

The problem can be solved directly by yum install bind-utils.

"Two modes of nslookup"

nslookup is a program that can query Internet domain name server information. He has two working modes, namely "interactive mode" and "non-interactive mode".

In the "interactive mode", users can query the information of various hosts and domain names from the domain name server, or output the host list in the domain name.

In the "non-interactive mode", users can only get specific names or required information for one host or domain name.

"How to enter interactive mode?"

There are two ways to enter interactive mode.

In the first method, enter the nslookup command directly without adding any parameters, and then enter the interactive mode directly. At this time, nslookup will connect to the default domain name server (that is, the first dns address of/etc/resolv. conf).

The second method supports selecting different domain name servers. You need to set the first parameter to "-", and then the second parameter is to set the host name or IP address of the domain name server to connect to.

"How to enter non-interactive mode?"

If you add the IP or hostname to be queried directly after the nslookup command, you are in non-interactive mode. Of course, at this time, you can also set the domain name server to be connected in the second parameter position.

1. nslookup action

nslookup is used to query the records of DNS, query whether the domain name resolution is normal, and diagnose network problems when the network fails

2. Query

a. Direct query


nslookup domain [dns-server]
 // If you do not specify dns Server, the system default dns Server. 

b. Query other records


nslookup -qt = type domain [dns-server]

type:
A -- > Address record
AAAA -- > Address record
AFSDB Andrew -- > File system database server record
ATMA -- > ATM Address Record
CNAME -- > Alias record
HINHO -- > Hardware configuration record, including CPU, operating system information
ISDN -- > ISDN number corresponding to domain name
MB -- > The server that holds the specified mailbox
MG -- > Message group record
MINFO -- > Message records for message groups and mailboxes
MR -- > Renamed mailbox record
MX -- > Mail server records
NS -- > Name server record
PTR - > Reverse recording
RP -- > Person in Charge Record
RT -- > Routing penetration record
SRV -- > TCP Server Information Record
TXT -- > Text information corresponding to domain name
X25 -- > X. 25 address record corresponding to domain name

c. Query more specific information


nslookup -d [ Other parameters ] domain [dns-server]   
// Just add when querying -d Parameter, you can query the cache of domain name 

Instances


[root@localhost ~]# nslookup www.jsdig.com
Server:     202.96.104.15
Address:    202.96.104.15#53

Non-authoritative answer:
www.jsdig.com canonical name = host.1.jsdig.com.
Name:  host.1.jsdig.com
Address: 100.42.212.8

Related articles: