How to use NSLOOKUP command for DNS query on local windows computer?
Before getting into details of how to use NSLOOKUP command on your local windows computer, let us see what exactly this tool is and what is it used for?
What is NSLookup and its usage?
Basically, nslookup is a command-line tool available on your local windows operating systems for querying the Domain Name System (DNS) to diagnose Domain Name and IP address resolutions, this tool is also available on other operating systems like Linux but this article focuses on usage of “nslookup” on windows workstation.
It displays DNS information based on the query you have set and translates the given DNS name into an IP Address(s) and vice versa.
Before you begin to use nslookup tool, you must be familiar and should know the basic concept of how DNS works.
How to use NSLOOKUP?
Open a command prompt on your local windows workstation, basically there are several ways you can use to open a command prompt, the simplest way is go to Start Menu and type CMD. Click on CMD.exe
Now type NSLOOKUP or NSLOOKUP <Domain to query>
When you type nslookup on a command prompt, it first tries to connect to the DNS server configured in your TCP/IP settings on NIC card. If you have issues with your local DNS settings you might encounter an error like the one depicted below.
It is quite possible that there are several DNS servers where you want to check the DNS resolution is working properly, for example: you want to verify the DNS name resolution from a specific DNS server, use the command syntax SERVER <IP of Name of DNS Server> like demonstrated in the below example.
Specifying the syntax SERVER <IP of Name of DNS Server> will change the default server scope to the specified DNS server.
Nslookup query based on specific DNS resource record type
DNS resource record basically defines the types of the Domain Name System (DNS) record.
In the above example when we typed the Domain name google.com, the IP address resulted is the resource record type is A for google.com, so it means that when you do not specify any resource record type in the nslookup query, it result is default to resource record type is A
The following are list of query type you can use in this command.
|A||Specifies,a computer’s IP address.|
|ANY||Specifies,all types of data.|
|CNAME||Specifies,a canonical name for an alias.|
|GID||Specifies,a group identifier of a group name.|
|HINFO||Specifies,a computer’s CPU and type of operating system.|
|MB||Specifies,a mailbox domain name.|
|MG||Specifies,a mail group member.|
|MINFO||Specifies,mailbox or mail list information.|
|MR||Specifies,the mail rename domain name.|
|MX||Specifies,the mail exchanger.|
|NS||Specifies,a DNS name server for the named zone.|
|PTR||Specifies,a computer name if the query is an IP address; otherwise, specifies the,pointer to other information.|
|SOA||Specifies,the start-of-authority for a DNS zone.|
|TXT||Specifies,the text information.|
|UID||Specifies,the user identifier.|
|UINFO||Specifies,the user information.|
|WKS||Describes,a well-known service.|
Using resource record type for nslookup query.
For example, to perform nslookup to query resource record MX for any domain name you can use the MX query as illustrated in the below example
querytype=MX or q=mx
If you notice in the above example the query result is only MX and no other resource type is shown for nslookup querytype MX
Note : You can also use “q” instead of specifying querytype in the nslookup command
Similarly, you can use other DNS resource record type as per your requirement.
Hope this article helps you, for any questions please feels free to comment or contact us