8

I have abc.tv site which is configured on a.a.a.a IP and my mailing solution([email protected]) which I want to configured on y.y.y.y IP address. Is is possible to have separate IPs fo my A record & MX record as below?

Domain name - abc.tv A Record - a.a.a.a MX record - y.y.y.y

please suggest

3 Answers 3

15

MX records were invented for precisely this application: allowing mail for a specific host to be handled by another host.

The first thing to point out is that MX records do not contain IP addresses, they container a pointer to a hostname.

So for your example you would have something like:

abc.tv.      A    a.a.a.a
             MX 5 mail.abc.tv.
mail.abc.tv. A    y.y.y.y

The host pointed to by the MX record must have an A or AAAA record and cannot be a CNAME record. (thanks to Ludwig Weinzierl in comment below for pointing out this omission)

1
  • but can I have MX and A records on the same host? That is, not a subdomain mail.*** Aug 19, 2021 at 10:53
10

An MX record must be a name, not an IP. That means the host pointed to by an MX record for your domain must itself be directly resolvable to an A record.

However there is no requirement for that A to be part of your domain. For example you can have Google Apps handle the MX records for your domain, while you manage the A records for the domain and www.

1
  • 3
    That is correct. The name must point to an IP however, a CNAME is not allowed. Here is the explanation from Wikipedia: The host name contained in an MX record must have an address, i.e. an A or AAAA DNS record. CNAME aliases are prohibited in an MX record data, while CNAME is allowed for the MX record label, that is for the domain name leading to the MX record itself.[1] It is also not permitted to use an IP address directly in an MX record;[2] while some mail servers will send mail to domains with IP-based MX records, many (most notably Exim) will refuse to do so. Jun 16, 2009 at 9:19
4

As an addition to the other correct answers.

MX records: not only can they be different from your primary domain A record's IP address, you can even have multiple MX records (called backup or secondary MX) and specify a priority value, for example:

MX 10 mail.abc.tv.
MX 20 mail2a.abc.tv.
MX 20 mail2b.abc.tv.
MX 30 backupmail.provider-example.com.

As you also see in this example, mail exchangers needn't to be on the same domain.

2
  • 2
    It's worth noting that care must be taken when using backup MX providers. There are a number of subtle problems that can arise if everything is not configured carefully. Mismatching spam filters can provide a way for spammers to bypass spam filtering, not having control over all the servers makes it difficult to debug problems using mail logs and one mis-configured backup server could cause mail to intermittently go missing. For most people, it's usually acceptable to let sending mail servers store and attempt to re-transmit messages, rather than trying to setup a high availability setup. Jun 16, 2009 at 11:00
  • SpoonMeiser: sure, you are right. I only wanted to show the theoretical background. It's interesting how very big mail providers have set their MX record. Try nslookup for xm on gmail.com or hotmail.com.
    – splattne
    Jun 16, 2009 at 11:18

You must log in to answer this question.