How to use nslookup for DNS records and troubleshooting
Nslookup is a command-line tool for asking a DNS server about a domain or an IP address. It helps distinguish a name-resolution issue from a problem with a website or mail service. Its answer depends on the chosen resolver and its cache; it is not necessarily the authoritative source.
Choosing a record type
A and AAAA records provide IPv4 and IPv6 addresses. MX records identify mail exchangers; NS records list nameservers; TXT records carry text used by several protocols. A reverse lookup of an IP address asks for a PTR record, if one exists. A missing record of one type does not mean the whole domain is missing.
A DNS answer can contain more than one address, and the selected address may vary by resolver or location. A CNAME is an alias for another name, not an IP address itself. Read the type as well as the value before changing website, email or security settings.
Commands to try
Run nslookup example.com to ask the configured resolver for address records. Use nslookup -type=MX example.com 1.1.1.1 to request MX records from a specific server. Replace the reserved example domain with your own when troubleshooting and choose a resolver permitted by your network policy.
For a reverse lookup, provide the IP address as the query. A PTR result describes a name configured for that address; it does not independently verify who operates the host. Query another resolver or the authoritative nameserver if two answers disagree.
Interpreting an unexpected answer
Resolvers may cache earlier records until their TTL expires. After a DNS change, different resolvers can temporarily return different results. A timeout can mean the queried server is unreachable, blocked or slow; it does not prove the domain has no records. NXDOMAIN indicates that the queried name was reported nonexistent by that resolver.
Compare the current authoritative configuration, the resolver used by the affected client and the expected record. Verify spelling and any subdomain. When a website fails, test direct connectivity after DNS resolution; a correct address record cannot guarantee that the web server or TLS configuration works.
For mail troubleshooting, check the MX target name separately and confirm that it resolves to an address. Do not confuse the MX preference number with a performance score: smaller values indicate higher priority, while delivery also depends on the receiving mail server being available.
