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

Docker link realizes container interconnection

Table of contents 1.1. Network access between con...

Pure js to achieve the effect of carousel

This article shares the specific code of js to ac...

How to use IDEA to configure tomcat and create JSP files

Before using idea to write JSP files, you need to...

A Preliminary Study on Vue Unit Testing

Table of contents Preface Why introduce unit test...

CSS3 realizes the mask barrage function

Recently I saw a barrage effect on B station call...

Vue uses canvas handwriting input to recognize Chinese

Effect picture: Preface: Recently, I was working ...

Vue implements drag progress bar

This article example shares the specific code of ...

How to use jconsole to monitor remote Tomcat services

What is JConsole JConsole was introduced in Java ...

Vue3.0 handwriting magnifying glass effect

The effect to be achieved is: fixed zoom in twice...

Steps to deploy Spring Boot project using Docker

Table of contents Create a simple springboot proj...

Answers to several high-frequency MySQL interview questions

Preface: In interviews for various technical posi...

How to install docker using YUM

As shown in the following figure: If the version ...

MySQL full-text search Chinese solution and example code

MySQL full text search Chinese solution Recently,...

Sample code using scss in uni-app

Pitfalls encountered I spent the whole afternoon ...