Why the restored zone can keep the old address
- The old server was behind NAT, so the zone held a public IP while the account was assigned a private one.
- The account was moved between servers before, and some records still hold an even older IP.
- Someone added subdomains or mail-related hostnames by hand with a hardcoded address.
- The zone has AAAA records for an IPv6 address the new server doesn't have.
- The SPF TXT record lists the old server with an
ip4:mechanism. That isn't an A record, but it goes stale the same way.
curl --resolve bypasses DNS completely, so the new server looks perfect. The stale record only matters once real resolvers start asking the new nameservers.
Find out which IPs belong to this server and this account
BASH
# IPv4 addresses bound on this server
ip -4 -o addr show | awk '{print $4}'
# IPv6 addresses, if the server has any
ip -6 -o addr show scope global | awk '{print $4}'
# IP assigned to the cPanel account (replace username)
grep '^IP=' /var/cpanel/users/username10.x.x.x. The zone should still hold the public address that maps to it. Check how NAT is configured on your server before you decide which address belongs in DNS.
Write down the correct public IPv4 (and IPv6, if any). Every A or AAAA record in the zone that should point at this server needs to match one of those values.
Query the local zone, not the internet
dig example.com goes through your normal resolver, which still follows the current delegation and returns whatever the old nameservers say. That tells you nothing about the zone you just restored.
Pointing dig at 127.0.0.1 asks the local DNS service (BIND or PowerDNS, depending on the setup) to answer from its own zones. It works even though the domain isn't delegated to this server yet, because authoritative servers answer for zones they hold regardless of what the registry says.
BASH
# Ask the local DNS server for the common hostnames
for h in example.com www.example.com mail.example.com webmail.example.com ftp.example.com; do
echo h:(dig @127.0.0.1 +short A $h)
done
# Show every A, AAAA, and SPF ip4/ip6 entry in the zone file, with line numbers
grep -nE '[[:space:]](A|AAAA)[[:space:]]|ip[46]:' /var/named/example.com.dbgrep catches everything else, including custom subdomains, autodiscover, cpanel, and the SPF record. Read the output line by line and compare each address against the list from the previous step.
A few patterns usually stand out:
- The apex and
wwwpoint at the new IP, butmailstill points at the old one. Webmail and IMAP then go to the old server while the site works fine. - Everything uses the new IP except one or two subdomains someone added later.
- An AAAA record points at the old server's IPv6 address. IPv6-capable visitors reach the old host while IPv4 visitors reach the new one, which looks random from the outside.
- The SPF record still says
ip4:with the old address, so mail sent from the new server starts failing SPF after the move.
dig @127.0.0.1 returns nothing at all, the zone may not have loaded. That's a separate problem worth solving first, because the new nameservers would answer with nothing too.
Not every address that differs is wrong. A subdomain might point at an external service on purpose, such as a separate mail provider or a SaaS app. Only change records that were meant to follow the server.
Fix the stale records and confirm the change
/var/named/example.com.db by hand is possible, but then you're responsible for bumping the serial and reloading the right service, and the steps differ between BIND and PowerDNS setups. Unless you have a reason to, stick with the interface. If you do edit the file, take a copy of it first.
For each stale record, change the address to the correct one from your list. Update the SPF TXT record too, if it lists the old server. Then run the same checks again and compare the serial:
BASH
# The serial (third field) should be higher than before the edit
dig @127.0.0.1 +short SOA example.com
# Re-run the zone file check; no old IPs should remain
grep -nE '[[:space:]](A|AAAA)[[:space:]]|ip[46]:' /var/named/example.com.db
# Confirm the new server actually serves the site (replace with your new IP)
curl -sI --resolve example.com:443:203.0.113.10 https://example.com/curl --resolve check proves the web server answers correctly for the domain on the new IP, without touching DNS. If you want more detail on that step, see Test the New Server With curl --resolve Before You Change Nameservers. The two checks complement each other: curl confirms the server is ready, and dig confirms the zone sends visitors to it.
Check every nameserver that will answer for the domain
127.0.0.1 gives you the whole picture. Many setups have more than one, though: a DNS cluster, a pair of dedicated nameserver machines, or an external DNS host that holds a copy of the zone.
Find the NS records in the restored zone with dig @127.0.0.1 +short NS example.com, then ask each of those servers directly. Use dig @ns1.example.net +short A example.com with each nameserver name in turn, and check mail and www the same way. Every nameserver should return the same new IP and the same SOA serial. If one still returns the old address, the zone hasn't synced to it, and visitors whose resolver picks that server will reach the old host.
Whether WHM pushes zone edits to other nodes depends on how the cluster is configured. A node set to standalone, for example, won't receive changes. Verify by querying, not by assuming the sync worked.
Only when every nameserver gives the right answers is it a good time to change the nameservers at the registrar. After that switch, remember that resolvers may keep cached answers from the old setup until their TTL expires. Some visitors still reaching the old server for a while is expected, as long as the new nameservers answer correctly.
A short routine worth keeping
dig @127.0.0.1, grep the zone file for A, AAAA, and SPF entries, fix anything stale through the zone editor, and confirm every listed nameserver returns the same answer. It's a few minutes of read-only checks. It catches the kind of problem that otherwise shows up as a vague report that the site still loads from the old server, at a point where cached DNS makes it slower to clean up.