---
title: nslookup Command Cheatsheet
description: "# The Linux `nslookup` Command The Linux `nslookup` command is a powerful tool for querying DNS (Domain Name System) servers to obtain domain name or IP address mapping information. It helps troubleshoot DNS-related issues and verify configurations. The `nslookup` command…"
url: "https://www.relianoid.com/resources/knowledge-base/misc/nslookup-command-cheatsheet/"
updated: "2025-05-27"
category: Misc
---

# nslookup Command Cheatsheet

# The Linux `nslookup` Command

The Linux `nslookup` command is a powerful tool for querying DNS (Domain Name System) servers to obtain domain name or IP address mapping information. It helps troubleshoot DNS-related issues and verify configurations. The `nslookup` command is widely used for network diagnostics and debugging.

## Key Usage and Syntax of the `nslookup` Command

The basic syntax of the `nslookup` command is:

`nslookup [OPTIONS] [DOMAIN|IP]`

- **OPTIONS**: Additional flags to modify the command’s behavior, such as specifying a DNS server.
- **DOMAIN**: The domain name to resolve to an IP address.
- **IP**: The IP address to resolve to a domain name (reverse lookup).

## `nslookup` Command Cheatsheet Table

| Command | Description |
| --- | --- |
| `nslookup example.com` | Resolve the domain name `example.com` to its IP address. |
| `nslookup 8.8.8.8` | Perform a reverse lookup on the IP address `8.8.8.8`. |
| `nslookup example.com 8.8.8.8` | Query the DNS server `8.8.8.8` for the domain `example.com`. |
| `nslookup -type=MX example.com` | Retrieve the mail exchange (MX) records for `example.com`. |
| `nslookup -type=NS example.com` | Retrieve the name server (NS) records for `example.com`. |
| `nslookup -type=TXT example.com` | Retrieve the TXT records for `example.com`. |

## Interactive Mode

The `nslookup` command supports an interactive mode where users can perform multiple queries in a session.

### Start Interactive Mode

`nslookup`

This command enters interactive mode, allowing you to type queries directly.

### Example Commands in Interactive Mode

- `server 8.8.8.8`: Switch the DNS server to `8.8.8.8`.
- `set type=MX`: Set the query type to mail exchange (MX) records.
- `example.com`: Query the current DNS server for `example.com`.

## Example Queries

### Resolving a Domain Name

`nslookup example.com`

#### Output:

```
Server:  8.8.8.8
Address: 8.8.8.8#53

Non-authoritative answer:
Name:    example.com
Address: 93.184.216.34
```

This output shows that the DNS server `8.8.8.8` resolved `example.com` to the IP address `93.184.216.34`.

### Reverse Lookup

`nslookup 8.8.8.8`

#### Output:

```
Server:  8.8.8.8
Address: 8.8.8.8#53

Non-authoritative answer:
8.8.8.8.in-addr.arpa   name = dns.google.
```

This output shows that `8.8.8.8` is resolved to `dns.google`.

## Advanced Usage

### Querying Specific Record Types

Use the `-type` option to query specific DNS records, such as `MX`, `NS`, or `TXT`:

`nslookup -type=TXT example.com`

#### Output:

```
Server:  8.8.8.8
Address: 8.8.8.8#53

Non-authoritative answer:
example.com   text = "v=spf1 include:_spf.google.com ~all"
```

This output shows the SPF record for `example.com`.

### Specifying a Custom DNS Server

By default, `nslookup` uses the system's configured DNS server. To use a different DNS server, specify it as a second argument:

`nslookup example.com 1.1.1.1`

This queries the `1.1.1.1` server for the domain `example.com`.

## Using `nslookup` with RELIANOID Solutions

In RELIANOID's infrastructure, `nslookup` can be a valuable tool for debugging DNS configurations in load balancer and proxy environments. For example:

### Verify Backend Server DNS Records

`nslookup backend1.realianoid.local`

This ensures that backend servers are correctly resolved in the DNS system.

### Test High Availability DNS Failover

Use `nslookup` to test the resolution of failover IPs configured for RELIANOID's load balancer. Ensure the DNS points to the active server:

`nslookup vip1.realianoid.local`

### Monitor External DNS Providers

For troubleshooting client access, test external DNS providers to verify their response times and records:

`nslookup example.com 8.8.8.8`

## Summary

The `nslookup` command is a versatile tool for network administrators, helping diagnose DNS issues and verify configurations. Whether resolving domain names, performing reverse lookups, or debugging advanced DNS setups, `nslookup` is indispensable for reliable network operations. With RELIANOID’s infrastructure, leveraging `nslookup` ensures seamless DNS functionality and enhances system resilience.

### 📄 Download this document in PDF format
