3

I'm doing my first mail server config on Ubuntu 16.04. In all tutorials and How-To's there's the mail subdomain as in mail.example.com. I'm wondering if this is some formal requirement or just an example of a possible solution that is required by no standards.

I'm trying to do it with these DNS records:

MX       main.dom        main.dom        1        14400
CNAME    www.main.dom    main.dom                 43200
A        main.dom        XXX.XXX.XXX              3600

I'm not sure how I can test it. Nor can I predict the consequences for the lack of experience. I can tell the server itself is responsive to telnet on port 25, giving this:

$ telnet main.dom 25
Trying XXX.XXX.XXX.XXX...
Connected to main.dom.
Escape character is '^]'.
220 server1.main.dom ESMTP Postfix (Ubuntu)

main.dom is not the real address, just a structural representation. When called on localhost XXX.XXX.XXX.XXX is 127.0.0.1, but the FQDN stays the same (3 parts).

Answers to this are hard to find on the net. And assuming I use the mail subdomain,

MX       main.dom        mail.main.dom        1        14400

do I also need to create a corresponding CNAME?

10

Most domains of any meaningful size have a machine dedicated exclusively to mail, hence mail.example.com.

do I also need to create a corresponding CNAME?

No, you need an A record for mail.main.dom. MX records should always point to an A. It's a common mistake to point an MX record to a CNAME.

With Bind syntax:

main.dom.        IN  MX     10  mail.main.dom.
mail.main.dom.   IN  A          1.2.3.4

Or if you want to serve everything on the same machine:

main.dom.        IN  A          1.2.3.4
main.dom.        IN  MX     10  main.dom.
www.main.dom.    IN  CNAME      main.dom.

Side notes:

  • It's a bad idea to set MX priority to 1. If at any point you need an emergency re-route of mail you can add an MX with a higher priority, say 5.
  • For the same reason you shouldn't set TTL for MX too high. Something like 3600 is big enough not to hammer your DNS, yet small enough to allow you to make changes in an emergency (changes should propagate in less than an hour).
  • Priority 0 works, but there are technical reasons for not using it.
5

It's an example. A mail host can have any name (and a single physical host can have several names). In a tutorial, it may be easier to distinguish the mail host from other hosts if the mail host has mail in its name. It reduces the possibilities of confusion.

  • Thanks. I added a tiny extra question at the end of my question about the corresponding CNAME, if you'd like to answer that. – Tomasz Jun 7 '17 at 5:47
  • 1
    @tomas Ah, so you did. No, sorry, I'm no DNS wizard. Also, the mail name seems to be a host name, not a subdomain name in your config. But, as I said, I don't really know DNS configurations. – Kusalananda Jun 7 '17 at 5:52

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.