When working with networking-related activities, querying various domain-related information is really useful. The nslookup command-line utility interactively queries Internet name servers for information and is the most popular utility for these tasks. We will go over many examples and options for the nslookup command in this article.
What is nslookup Command in Linux?
The command nslookup (which stands for "Name Server Lookup") can be used to obtain information from the DNS server. It's a network administration tool that queries the Domain Name System (DNS) for domain names, IP address mappings, and other DNS records. In simple words, if we have a domain name of a website, then to find its IP Address , we can use this command. It can be used to find out many other queries like CNAME, PTR records , etc. It is compatible with a wide range of operating systems , including Linux, Windows, and others. The syntax for this command is
$ nslookup [option]
Options with nslookup command
1. nslookup <website_name>
The IP Address of the domain will be displayed if you type nslookup followed by the website’s name. This command is used to locate a domain's address. It makes a query to domain name servers for getting this result
2. nslookup <IP address> : Reverse DNS lookup
You may also use nslookup to perform a reverse DNS lookup by passing the IP Address as an input and getting the address that uses this address.
3. nslookup -type=any google.com : Lookup for any record
Using the -type=any option, we can see all of the available DNS records.
4. nslookup -type=ns google.com : Lookup for an ns record
The NS (Name Server) record connects a domain name to a list of authoritative DNS servers for that domain. It will return a list of the name servers that are linked to the supplied domain.
5. nslookup -type=mx google.com : Lookup for an mx record
A domain's MX record is a list of mail exchange servers. Mail is routed through MX servers when it is sent to a domain, such as "@gmail.com."
6. nslookup -type=txt google.com : Lookup for an txt record
TXT records are useful for a variety of records, including DKIM, SPF, and others. Using the command below, you may find all TXT entries configured for any domain.
Conclusion
We went over the various options and examples available for the nslookup command in this article. We performed queries like MX server lookup, reverse lookup, txt record lookup, and ns record lookup to see how this command can provide a variety of results.
People are also reading:
Leave a Comment on this Post