What records for 1 hostname and 1 subdomain with emails?

dash-dns
#1

I have 2 domain names, one that I use for my server’s hostname only (domain name is domain1.com, and hostname is server1.domain1.com), and one that I use for hosting a website (domain2.com). Both domains are hosted under the same IP.

In Cloudflare, for domain1.com I have setup:

  • one A record with name “domain1.com” and with value my server’s IP
  • one CNAME record with name “www” and value “domain1.com

And for domain2.com, I have:

  • one A record with name “domain2.com” and with value my server’s IP
  • one CNAME record with name “www” and value “domain2.com
  • one MX record with name “domain2.com” and value “server1.domain1.com

Domain2.com loads fine in my browser but I’m still unable to receive emails at [email protected] in this configuration, I get error messages like

 DNS Error: 17269781 DNS type 'mx' lookup of domain2.com responded with code NOERROR 17269781 DNS type 'aaaa' lookup of server1.domain1.com. responded with code NXDOMAIN 17269781 DNS type 'a' lookup of server1.domain1.com. responded with code NXDOMAIN 

What’s the correct configuration to be able to receive emails?

#2

Looks like you forgot to create an A or CNAME record for server1.domain1.com. No wonder that server1.domain1.com isn’t currently resolving.

1 Like
#3

so I need to add a new zone for server1.domain1.com? Or is it a new record under domain1.com? And should I create an A or CNAME or both?

#4

You will need to create an A or CNAME record under domain1.com. If domain1.com and server1.domain.com use the same IP address, then you can create a CNAME record for server1.domain1.com that points to domain1.com. If they’re different, then create an A record for server1.domain1.com pointing to the correct IP.

I would recommend that you read a bit about the different types of DNS records and what they mean. This will prevent you from making mistakes that may result in downtime in the future.

1 Like
#5

I forgot to mention that the server1.domain1.com record must have CloudFlare turned off (i.e. a grey cloud next to it) since you will be using it as an email server.

closed #6

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.