Update 1 Nov 2017. Added Non-interactive examples for documenting or scripting test and verification nslookup commands.
Non-Interactive nslookup examples (for scripting, documentation, and quality testing).
- nslookup -type=CNAME sample.fqdn.com some.dns.server
- type can be any valid DNS record type (AAAA, A, PTR, CNAME, NS, etc)
- substitute your specific query name for the fqdn and target dns server as needed
Using nslookup interactively to verify and debug DNS records.
- server 188.8.131.52
- # point to different DNS server with “server x.x.x.x” command
- # popular public servers include 184.108.40.206, 220.127.116.11, 18.104.22.168, 22.214.171.124 (google & opendns)
- # change lookup record type with “set type=xxx” command
- # important record types include: A, PTR, MX, TXT, CNAME, …
- # reverse IP-to-name records of type PTR have the form below (example IP 192.168.222.111, reverse and append “.in-addr.arpa.”)
- set type=PTR
- # ALWAYS use a trailing dot at the end of fully-qualified-domain-names (FQDN’s)
- set all
- # use “set all” to view current nslookup settings (server, record type, etc)
These examples assume the MS Windows version of nslookup. Most of the syntax will be the same on Linux systems.