askvity

How to nslookup a Website?

Published in Networking Basics 3 mins read

To nslookup a website, you use the nslookup command in your command-line interface to query Domain Name System (DNS) servers and retrieve information about the specified domain.

Here's how you can do it:

  1. Open the Command Line Interface:

    • Windows: Open the "Command Prompt" or "PowerShell." You can find it by searching for "cmd" or "powershell" in the Start Menu.
    • macOS: Open "Terminal" found in /Applications/Utilities.
    • Linux: Open your preferred terminal application.
  2. Enter the nslookup Command:

    Type nslookup and press Enter. This will switch the command line to nslookup's interactive mode.

  3. Enter the Domain Name:

    Type the domain name of the website you want to look up (e.g., example.com) and press Enter.

    The output will display information such as:

    • Server: The DNS server being used.
    • Address: The IP address of the DNS server.
    • Name: The domain name you queried.
    • Address: The IP address associated with the domain name. This is the primary piece of information you are likely seeking.

Example:

nslookup
> example.com
Server:  dns.google
Address:  8.8.8.8

Non-authoritative answer:
Name:    example.com
Address: 93.184.216.34

Using nslookup Directly (Non-Interactive Mode):

You can also use nslookup directly from the command line without entering interactive mode by typing nslookup followed by the domain name:

nslookup example.com

This will provide the same output as above, but without entering nslookup's interactive mode.

Specifying a DNS Server (Optional):

If you want to query a specific DNS server, you can specify it after the domain name:

nslookup example.com 8.8.8.8

In this example, 8.8.8.8 is Google's public DNS server.

What Information Can You Get?

nslookup can provide you with various DNS records, including:

  • A records: Address records that map a domain name to an IPv4 address.
  • AAAA records: Address records that map a domain name to an IPv6 address.
  • CNAME records: Canonical name records that create aliases for domain names.
  • MX records: Mail exchange records that specify the mail servers responsible for accepting email messages on behalf of a domain.
  • NS records: Name server records that delegate a DNS zone to use the given authoritative name servers.

You can request specific record types using the set type= command within the interactive mode of nslookup. For example, set type=mx will only show the MX records.

In summary, nslookup is a valuable tool for querying DNS servers and retrieving information about domain names, enabling you to troubleshoot network issues, verify DNS configurations, and understand how domain names are resolved to IP addresses.

Related Articles