We are currently in the process of migrating from one host to the google cloud platform.
But there is one thing that is causing us confusion. We have various clients who have setup custom domains with us. Many of them have done so by updating their nameservers to the following:
- ns1.mydomain.com
- ns2.mydomain.com
- ns3.mydomain.com
However, when we add domain zones to gcloud each domain seems to get assigned different NS records at random.
Some get assigned the following
ns-cloud-a1.googledomains.com, ns-cloud-a2., ns-cloud-a3.
While others get
ns-cloud-b1., ns-cloud-c1., ns-cloud-d1.* etc.
How can we make the current custom domains continue to work after we migrate? We have several hundred custom domains set up and we would like to migrate to gcloud without any changes required from our clients.
Our original plan for the migration was:
- Add zones for mydomain.com to google cloud DNS and take note of NS records
- Add zones to cloud DNS for all of our client custom domains
- Update our nsX.mydomain.com nameservers to point to the IP address of the NS records for mydomain.com
- All existing custom domains should continue to work regardless of their NS records (in theory)
However, I’m not sure if that is the correct way to proceed.
Some things I’m particularly confused about:
- Do we need to set the NS records for the custom domains in gcloud to our nsX.mydomain.com servers? We don’t currently specify any NS records for these domains in cPanel.
- Does it matter which name servers the custom domains are assigned to in gcloud? (ns-cloud-a1 for some vs ns-cloud-b1 for others)
- Would we expect any sort of downtime for this DNS transfer?
Any assistance with this would be greatly appreciated. Thanks.
2
Answers
I was able to get this to work by adding multiple A records for each of the name servers
So for ns1.mydomain.com I added A records for 216.239.32.106, 216.239.32.107, 216.239.32.108, 216.239.32.109, 216.239.32.110.
Those are the ips of ns-cloud-a1., ns-cloud-b1., ns-cloud-c1. etc. which you can find by running this command for each of the nameservers
I did the same for ns2. and ns3., adding A records for the second and third nameservers in each shard (i.e. ns-cloud-a2., ns-cloud-b2. and ns-cloud-a3., ns-cloud-b3.)
This is how the A records appear in the google cloud DNS dashboard
Cloud DNS assigns every public managed zone to one of five nameserver shards. Shards are the letter before the number in an authoritative nameserver name, so ns-cloud-e1 through ns-cloud-e4 are the E shard.
Multiple zones with the same DNS name cannot be assigned to the same shard, so only five zones can be created with exactly the same DNS name. For more information, please refer to Nameserver limits.
For example, you’ve zone1 for mydomain.com and NS as ns-cloud-bX.googledomains.com., but when you create a zone with the same domain name, you’ll get ns-cloud-eX.googledomains.com.
For your scenario:
Only the DNS name servers pointed by the DNS registrar will resolve the requests which matter. However, subdomains that are delegated by creating NS (name server) records in their parent domain’s zone need to have their own zones as well.
Your time to live (TTL) set on the records at the registrar will tell you how long you have to wait before the new name servers begin to be used.