Question

How to use A/AAAA records instead of CNAME for subdomain

Context:

  1. My DNS records are managed with DO (I’m also a DNS newbie)
  2. I have a DO static site deployed at example.com with A records (iPv4-1, iPv4-2) and AAAA records (iPv6-1, iPv6-2)
  3. When deploying another static site at subdomain.example.com, DO automatically creates a CNAME record with HOST subdomain that aliases subdomain.ondigitalocean.app. (looks like a CloudFlare proxy server that ultimately directs to example.com?).

What I want:

I want to create MX records for subdomain.example.com to receive mail at that address. However, attempting to create MX or TXT records for subdomain.example.com produces this appropriate error:

Records cannot share a name with a CNAME record.

Quick research explains this is necessary for DNS resolution.

Solution?

It looks like I have two options:

  1. Use a different name (don’t want this)
  2. Use A/AAAA records instead of CNAME for subdomain.example.com

Bottom line - Is option 2 possible, and if so, how should I modify my DNS records?

Specifically, what IP address should the A/AAAA records direct to for subdomain.example.com? I assumed they should direct to the IP for subdomain.ondigitalocean.app. (the CNAME record auto-generated by DO^) but a quick IP lookup shows the same iPv4/iPv6 values as example.com - obviously.

Any help is greatly appreciated, thank you!


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
June 15, 2023
Accepted Answer

Hey @motivv,

Indeed, this is not possible at the moment.

For option 2, there is no fixed static IP address that you could use, however, what you could do is to move your DNS zone to Cloudflare, where you will be able to add a CNAME record alongside an MX record for the same subdomain name.

In case you want to see this as an option on the DigitalOcean side, the best thing to do to get your voice heard regarding this would be to head over to our Product Ideas board and post a new idea, including as much information as possible for what you’d like to see implemented.

https://ideas.digitalocean.com/

Hope that helps!

Let me know if you have any questions.

- Bobby.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel