What is nslookup Command?
What is it used for?
How is it used, and what situation could it be applied to?
Firstly, nslookup Command stands for name server lookup, which is good for getting information from the DNS - Domain name system. nslookup command is a tool for network administration that enables us to obtain the DNS, IP addresses, or any other thing that has to do with DNS.
Now, I shall be providing examples of how to use nslookup command.
10 ways to use nslookup command in Linux
Here are the 10 differnet ways you can use nslookup command in Linux. I have tried to include different useful nslookup command line option so that you can use this powerful command more effectively. I normally use nslookup to convert hostname to IP address or IP address to hostname in both Windows and Linux.
1. You can use nslookup with a domain name to get its IP address
$ nslookup google.com
That displays the IP address of google.com which is the domain name.
2. You can use it to get the name server record
$ nslookup -type=ns <URL>
All you need to do is to specify the type and since is it the name server we've got to deal with, that is why you see ns as the type. Then followed by the domain name you have specified.
3. You could do a reverse DNS lookup
What we did at number 1 was that the command with a domain name to get its IP address. But this time around it is the opposite, we want to use the nslookup with an IP address to simply give us its domain.
nslookup 138.341.221.
If there is an IP address as you have typed then the domain name should come from it
4. To View any available DNS record
Still the same option type, you assign any to it then followed by the domain name, by you doing or using any already speaks a lot. It will look up any record of the domain name you have provided. learnex.com is demo of a domain name
$ nslookup -type=any learnex.com
5. How to check the NS record of a domain.
NS record means nameserver record responsible domain name system zone. And the reason why you need an NS record is that the queries of the domain name system respond with a list of name servers. So in that regard, it is mandatory that your DNS zone has proper NS records, Without NS records your Zone will no longer work. Below is the command to check the NS record of a domain. sample.com is a pseudo domain name.
$ nslookup -type=ns sample.com
6. To View SOA record
Another thing you could use nslookup command with is to view the SOA record. SOA means the start of authority. This contains the authoritative information of the domain and the server as well. E.g serial number, address of the administrator, query expiration time, etc. Below is the command to see the domain's SOA record
$ nslookup -type=soa google.com
7. To View Text Records of a domain.
There could be times you need the text record of a particular domain. Text records contain information about the users or information about the domain. To view this information, the command below is used:
$ nslookup -type=txt google.com
8. To View Pointer Record.
Pointer records are used for reverse DNS lookups, (This has been dealt with above) to confirm that the IP address truly belongs to a particular domain name. If you note the option of the type, is "ptr" this reverses the IP address. for instance, 6.2.1.9 becomes 9.1.2.6
$ nslookup - type=ptr [reverse-ip-addrs].in-addrs.arpa
9. To find MX records.
Firstly before you are shown how to do that, you need to know ow what MX record is MX stands for Mail exchanger. So To find or query mail exchanger records means that you are looking for records responsible for email exchange. This is to know if the mail servers are working well and if there is nothing to worry about. The command below helps with that
$ nslookup -query=mx sample.com
10. To change the timeout interval of a server response.
You can manually set the timeout in seconds. If you increase it means you are giving the server more time to respond, You can reduce it as well and still see which server can respond faster. It all depends on how you set it. To run the command, we have the following
$ nslookup -timeout=30 demo.com
In this case, the timeout is set to 30 seconds
No comments:
Post a Comment
Feel free to comment, ask questions if you have any doubt.