Overview
When network connectivity falters or domain resolution fails on an Ubuntu workstation or server, nslookup serves as an essential first-line diagnostic utility. This walkthrough breaks down how to interrogate domain name servers, interpret standard responses, filter records by type (including A, MX, and TXT), bypass default resolvers in favor of dedicated public nameservers, and execute reverse pointer lookups during live troubleshooting sessions.
1. Installing nslookup and Running Basic DNS Lookups
Before interrogating any domains, verify whether the utility already resides within your path; if absent, install the standard BIND client tools bundled within the dnsutils package.

At its core, nslookup issues direct queries against configured DNS resolvers to map hostnames to IP addresses or extract specific zone data.
In the terminal output, the Server and Address fields identify the resolver handling your query. The Non-authoritative answer banner clarifies that the response originated from an intermediary caching server rather than the authoritative primary nameserver designated for that zone.
⚙️ [Essential Command Options]
-type=A : Resolves standard IPv4 host addresses.-type=AAAA : Fetches corresponding IPv6 host addresses.-type=MX : Discovers designated Mail Exchange routing targets.-type=NS : Retrieves authoritative Name Server records for the zone.-type=TXT : Pulls arbitrary text attributes, commonly leveraged for SPF policies and domain verification tokens.-type=SOA : Inspects Start of Authority metadata, including serial numbers and zone timers.-type=CNAME : Traces canonical alias pointers back to root hostnames.-type=PTR : Triggers reverse pointer resolution to extract names from raw IP addresses.-debug : Exposes comprehensive packet-level transport logs for query analysis.-timeout=초 : Overrides the default socket response timeout threshold in seconds.

2. Querying Specific Nameservers and Comparing Outputs
Appending an IP address to the lookup command directs the query straight to an external resolver rather than relying on the system’s local stub resolver (/etc/resolv.conf). For instance, querying 8.8.8.8 targets Google Public DNS directly.
The incoming response shows the answering socket (8.8.8.8#53) alongside the active pool of resolved IPv4 endpoints associated with google.com.

Similarly, targeting 1.1.1.1 routes the resolution through Cloudflare’s public resolver infrastructure.
Comparing outputs between different external resolvers frequently highlights localized caching differences, geolocation-based routing pools, and latency variations across global anycast networks.

3. Inspecting Specific Resource Records (MX, TXT, and CNAME)
To isolate inbound mail routing for a target domain, specify -type=mx.
The resulting entry, such as mail exchanger = 10 smtp.google.com., reveals both the recipient relay hostname and its associated preference weight (where lower integers dictate higher delivery priority).

Supplying -type=txt instructs the resolver to pull descriptive text attributes from the domain zone.
In scenarios where the upstream resolver encounters infrastructure breakdowns or communication timeouts with higher-tier authority servers, the lookup returns an explicit SERVFAIL status code indicating an unfulfillable request.

When auditing subdomain routing or domain redirects, -type=cname verifies alias configurations.
An output displaying canonical name = github.com. confirms that www.github.com acts strictly as an alias redirecting network traffic to the primary apex domain.

4. Performing Reverse DNS Lookups via PTR Records
Supplying a raw IP address directly to nslookup triggers a reverse DNS query, mapping the physical address back to its registered fully qualified domain name.
The lookup automatically formats the inquiry within the specialized 8.8.8.8.in-addr.arpa zone, confirming that the target IP belongs to Google’s public resolver hostname dns.google..

Running a matching reverse query against 1.1.1.1 similarly validates Cloudflare’s routing infrastructure.
The resolution yields name = one.one.one.one., confirming a valid reverse pointer record aligned with the public anycast service.

5. Leveraging Interactive Mode and Verbose Debugging
Beyond single-command executions, nslookup provides a dedicated interactive shell capable of parsing dynamic state changes. Pipelining directives into the utility allows you to toggle verbose diagnostic traces (set debug), expand query scopes across all available record types (set type=any), probe a specific host, and cleanly exit.
In debug mode, the command details transaction headers, query question segments, and raw response flags, making it straightforward to isolate root causes—such as a SERVFAIL generated by an internal resolver stub (127.0.0.11#53)—when diagnosing tricky infrastructure outages.

Mastering these nslookup syntax variations equips you to quickly isolate DNS anomalies, verify zone migrations, and ensure correct record propagation across Linux server fleets. Keep these parameters handy whenever you need to debug domain resolution issues in the field.