Detailed explanation of linux nslookup command usage

Detailed explanation of linux nslookup command usage

[Who is nslookup?] 】

The nslookup command is a very commonly used network command in Linux. In short, it is used to check DNS information.

Through man nslookup, you can see that the official explanation of nslookup is "query Internet name servers interactively".

[Who is the author of nslookup?] 】

Using man nslookup, I can see that the author is Andrew Cherenson. I found his LinkedIn page.

He is a computer science whiz who attended Harvard University and the University of California, Berkeley.

Currently working at ChoiceStream,

[The system does not have the nslookup command? 】

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

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

[Two modes of nslookup]

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

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

In "non-interactive mode", users can only obtain a specific name or required information for a host or domain name.

How to enter interactive mode? 】

There are two ways to enter interactive mode.

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

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

How to enter non-interactive mode? 】

If you add the IP or host name you want to query directly after the nslookup command, it will enter non-interactive mode. Of course, at this time you can also set the domain name server you want to connect to in the second parameter position.

1. Function of nslookup

nslookup is used to query DNS records and check whether the domain name resolution is normal. It is used to diagnose network problems when there is a network failure.

2. Query

a. Direct query

nslookup domain [dns-server]
 //If no DNS server is specified, the system default DNS server is used.

b. Query other records

nslookup -qt = type domain [dns-server]

type:
A --> Address Record
AAAA --> Address record
AFSDB Andrew --> File System Database Server Records
ATMA --> ATM address record
CNAME --> Alias ​​record
HINHO --> Hardware configuration records, including CPU and operating system information
ISDN --> ISDN number corresponding to the domain name
MB --> The server where the specified mailbox is stored
MG --> Mail Group Records
MINFO --> Information records of mail groups and mailboxes
MR -->Renamed mailbox records
MX --> Mail server records
NS --> Name Server Record
PTR -> Reverse Record
RP --> Person in charge record
RT --> Routing penetration record
SRV --> TCP Server Information Record
TXT --> text information corresponding to the domain name
X25 --> X.25 address record corresponding to the domain name

c. Query for more specific information

nslookup -d [other parameters] domain [dns-server]   
//When querying, add the -d parameter to query the domain name cache

Examples

[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

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Use nslookup to view all subdomains under a top-level domain
  • nslookup to list secondary domain names

<<:  jQuery implements ad display and hide animation

>>:  A simple example of MySQL joint table query

Recommend

CentOS7 installation zabbix 4.0 tutorial (illustration and text)

Disable SeLinux setenforce 0 Permanently closed: ...

Implementing form submission without refreshing the page based on HTML

Using ajax to implement form submission without re...

A brief discussion on the magical slash in nginx reverse proxy

When configuring nginx reverse proxy, the slashes...

MySQL database query performance optimization strategy

Optimize queries Use the Explain statement to ana...

JavaScript to achieve calendar effect

This article shares the specific code for JavaScr...

How to set underline in HTML? How to underline text in HTML

Underlining in HTML used to be a matter of enclos...

Detailed explanation of the solution to docker-compose being too slow

There is only one solution, that is to change the...

Vite introduces the implementation of virtual files

Table of contents background Importing virtual fi...

Vue uses the video tag to implement video playback

This article shares the specific code of Vue usin...

How to use docker to deploy Django technology stack project

With the popularity and maturity of Docker, it ha...

js realizes the dynamic loading of data by waterfall flow bottoming out

This article shares with you the specific code of...

WeChat applet implements a simple handwritten signature component

Table of contents background: need: Effect 1. Ide...

Three implementation methods of Mysql copy table and grant analysis

How to quickly copy a table First, create a table...

base target="" specifies the target of the base link to open the frame

<base target=_blank> changes the target fram...