DNS Overcoming root domain CNAME restrictions

Prelude: There is a common situation where you need to point a hostname to another hostname, this can arise when the DNS records aren't in your control (such as in a client) Apparently it is a common error for people to try to use CNAME record - (I did it at first too). What this records does is point a hostname to another hostname, such as an A record - it redirects all other record requests such as MX too, Fantastic, you would think - however there is a key problem you can't use it on your root domain as it is against the RFC specifications . So at this stage, you can only use a cname record (or even a ns record for that matter) on a subdomain, what can you do about redirecting the root hostname? 1. Some DNS providers use their own custom DNS record (non-visible to the DNS queries): ALIAS at DNSimple
ANAME at DNS Made Easy
ANAME at easyDNS
CNAME at CloudFlare
What these records do is the DNS provider resolve the hostname themselves and return an A record. This solves the problem, however it relies on your client using one of these DNS providers as their nameserver - your client, may not like it. In cloudflare the setup looks something like this (order matters I believe): CNAME @ yourDNSname.com
CNAME * yourDNSname.com
MX @ yourDNSname.com
Also if you don't have control over the DNS, you can use a unique glue record just for that client, and change that client unique a record when needed. 2. URL redirection on your root domain to (www). Redirecting root domain traffic to your www on a seperate IP, will mean you can use a RFC compliant subdomain CNAME record to point to your server (or glue record). This is a pretty simple solution however the limitiations. This will force you to host your website on a subdomain, for some this is deal breaker - but you will also have to have the overhead of another server to maintain and also the risks of surrending your domain to another service. The setup would look something like this: A @ 10.10.10.10 (external redirect IP)
CNAME www yourservergluerecord.com
MX @ yourservergluerecord.com
3. Using a forward DNS server This is less relevent, but an interesting solution to a certain problem. Currently at work we are using WHM, which preconfigures each clients DNS and services. A forward DNS server works by forwarding (and caching) requests to other DNS servers, so one possible solution would be to have the client set their domain nameserver to the intermedary forward DNS server and then change the forwarding nameserver when needed. This is really only viable when you need to completely switch a whole domain (or zone) to another nameserver seamlessly. Probably don't do this. Just to wrap up: What I really needed was a way to easily change the IP a domain pointed to when I didn't have access to the DNS records, unfortunately being unable to have a cname record on the root apex makes things somewhat complicated. I would suggest: 1. Use a redirect service (e.g root -> www) if you are OK with the secondary server overhead or outsourcing it externally ( there maybe https issues too).
2. Use a custom DNS service providers ALIAS/ANAME if they already use it or are willing to use it.
3. If in the unlikely event you need to seamlessly switch between nameservers for an entire domain, you can use a forwarding dns server. Actually the more I think about this the more ridiculous it is. Why don't you use use a normal DNS server!

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.