← Blog  ·  October 2026

Monitor DNS A Record Changes: Detect Unauthorized or Unexpected Changes

Your A record pointed to 203.0.113.42 this morning. Does it still? You probably don't know.

A DNS A record maps a domain name to an IPv4 address. It's how browsers find your server, how email finds your MX host, and how your infrastructure routes traffic to the right place. When an A record changes unexpectedly — whether from a registrar compromise, a CDN misconfiguration, a provider failover, or a simple operator error — the impact is immediate and often silent: traffic redirects, services break, and users see either a blank page or, in the worst case, content served from somewhere you don't control.

DNS A record monitoring is the practice of continuously comparing your current A record values against a known-good baseline and alerting the moment a change is detected.


Why DNS A record changes happen unexpectedly

Changes to A records don't always come from deliberate internal action. Several common causes are worth understanding before choosing a monitoring strategy:

Registrar account compromises

Domain registrar accounts are a frequent target for credential attacks. Once an attacker gains access to your registrar, they can change your nameservers or add/modify DNS records directly. The attacker doesn't need to touch your server — they redirect your domain at the DNS layer, intercepting traffic before it reaches you. High-profile examples of this attack pattern occur several times per year against major brands.

The insidious part: from your server's perspective, nothing changed. Your logs show normal traffic. Only the external DNS resolution changed — pointing visitors and API clients to a different IP entirely.

CDN and DNS provider misconfigurations

Many teams manage DNS through a CDN (Cloudflare, Fastly, Akamai) or a managed DNS provider. When these providers have outages, failovers, or configuration changes, the A records they publish can change as part of their routing logic. Cloudflare's anycast IPs, for instance, can shift as your account configuration changes. A "proxied" record in Cloudflare doesn't expose your origin IP — until someone accidentally switches it to "DNS only," at which point your origin IP is suddenly public and your A record points somewhere different from what you intended.

TTL expiry and propagation errors

During a planned migration — moving infrastructure, changing cloud providers, deploying to a new region — you update your A record and lower the TTL to accelerate propagation. After the migration, the TTL should be raised again. If it isn't, your record propagates quickly across resolvers, which is fine until the old record is still cached somewhere and the new record is inconsistent. Monitoring A record values from multiple global vantage points catches propagation inconsistencies that single-source checks miss.

Automation and IaC drift

Infrastructure-as-code tools (Terraform, Pulumi, Ansible) manage DNS records alongside infrastructure. A mis-targeted apply, a state file conflict, or a module that manages DNS in a different stack can overwrite A records unexpectedly. The change might be intentional from the automation's perspective but entirely unexpected from the operator's perspective — especially in teams where multiple engineers have Terraform apply access.


How to check your current A record

The two standard tools for querying DNS A records from the command line are dig and nslookup.

Using dig

# Query the A record for a domain
dig A yourdomain.com +short

# Query a specific nameserver (bypasses local cache)
dig A yourdomain.com @8.8.8.8 +short

# Show the full response including TTL
dig A yourdomain.com

# Check from multiple resolvers
for NS in 8.8.8.8 1.1.1.1 9.9.9.9; do
  echo -n "$NS: "
  dig A yourdomain.com @$NS +short
done

The +short flag returns just the IP address(es), which is useful for scripting. Querying multiple resolvers — Google (8.8.8.8), Cloudflare (1.1.1.1), Quad9 (9.9.9.9) — shows whether your record has propagated consistently worldwide or whether different resolvers are still serving different values.

Using nslookup

# Basic A record lookup
nslookup yourdomain.com

# Query a specific nameserver
nslookup yourdomain.com 8.8.8.8

# Query only A records
nslookup -type=A yourdomain.com

nslookup is available on most platforms by default, including Windows. dig is more scriptable and provides richer output.

Local DNS cache can mislead you Your machine caches DNS responses for the record's TTL. If you recently looked up a domain, your local resolver may return a cached value even after the authoritative record changed. Use dig @8.8.8.8 to bypass the local cache and query an authoritative public resolver directly.

DNS A record monitoring strategies

Strategy 1: Cron-based baseline comparison script

Store the expected IP for each domain in a file and compare it against the current value on a schedule:

