In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to query the address of DNS server in Linux". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to query the DNS server address in Linux.
The nslookup program is the main diagnostic tool for DNS services, which provides the ability to perform DNS server query tests and get detailed information. Use nslookup to diagnose and resolve name resolution problems, check that resource records are correctly added or updated in the zone, and troubleshoot other server-related issues. The function of the nslookup command is to query the IP address of a machine and its corresponding domain name. It usually requires a domain name server to provide domain name services. If the user has set up a domain name server, you can use this command to view the domain name corresponding to the IP address of different hosts.
Pattern
Nslookup has two modes of operation: non-interactive and interactive.
Non-interactive is usually used in cases where a single block of data is returned, with the command format:
Domain name [DNS server address] queried by nslookup [- option]
If nslookup is not specified to use the DNS server address, nslookup uses / etc/resolv.conf. The file defines the DNS service for query. After the non-interactive nslookup program is run, it is returned to the Shell prompt. If you want to query another record, you need to re-execute the program
Interaction is usually used in cases where multiple blocks of data are returned, and the command format is:
Nslookup [- DNS server address]
If nslookup is not specified to use the DNS server address, nsookup uses / etc/resolv.conf. The DNS service defined by the file is queried. Run the interactive nslookup program, you will enter the nslookup program prompt ">", and then you can enter various commands of nslookup, domain names to be queried, or reverse parsed IP addresses after ">". After querying a record, you can then enter a new query after >, and use the exit command to exit the nslookup program. Because testing DNS servers often requires continuous query of multiple records, more interactive nslookup programs are actually used.
Main usage
1. Test host address A resource record
After entering the nslookup program, the default query type is the host address. Directly entering the fully standardized domain name to be tested under the nslookup program prompt ">" FQDN,nslookup will display the name and IP address of the current DNS server, and then return the IP address corresponding to the fully standardized domain name FQDN.
Test reverse parse pointer PTR resource record
Enter the IP address to be tested directly at the nslookup program prompt ">", and nslookup will return the fully standardized domain name FQDN corresponding to the IP address.
two。 Test alias CNAME resource record
Under the nslookup program prompt ">", use the command "set type=cname" to set the type of query to alias, then enter the alias to test, and nslookup will return the corresponding real computer.
3. Test mail exchanger MX resource records
Under the nslookup program prompt ">", use the command "set type=mx" to set the query type to mail exchanger, and then enter the domain name to be tested, and nslookup will return the corresponding mail exchanger address.
4. Test initiation Authorization SOA Resource record
Under the nslookup program prompt ">", use the command "set type=soa" to set the query type to the starting authority, and then enter the domain name to be tested, and nslookup will return the corresponding SOA resource record content.
5. Test name server NS resource record
Under the nslookup program prompt ">", use the command "set type=ns" to set the query type to the name server, then enter the domain name to be tested, and nslookup will return the corresponding name server address.
6. Test load balancing
To test the load balancer, the query type needs to be the host address. If the current query type is not the host address, you should first use the command "set type=a" under the nslookup program prompt ">" to set the query type to the host address, and then enter the fully standardized domain name FQDN,nslookup of the load balancer to test. All the corresponding IP addresses will be returned.
7. Set the default local dns server
Set domain=8.8.8.8
8. Test direct resolution of domain name
To test the direct resolution domain name, the query type needs to be the host address. If the current query type is not the host address, use the command "set type=a" under the nslookup program prompt ">" to set the query type to the host address, and then enter the direct resolution domain name to be tested, and nslookup will return the IP address corresponding to the domain name.
9. Test pan-domain name
The test pan-domain name needs to be queried with a host address. If the current query type is not a host address, use the command "set type=a" under the nslookup program prompt ">" to set the query type to the host address, and then enter the domain name of any host name (there is no corresponding A record). For each domain name of any host name, nslookup will return the same IP address.
10. Test external Internet domain name
In addition to testing the zone data of the local DNS server, test whether the DNS server can resolve the external: Internet domain name (you need to ensure that the DNS server can connect to the Internet), that is, to test whether the root zone defined by the named.conf file is correct. Entering the fully standardized domain name FQDN,nslookup on Internet such as www.baidu.com at the nslookup program prompt ">" will return the corresponding IP address.
Small example
1. The most basic usage
The code is as follows:
[root@rudder ~] # nslookup baidu.com
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
Name: baidu.com
Address: 123.125.114.144
Name: baidu.com
Address: 220.181.111.85
Name: baidu.com
Address: 220.181.111.86
2.nslookup, interactive mode, view dns
The code is as follows:
[root@rudder ~] # nslookup
> www.baidu.com
Server: 172.17.0.254
Address: 172.17.0.254#53
Non-authoritative answer: # non-authoritative answer, indicating that it was read in the cache
Www.baidu.com canonical name = www.a.shifen.com.
Name: www.a.shifen.com
Address: 61.135.169.105 # return the first IP address
Name: www.a.shifen.com
Address: 61.135.169.125 # returns the second IP address
The code is as follows:
> server 8.8.8.8 # set the domain name server to 8.8.8.8
Default server: 8.8.8.8
Address: 8.8.8.8#53
The code is as follows:
> www.baidu.com # request Baidu's IP address again
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
Www.baidu.com canonical name = www.a.shifen.com.
Name: www.a.shifen.com
Address: 220.181.111.147 # different DNS obtain different IP addresses.
At this point, I believe you have a deeper understanding of "how to query the DNS server address in Linux". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.