A general overview of DNS records; a comparison between A record and CNAME
human
There’s no fixed IP address assigned to my shared hosting space on the server examplehost.com. In this case, should I use CNAME for redirection? Please explain in detail. I want to understand and execute this step by step, and also, could you compare the effects of these two redirection methods on the page request time?
Thank you in advance.
Berk
ChatGPT
Hello Berk,
If your targeted shared hosting does not have a specific IP address and is only accessible via the examplehost.com domain, you can solve this with a CNAME record. However, you’ll need some basic information to understand and correctly implement this redirection.
- What is Redirection with CNAME?
A CNAME (Canonical Name) record indicates that one domain name is equivalent to another domain name. So, when a visitor or service queries a domain with a CNAME record, this record directs the visitor to the primary domain.
- How to Create a CNAME Record?
Creating a CNAME record in Cloudflare:
- Log in to your Cloudflare account.
- Select the domain exampledomain.com.
- Click on the DNS tab.
- Click on the “Add Record” option.
- Choose “CNAME” for the record type.
- For “Name”, enter exampledomain.com.
- For “Target”, enter examplehost.com.
- Create the record.
- Effects of A and CNAME Records on Page Request Time
A Record: When a visitor queries a domain name, the DNS server directly returns the corresponding IP address of that domain. Thus, the visitor connects directly to the relevant IP address.
CNAME Record: When a visitor queries a domain name, the DNS server redirects to another domain name. When the visitor queries this new domain, they get an IP address in return. Therefore, CNAME records typically require an extra DNS query compared to A records.
In conclusion, when using a CNAME record, an extra DNS query is needed, which theoretically might introduce a slight delay compared to an A record. However, this delay is usually in milliseconds and doesn’t significantly impact the user experience. Moreover, CNAME records offer flexibility; if the server’s IP address changes, you won’t need to make any changes in the DNS.
I hope this information enlightens you. If you have further questions or need assistance, please let me know!
[END_OF_BLOG_CONTENT]