About the command to query the domain name in the DNS service


1. Domain name and DNS

  • domain name
    • Each host in the network has a unique and fixed IP address to distinguish thousands of users and computers on the network. Since the IP address is a digital identifier, it is difficult to remember and write when used, so a symbolic address scheme has been developed on the basis of the IP address to replace the digital IP address. Each symbolized address corresponds to a specific IP address, which makes it much easier to access resources on the network. This character address corresponding to the numeric IP address on the network is called a domain name.
  • DNS
    • DNS (Domain Name System) is a service of the Internet. As a distributed database that maps domain names and IP addresses to each other, it can make it easier for people to access the Internet. DNS uses TCP and UDP port 53. Currently, the limit on the length of each level of domain name is 63 characters, and the total length of the domain name cannot exceed 253 characters.

Second, the command to query DNS

1 、 dig

①、Introduction

The full name of the dig command is "domain information groper". It is a tool for flexibly querying DNS. It will print out the response of the DNS domain name server. The dig command is mainly used to query the host address information from the DNS domain name server.

②, format

Insert picture description here

③, parameters

parameter Description
@ Specify the domain name server for domain name resolution
-b Use the specified local IP address to send a domain name query request to the domain name server
-f Specify dig to run in batch mode, and the specified file saves the DNS task information that needs batch query
-p Specify the port number used by the domain name server
-t Specify the type of DNS data to be queried (default is A)
-x Perform reverse domain name lookup
-4 Use ipv4 (default)
-6 Use ipv6
-h Display command help information

④ Examples

Insert picture description here

2、 host

①、Introduction

The host command is a simple utility for performing DNS lookups. It is usually used to convert names to IP addresses and vice versa. If no parameters or options are given, the host will print a short summary of its command line parameters and options.

②, format

Insert picture description here

③, parameters

parameter Description
-a Display detailed DNS information
-c Specify the query type, the default value is "IN"
-C Query the complete SOA record of the specified host
-r Do not use recursive query method to query domain names
-t Specify the type of domain name information to be queried
-v Show detailed information about command execution
-w If the domain name server does not give a response message, it always waits until the domain name server gives a response
-W Specify the maximum time for domain name query, if the domain name server does not give a response message within the specified time, exit
-4 Use IPv4 query transmission (default)
-6 Query transmission using IPv6

④ Examples

Insert picture description here

3、nslookup

①、Introduction

  • The nslookup command is mainly used to query the DNS information of a domain name. Before using nslookup, make sure that it has been installed. nslookup belongs to the next command of the bind-utils package.

  • nslookup has two working modes: "interactive mode" and "non-interactive mode". Enter nslookup directly in the command line, and enter the interactive mode without entering any parameters, and it will be prompted by ">".

②, format

Insert picture description here

③, parameters

parameter Description
-sil Do not display any warning messages
exit Exit command
server Specify the server address that resolves the domain name
set type=soa Set query domain name authorization start information
set type=a Set query domain name A record
set type=mx Set up query domain name mail exchange records

④ Examples

Insert picture description here

Guess you like

Origin blog.csdn.net/Lucien010230/article/details/114006973