#!/bin/bash
# /opt/scripts/dns-monitor.sh
ALERT_EMAIL="ops@yourcompany.com"
declare -A EXPECTED_IPS=(
  ["yourdomain.com"]="203.0.113.42"
  ["api.yourdomain.com"]="203.0.113.43"
  ["www.yourdomain.com"]="203.0.113.42"
)

for DOMAIN in "${!EXPECTED_IPS[@]}"; do
  CURRENT=$(dig A "$DOMAIN" @8.8.8.8 +short | head -1)
  EXPECTED="${EXPECTED_IPS[$DOMAIN]}"
  if [ "$CURRENT" != "$EXPECTED" ]; then
    echo "DNS CHANGE DETECTED: $DOMAIN
Expected: $EXPECTED
Current:  $CURRENT
Time: $(date -u)" \
    | mail -s "DNS A RECORD CHANGED: $DOMAIN" "$ALERT_EMAIL"
  fi
done
# Run every 15 minutes
*/15 * * * * /opt/scripts/dns-monitor.sh >> /var/log/dns-monitor.log 2>&1

This approach works for a small number of domains but requires maintaining the expected IP list manually. When you intentionally change an A record, you must update the script or it will alert forever.

Strategy 2: Git-based DNS record snapshots

For teams already using version control for infrastructure, storing DNS snapshots in a git repository provides a natural change log:

#!/bin/bash
# Snapshot current A records for key domains
cd /opt/dns-snapshots

for DOMAIN in yourdomain.com api.yourdomain.com www.yourdomain.com; do
  dig A "$DOMAIN" @8.8.8.8 +short > "current/$DOMAIN.txt"
done

if git diff --quiet; then
  echo "No DNS changes detected"
else
  git diff
  git add -A
  git commit -m "DNS change detected: $(date -u)"
  # Send alert email with diff output
  git show HEAD | mail -s "DNS RECORDS CHANGED" ops@yourcompany.com
fi

The git log becomes an audit trail: you can see exactly when each A record changed, what it changed from, and what it changed to.

Strategy 3: External DNS monitoring service

For production infrastructure, an external monitoring service is more reliable than self-hosted scripts because it checks from multiple global vantage points, doesn't depend on your own server's health, and handles alerting without an MTA. DNSWatch monitors your A records continuously and sends alerts the moment a change is detected — including detecting propagation inconsistencies across global resolvers.


What to do when a DNS A record change is detected

When an alert fires for an unexpected A record change, work through this sequence:

  1. Verify the change is real. Query the record from multiple resolvers (dig @8.8.8.8, dig @1.1.1.1, dig @9.9.9.9). If they all return a different IP from your baseline, the change is propagated and real.
  2. Check your DNS provider's change log. Log into your registrar or DNS provider and check the activity log or audit trail. Most providers (Cloudflare, Route 53, Namecheap) show recent record changes with timestamps and the account that made them.
  3. Check your IaC history. Review recent Terraform/Pulumi applies, GitHub Actions runs, or deployment pipeline logs that have DNS write access. A recent deploy may have changed a DNS record as a side effect.
  4. If unauthorized, act immediately. If the change appears unauthorized: revoke all API keys for your DNS provider, change your registrar password, enable 2FA if not already active, and revert the record to the known-good IP. File a support ticket with your registrar to investigate account access logs.
  5. If authorized, update your baseline. If the change was intentional (a planned migration, a CDN change), update your monitoring baseline to the new value so future alerts reflect the new expected state.

🔍 Check your current DNS A records

See what IP your domain resolves to right now — from multiple global resolvers. Free, no signup.

Check your DNS records →

Set up continuous DNS A record monitoring with DNSWatch

DNSWatch monitors your DNS records from multiple global vantage points and sends alerts the moment a change is detected — without scripts to maintain or servers to manage. Enter your domains; get alerts when your A records change.

🌐 Know the moment your DNS A records change

DNSWatch monitors your A records continuously and alerts you instantly when they change — whether from a registrar compromise, CDN misconfiguration, or an accidental IaC apply.

Join the DNSWatch waitlist → Check your DNS records free

← All articles  ·  DNSWatch  ·  Free DNS checker