Skip to content
DNSdignslookupDNSSEC

How to Check DNS Records of Any Domain

A complete step-by-step guide using dig, nslookup, host, and whois to check every type of DNS record, trace resolution paths, and detect security issues like zone transfers.

⏱ 8 min readπŸ“… Updated September 2026✍️ Zentrion Security Team
πŸ›  Instant Tool: DNS Lookup β†’ β€” Query any DNS record type without installing anything.

What Are DNS Records?

DNS (Domain Name System) records map domain names to IP addresses and configure email, subdomains, and security policies. Think of DNS as the internet's phonebook β€” it translates example.com into 93.184.216.34.

Basic Lookups with dig

dig (Domain Information Groper) is the most powerful DNS query tool available. Install it with sudo apt install dnsutils on Linux or brew install bind on macOS.

# A record β€” IPv4 address for a domain
dig A example.com
dig A example.com +short    # short output, just the IP

# AAAA record β€” IPv6 address
dig AAAA example.com +short

# MX records β€” mail servers (with priority)
dig MX example.com

# NS records β€” authoritative name servers
dig NS example.com +short

# TXT records β€” SPF, DKIM, verification codes
dig TXT example.com

# CNAME record β€” canonical name / alias
dig CNAME www.example.com

# SOA record β€” start of authority (zone info)
dig SOA example.com

# PTR record β€” reverse DNS (IP β†’ hostname)
dig -x 8.8.8.8 +short

# SRV records β€” service location
dig SRV _sip._tcp.example.com

# CAA records β€” which CAs can issue SSL certs
dig CAA example.com

# ALL records (not all servers honour this)
dig ANY example.com

Advanced DNS Commands

# Query a specific nameserver directly
dig A example.com @ns1.example.com
dig A example.com @8.8.8.8     # Google DNS
dig A example.com @1.1.1.1     # Cloudflare DNS

# Trace the full resolution path (root β†’ TLD β†’ authoritative)
dig +trace example.com

# Follow CNAME chain and show answer only
dig +noall +answer example.com

# DNSSEC validation β€” check for RRSIG records
dig +dnssec example.com

# Check for DNS zone transfer (AXFR) β€” security test
dig AXFR example.com @ns1.example.com
# ⚠️ If this returns data, the nameserver is misconfigured

# DNS over HTTPS (DoH) query via curl
curl -H "accept: application/dns-json" \
  "https://cloudflare-dns.com/dns-query?name=example.com&type=A"

Using nslookup

# Basic lookup
nslookup example.com

# Specify record type
nslookup -type=MX example.com
nslookup -type=TXT example.com
nslookup -type=NS example.com
nslookup -type=AAAA example.com

# Query specific DNS server
nslookup example.com 8.8.8.8

# Interactive mode
nslookup
> set type=any
> example.com
> set type=MX
> gmail.com

Using host

host example.com              # A record (default)
host -t MX example.com        # MX records
host -t TXT example.com       # TXT records
host -t NS example.com        # NS records
host -t CAA example.com       # CAA records
host -a example.com           # All records
host 8.8.8.8                  # Reverse lookup

# Zone transfer attempt (should fail on secure servers)
host -l example.com ns1.example.com

DNS Record Types Explained

TypePurposeExample
ADomain β†’ IPv4 addressexample.com β†’ 93.184.216.34
AAAADomain β†’ IPv6 addressexample.com β†’ 2606:2800:220:1::248
CNAMEAlias to another domainwww.example.com β†’ example.com
MXMail server + priority10 mail.example.com
TXTText data (SPF, DKIM, verification)v=spf1 include:_spf.google.com ~all
NSAuthoritative nameserversns1.example.com
SOAZone authority infons1.example.com admin@example.com
PTRReverse DNS (IP β†’ hostname)1.168.192.in-addr.arpa β†’ host1
CAAAllowed SSL certificate authorities0 issue "letsencrypt.org"
SRVService location (port + priority)_sip._tcp 10 20 5060 sip.example.com

Security Checks

# 1. Test for DNS zone transfer vulnerability (should be refused)
dig AXFR example.com @ns1.example.com
# Expected: "Transfer failed" β€” if it returns records = BAD

# 2. Verify DNSSEC is enabled
dig +dnssec example.com | grep -E "RRSIG|DNSKEY"

# 3. Detect DNS hijacking β€” compare results from multiple servers
dig A example.com @8.8.8.8 +short
dig A example.com @1.1.1.1 +short
dig A example.com @9.9.9.9 +short
# All should return the same IP

# 4. Check email security records
dig TXT yourdomain.com | grep "v=spf1"       # SPF
dig TXT _dmarc.yourdomain.com | grep "v=DMARC1" # DMARC
dig TXT selector._domainkey.yourdomain.com   # DKIM

External Resources