Nslookup command: What it does and how to use it

Nslookup command: What it does and how to use it

July 1, 2024 privacy 0
When you need to fetch a particular DNS record or pinpoint the domain’s IP address, the nslookup command can come to your rescue. With a few simple commands, you can invoke information from your DNS servers to troubleshoot issues or verify configurations. Read on to learn these commands and use them to your advantage. What is the nslookup command? The name server lookup, or nslookup, is a command-line tool created to help you find a particular domain name’s IP address or a domain name system (DNS) record. For instance, if you want to know the IP address of a specific website, you can use the nslookup command to get it. You can also use nslookup for a reverse action – to find a domain name only by knowing its IP address. The nslookup command is typically pre-installed on all major operating systems and is available if the device uses the TCP/IP protocol. What is the nslookup used for? The nslookup command is often used to troubleshoot DNS tasks, test servers, or retrieve specific information about a particular domain. By using different nslookup prompts, you can obtain valuable information about your domains and pinpoint possible issues related to their infrastructure. For instance, you can check if you can reach the host server, whether your domain points to the correct nameservers, or whether emails are routed correctly to your mail server. How to use the nslookup command You can invoke the nslookup command through a command-line interface (CLI) in major operating systems – either Command Prompt on Windows or Terminal on Linux and macOS. However, before putting in the command, you should first decide if you want to use the nslookup in interactive or non-interactive mode. The interactive mode is useful when you need to do a detailed DNS infrastructure analysis or perform in-depth troubleshooting. It’s a preferred mode for network administrators and IT professionals. Meanwhile, the non-interactive mode is ideal for quick lookups and simple queries when you only need a specific piece of information. The main difference between interactive and non-interactive modes is that in interactive mode, you can give numerous commands after the initial one. Meanwhile, you have to start a new session after each command when you’re using a non-interactive mode. Going further, we’ll provide more information and examples on how to invoke nslookup commands in interactive mode, which allows for more flexibility and gives a chance to make query adjustments. {SHORTCODES.blogRelatedArticles} Nslookup: The main commands The nslookup commands are great for getting the basic DNS information of a particular domain. Among the most commonly used commands you can find: Nslookup: The main DNS record types If you’d like to get more detailed information about the domain servers, you may need to use the “set type” commands.
The nslookup command on Linux: Examples Let’s say you want to learn what the IP address of the example.com domain is. You also want to make sure that if the DNS server can’t get this information from the domain itself, it will ask other servers to provide it. In this case, you need to use the “set recurse” command. Open the “Terminal” on your Linux computer. Write “nslookup” in the first line and click “Enter.” The new prompt (>) will appear. Put in the “set recurse” command and click “Enter.” In the following prompt, write in “example.com” and click “Enter” – you’ll see the domain’s IP address. Afterward, the nslookup will open a new prompt so you can enter any follow-up commands. The nslookup command on Windows: Examples The process of using the “set recurse” prompt on Windows is almost identical to the one for Linux, except another program is used – Command prompt. Open the “Command prompt” on your Windows computer. Write “nslookup” in the first line and click “Enter.” The new prompt (>) will appear. Put in the “set recurse” command and click “Enter.” In the following prompt, write in “example.com” and click “Enter” – you’ll see the domain’s IP address.

To check which DNS server you currently use on your Windows device, type the “nslookup” command into the Command Prompt window and press “Enter.” You’ll see the name of the DNS server beside the “Default server” label and its IP address beside the “Address” label.

If you want to do a reverse DNS lookup, you should type the “nslookup” command followed by the IP address of the domain name you want to look up and press “Enter.” You’ll see the domain name beside the “Name” label.

The steps are identical on Linux, except you have to write the commands into the Linux Terminal. ), }, { question: ‘How do I specify a DNS server in nslookup?’, answer: ( The nslookup tool uses your computer’s DNS server by default. However, you can change the DNS server by specifying it in the command line. To do that, type in the “nslookup” command, click “Enter,” and type in “Server” with either the domain name or the desired DNS server inside the brackets. For example:

>nslookup
>server <example.com>

or

>nslookup
>server <1.1.1.1> ), }, { question: ‘What is the difference between nslookup and DNS lookup?’, answer: ( A DNS lookup resolves domain names to their corresponding IP addresses, allowing devices to connect to websites and services on the internet. Meanwhile, nslookup is a command-line tool for manually diagnosing DNS issues, verifying DNS configurations, and gathering DNS information. ), }, { question: ‘What is the difference between an authoritative and non-authoritative answer?’, answer: ( When you get an authoritative answer in the nslookup tool, it means the response was fetched directly from the domain’s own DNS server. The non-authoritative answer means it was retrieved from the DNS server’s cache and not directly from the domain’s DNS server. ), }, ]} />

The post Nslookup command: What it does and how to use it first appeared on NordVPN.

 

Leave a Reply

Your email address will not be published. Required fields are marked *