Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

In all examples of setting up dns, MX records points to mail.example.com (as I understand, purpose is easily change mail server without touching main host). And even my registrar's backend doesn't allow such operation.

Why I can't point MX to example.com, and why I shouldn't?

share|improve this question
add comment

3 Answers 3

up vote 2 down vote accepted

As long as your example.com domain has an associated A record, you can point an MX DNS entry to it. It's just not advised to do so.

An DNS MX type record always points to an A record which points then to an IP. You can have multiple MX records per domain with a different or equal priority. It's also ok just to have only one MX record pointing to an A record, no matter which one. You just should not let it point to a CNAME record instead of an A record (this is often done in big environments, where thousands of domains pointing to a few servers.

share|improve this answer
    
So, then if I point MX to mail.example.com, where should I point PTR record? I cannot point it to mail.example.com, because it's not main domain for my server. Can I have multiple domain names in PTR records? –  hjdm Dec 10 '12 at 15:55
    
Your provider has to set the PTR record, the reverse lookup will query the IP and asks for a matching hostname. But it doesn't ask your DNS (this would be forward), it asks the network owner (reverse). So the PTR record has to be set by your provider. Your PTR record should in your case also point to mail.example.com. –  mgabriel Dec 10 '12 at 16:00
    
But what to do with example.com? I have mail.example.com (mail server) and example.com (web server) on the same machine, so should I just leave example.com without PTR and point to mail.example.com? (I can edit PTR myself in provider's admin panel) –  hjdm Dec 10 '12 at 16:06
    
I'd recommend to set MX and PTR matching to mail.example.com, even if it is on the same host as example.com. –  mgabriel Dec 10 '12 at 20:29
add comment

The MX field is corresponding to a name of a mail server (not an IP), with its priority. So you need to have defined a name associated to its IP before using the MX field. I think you can define the zone IP and then the MX to the zone if you want, but it is not common, as generally the Web server (used by IP zone) is not the same machine as your mail server

share|improve this answer
add comment

Your MX record tells the internet where your mail server is, and in that regard, it is intended to be pointed at a specific host. (If example.com resolves to a single host, you may have your MX records point at it, and provided there's something there to receive the mail, it should even work, but is not recommended.)

Again, this is because of what an MX record fundamentally is - a signpost for the rest of the internet saying "send mail for my domain to this host."

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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