What does a CNAME record do?
If I host my DNS at a hosting company, and use them for email, is it possible for me to actually run the website at another hosting company?
I.e., the other hosting company does not provide access to DNS or an email server, so I just want to use them for Windows/IIS and my other host for DNS and email.
Could I just create a CNAME record at host #1 pointing to host #2?
Solution 1:
Yes, you can do that. It doesn't matter who you host your DNS with; there are even free providers that will host it for you. At this point whether you need CNAME or A records is dependent on the server addresses the company gives you.
Let’s assume your email host provides you a server with the IP address of 20.20.20.20 and your webhost provides you with a website address of mysite.somehost.com and not a specific IP address.
In your DNS settings you will configure:
- mail.yourdomain.com with an A record pointing to 20.20.20.20.
- yourdomain.com and www.yourdomain.com with a CNAME record pointing to mysite.somehost.com.
More information: Canonical Name Record (CNAME) showing the usage of CNAME records as aliases for a single IP address and for usage with external servers.
Solution 2:
Before we get into a flame war about CNAME records or A records and such, let’s establish one thing first. Your DNS is hosted at a hosting company, and they also provide you with email.
So this means that your MX record points to your hosting company's server.
If you get hosting for a website, then all you'll need to do is update the DNS with your hosting provider to point to the hosting providers server.
Think of a CNAME record as an alias. It doesn't point to an IP address, but another hostname.