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

Linux platform mysql enable remote login

During the development process, I often encounter...

What does mysql database do

MySQL is a relational database management system ...

How to automatically execute SQL statements when MySQL in Docker starts

When creating a MySQL container with Docker, some...

MySQL 8.0.13 installation and configuration graphic tutorial

Msyql database installation, for your reference, ...

A few front-end practice summaries of Alipay's new homepage

Of course, it also includes some personal experien...

Summary of all HTML interview questions

1. The role of doctype, the difference between st...

Understanding MySQL clustered indexes and how clustered indexes grow

In this note, we briefly describe What is the B+T...

Detailed explanation of how to use the calendar plugin implemented in Vue.js

The function to be implemented today is the follo...

A more elegant error handling method in JavaScript async await

Table of contents background Why error handling? ...

Web page HTML code explanation: ordered list and unordered list

In this section, we will learn about list element...

A detailed introduction to the use of block comments in HTML

Common comments in HTML: <!--XXXXXXXX-->, wh...

Detailed explanation of the execution plan explain command example in MySQL

Preface The explain command is the primary way to...

Make your website automatically use IE7 compatibility mode when browsing IE8

Preface To help ensure that your web pages have a ...

Solution to forgetting the administrator password of mysql database

1. Enter the command mysqld --skip-grant-tables (...