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

How to control the proportion of Flex child elements on the main axis

background Flex layout achieves alignment and spa...

SQL implements LeetCode (180. Continuous numbers)

[LeetCode] 180. Consecutive Numbers Write a SQL q...

The pitfall of MySQL numeric type auto-increment

When designing table structures, numeric types ar...

Analysis of Linux boot system methods

This article describes how to boot the Linux syst...

Pure CSS to achieve click to expand and read the full text function

Note When developing an article display list inte...

How to install ZSH terminal in CentOS 7.x

1. Install basic components First, execute the yu...

Simple principles for web page layout design

This article summarizes some simple principles of...

About Vue virtual dom problem

Table of contents 1. What is virtual dom? 2. Why ...

Solution to MySQL connection exception and error 10061

MySQL is a relational database management system ...

Detailed explanation of virtual DOM in Vue source code analysis

Why do we need virtual dom? Virtual DOM is design...

CSS beginner tutorial: background image fills the entire screen

If you want the entire interface to have a backgr...

How to create a MySQL master-slave database using Docker on MacOS

1. Pull the MySQL image Get the latest MySQL imag...

Understanding render in Vue scaffolding

In the vue scaffolding, we can see that in the ne...

Linux redis-Sentinel configuration details

download Download address: https://redis.io/downl...

MySQL Series Database Design Three Paradigm Tutorial Examples

Table of contents 1. Knowledge description of the...