What does changing nameservers do? with illustration of web servers and dns lookups

What Does Changing Nameservers Do?

Changing ‘nameservers’ potentially breaks your website (and email!). So it’s something to handle very carefully.

Without getting all technical, when you change nameservers for your domain name you are telling ‘the internet’ to look elsewhere to find details about where your website can be found. So typically you would update these settings if you changed web hosting company for example.

The problem is that there are 2 ‘layers’ to these domain records.

And nameservers are the top layer of this.

The second ‘layer’ down is all the DNS (Domain Name System) records. That is, the nameservers point to where the DNS records are. And the DNS records are what actually tell the internet where to find your web server.

But they also includes lots of other important records too – like where to deliver your email. Plus details about what systems are authorised to send email for your domain. And probably records to verify your domain ownership for things like Google Search Console.

So if you change the nameservers all your existing DNS records will no longer be found. Which can break things like email. So there is an extra job to do before you change the nameservers!

Does Changing Nameservers Affect Email?

Yes, changing nameservers will affect your email. So you need to do the extra work before you change anything to make sure you don’t lose your email.

Where your email is delivered is determined by ‘MX’ records (which stands for ‘mail exchanger’). These can be found in DNS settings for your domain. But remember it’s the DNS settings that the nameservers are pointing to that count. So this could be at your domain registrar, or it could be your web hosting company.

Most likely your email will be an inbox, or multiple inboxes, with Microsoft 365 Business or Google Workspace (these two are the best options and suit most businesses). Or quite often it’s an inbox provided by your hosting company. Although I wouldn’t recommend this latter approach as it can greatly reduce reliability of sending and receiving email.

What commonly happens is somebody changed nameservers and now email is not working. The reason being that the correct MX records are no longer being found. Previously they were pointing to Google Workspace for example, and now by default the new hosting account has created MX records to say it’s handling email for that domain. No email gets to Google anymore. If Google email is not working after a DNS change, this is usually why!

You Have To Recreate DNS Records BEFORE Changing Nameservers

This the critical thing. You have to do an audit of every DNS record that exists for your domain, before you change anything.

That means checking the MX records to see what service is being used for email. It means looking at CNAME records to see if there are any additional subdomains, or custom records for things like DKIM (for email deliverability). It also means checking all the TXT records – SPF, DMARC, Site Verifications and more.

Where you find these records depends on your hosting company, or domain registrar (again, it’s where your nameservers currently point). For cpanel based hosts it will usually be in the ‘Domains’ section under ‘Zone Editor’.

cPanel Domains section with Zone Editor highlighted

Once you have a list, then you need to compare this with the records that already exist in the new hosting DNS settings.

With cpanel hosting many will be similar (things like webmail, webdisk, ftp, autodiscover etc), but will now point to the new hosting account IP address. Obviously these you probably don’t need to touch. But others will be missing.

And some will overlap – most commonly MX records and the SPF TXT record. These need careful thought to get everything correct. Common errors are having too many MX records (some should have been deleted). Or blindly copying the old SPF record when it should have been edited to remove the old and merge in the new.

Why Not Just Export and Import the Zone File?

This may be an option. It’s often available even in cpanel based hosting accounts.

But doing this blindly can create an almighty mess. Because your old host may have created all sorts of records for their own use that point specifically to the IP address of the old hosting. If you just import all of these then things are going to go wrong, as cpanel will typically overwrite the records where any conflicts occur. So you can end up with DNS records pointing back to your old hosting… and then wondering why the website goes offline when the old hosting is cancelled!

Migrating hosting accounts can be done without any problems or downtime. It just takes a bit of careful planning and preparation.

Here’s some tips on making this as smooth as possible:

  • Keep a record of all current DNS records before you start (export and backup the full zone file if you can)
  • Ahead of time adjust the TTL (Time To Live) of existing DNS records (including nameservers if you can) – this will reduce how long the records are cached so when you make the changes things will propogate much faster. It also allows you to fix things more quickly if anything goes wrong and any records need correcting or reverting.
  • Also ahead of time, do test that the site is working on the new hosting! You can temporarily point your local ‘hosts’ file to the IP address of the new web server for this purpose.
  • After auditing your old and new records, make all the changes you need. But then compare them again side by side – cpanel’s Zone Editor has a handy filter to show, e.g. just TXT records, that makes this easier.
  • Once your nameservers have been changed, test everything. You can use tools like ‘dig’ or ‘nslookup’ to check records have updated correctly. But also check all services themselves still work. There are also various online testing tools for checking things like SPF records are valid etc.
  • Keep the old hosting live until you’re sure everything is complete and working. Always allow for a generous overlap of time (weeks not days!) just in case you need to revert back while you fix something. Or discover something is missing.
  • Consider a phased approach if useful. If a lot of things are changing you may want to gradually change things over by updating some DNS records in the old hosting before the nameservers are switched.
  • Involve all stakeholders in the process. Make sure everyone knows what is happening and when. And don’t try and migrate everything in the middle of a big marketing campaign. 🙂
  • Continue to monitor things. You should see traffic volumes and server workloads shift from the old to the new – log files and cpanel stats can be really helpful to see that everything has transitioned as expected.

Leave a comment