2

I am running into a problem which is as follows:

I have two domain names with different IPs;

The first is EXAMPLE.COM to host my website. Say the IP for EXAMPLE.COM is 111.111.11.11.

The second domain is an FQDN to host my email, say that it is MAIL.EXAMPLE2.io.

The DNS Console currently supports these record types on the graphical interface: A, AAAA, CNAME, MX, NS, SRV, TXT.

I want to add A record for MAIL.EXAMPLE2.io on the DNS of my website EXAMPLE.COM. But the website DNS has EXAMPLE.com by default with each A record I add.

For example, if I want to add the below:

# Name              Type       Value
mail                IN A       1.2.3.4

It will become like this:

# Name                            Type       Value
MAIL.EXAMPLE.IO.example.com         A       222.222.22.22

Or, I can add MAIL alone, and it will become MAIL.Example.COM.

How can I solve this problem where I enter the A record to become:

# Name                Type       Value
MAIL.EXAMPLE.IO         A       222.222.22.22

Cloudflare has a better DNS configuration, and it will resolve my problem, but I don't want to use it on this website.

To better illustrate what I see, please look at this image:

screenshot

When I run sudo docker-compose logs --tail=200 -f acme-mailcow, I get these errors:

  • Cannot match your IP 222.222.22.22 against hostname autodiscover.EXAMPLE.COM (DNS returned 111.111.11.11)
  • Cannot match your IP 222.222.22.22 against hostname autoconfig.EXAMPLE.COM (DNS returned 111.111.11.11)

Update:
The purpose of this update is to answer questions I received in the comments and make them visible to everyone.

  1. example2.io
    The DNS configuration for example2.io where I host my mailserver is below. This is inline with mailcow documentation: enter image description here Note that the root directory of this website points to a different IP other than the mailserver (i.e., 333.333.33.33)

  2. example.com
    The DNS configuration for the domain example.com where I want to host a website in the root directory is below. I want the emails of example.com to be handled through a mailserver hosted on mail.example2.io. enter image description here To properly configure the mail on this domain, I want to remove .example.com from the configuration. That was possible on cloudflare DNS configuration.

  3. example3.com
    example3.com is a domain name that I have its DNS record configured through Cloudflare and its email is handled through the mailserver example2.io. The DNS record configuration of this domain is below and this is how I am trying to configure example.com. enter image description here
4
  • Where is this hosted? It doesn't look like a cpanel interface, what is it?
    – Steve
    Jan 9 at 7:30
  • Hetzner DNS console.
    – Abe
    Jan 9 at 7:34
  • 1
    How is the DNS configured for example2.io? Where do the NS records point? Is it configured with the same DNS servers as example.com? Jan 9 at 10:37
  • Thank you very much, @Stephen Ostermiller ♦, for editing my original question and making it read better! I highly appreciate it. The answer to your questions should be our starting point. I agree. I have updated the question and included three different DNS configurations.
    – Abe
    Jan 9 at 17:45

1 Answer 1

2

It sounds like what you really want is to have mail.example.com resolve to the IP address of mail.example2.io. To do this, add a record of type CNAME, with mail as the name, and mail.example2.io as the value. mail.example.com would then resolve to 222.222.222.222. This is exactly how the autoconfig and autodiscover records shown in your screenshot have been configured.

You can't add a record with mail.example2.io as the FQDN to the DNS zone example.com, as such a record could not be part of that zone. I can promise you that Cloudflare would not let you do this either.

6
  • 1
    Alternatively, have the A record for mail.example.com resolve to the same IP as mail.example2.io. Jan 9 at 12:43
  • Thank you, @tim-fountain! I made changes to my original question and added three different DNS records. I also changed mail.example2.io in the first image to mail. Now, when I go for your suggestion and add a record of type CNAME, with mail as the name, and mail.example2.io as the value, I get this error message: Another record with this name already exists. I added Cloudflare DNS configuration for example3.com; this is how I want the configuration of example.com to be.
    – Abe
    Jan 9 at 17:56
  • 1
    If you already have a mail A record pointing at the IP address of mail.example2.io, then that is equivalent to my suggestion (and is also what GeoffAtkins suggested above). What isn't working with that configuration? Jan 9 at 18:55
  • You are right! When I run sudo docker-compose logs --tail=200 -f acme-mailcow, I get these errors I get: Cannot match your IP 222.222.22.22 against hostname autodiscover.EXAMPLE.COM (DNS returned 111.111.11.11) and Cannot match your IP 222.222.22.22 against hostname autoconfig.EXAMPLE.COM (DNS returned 111.111.11.11)
    – Abe
    Jan 9 at 19:09
  • Also, I don't want the email to be accessible through example.com. What I mean by this is when anyone types mail.example.com etc... they get the error page. I achieved this with Cloudflare DNS configuration where the email is not accessible on example3.com. That is not the case with the current DNS configuration of example.com.
    – Abe
    Jan 9 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.