Startpagina > Netwerkbeheer > nslookup

nslookup: DNS server query

nslookup is a command-line tool used to query Domain Name System (DNS) servers to obtain domain name or IP address information. It supports interactive and non-interactive modes, and you can also specify a particular DNS server for queries.

Overview

nslookup is used to check the mapping between domain names and IP addresses, or to query specific DNS records (MX, NS, A, etc.). It is mainly used for DNS troubleshooting and network diagnostics.

Key Features

  • Query domain-IP address mapping
  • Query specific DNS records (A, MX, NS, etc.)
  • Query with a specified DNS server
  • Supports interactive/non-interactive modes

Main Options

In addition to command-line options, nslookup allows setting various options using the `set` command in interactive mode.

Query Type and Debug

Specify Server

Gegenereerde opdracht:

Probeer de opdrachtcombinaties.

Uitleg:

`nslookup` Voer het commando uit.

Combineer deze opties en voer de opdracht virtueel uit met de AI.

Usage Examples

Various usage examples of the nslookup command.

Basic Domain Information Query

nslookup example.com

Queries the IP address of the specified domain.

Query Using a Specific DNS Server

nslookup example.com 8.8.8.8

Queries domain information using Google Public DNS (8.8.8.8).

Query Mail Exchanger (MX) Records

nslookup -type=mx example.com

Queries the mail server information for a domain.

Enter and Use Interactive Mode

nslookup
> server 8.8.8.8
> example.com
> exit

Runs nslookup in interactive mode and then performs queries using internal commands.

Query Domain Name from IP Address (Reverse Lookup)

nslookup 192.0.2.1

Queries the domain name corresponding to an IP address.

Installation

nslookup is included by default in most Linux distributions or provided as part of the DNS utilities package. If it is not installed, you can install it using the following commands.

Debian/Ubuntu

sudo apt update && sudo apt install dnsutils

Installs the dnsutils package using the apt package manager.

CentOS/RHEL/Fedora

sudo yum install bind-utils
# or
sudo dnf install bind-utils

Installs the bind-utils package using the yum or dnf package manager.

Tips & Precautions

Useful tips and points to note when using nslookup.

Consider the dig Command

While nslookup is still widely used, the `dig` command provides more powerful and detailed DNS information and is more suitable for scripting. It is recommended to use `dig` along with nslookup for DNS troubleshooting.

  • `dig` supports more DNS record types
  • `dig` provides detailed response information
  • `dig` has an output format that is easy to parse in scripts

Utilize Interactive Mode

Interactive mode is convenient for performing multiple queries. You can type `help` in interactive mode to see available internal commands.

  • `set type=mx` (Set to query MX records)
  • `server 1.1.1.1` (Change the DNS server to query)
  • `exit` (Exit interactive mode)

gerelateerde commando's

Functional vergelijkbare of vaak samen gebruikte commando's.


Hétzelfde categoriecommando