-2

Given a fresh install of Ubuntu with a FQDN of example.com

$ hostname -f
example.com

If user installs iRedMail (or another mail server) using demo.example.com as their first mail domain name.

enter image description here

His mail account is therefore postmaster@demo.example.com

What should the A and MX DNS settings look like?

Here is my attempt:

A example.com SERVER_IP
A demo.example.com SERVER_IP
MX demo.example.com example.com

Edit: My reasoning, is that both example.com and demo.example.com need to resolve to the server IP.

And the hostname demo.example.com should resolve to the demo.example.com for the MX record because the postmaster@demo.example.com needs to be processed via the main server example.com.

Is that correct?

2

In case we are speaking "just" about e-mail service, you don't need the A record for example.com.

All you need is:

MX        ... Mail Exchange - where should be send e-mails targeting the domain
A / AAAA  ... IPv4 / IPv6 address - where the mail server can be reached

optionaly you may setup (the usage is optional):

TXT       ... SPF - information which server is allowed to send out the 
              mail originating (sender) this domain
TXT       ... DKIM - signature on server level (to prove originating server
              and consistency /no change/ on the message during the transport)

so the records can be

demo.example.com A <SERVER_IP>
example.com MX 10 demo.example.com
example.com TXT "v=spf1 ip4:<SERVER_IP> ~all"

DKIM example has not been provided as it is record with public key for the generated private key which is generated per server...

for more information you can check for example these resources:

  • Hi please see my edit in original post, should it be example.com MX 10 demo.example.com OR demo.example.com MX 10 example.com – Jack Robson Dec 6 '18 at 1:02
  • 1
    Fqdn type_of_record value... so mx record for domain example.com would be example.com MX 10 demo.example.com. – Kamil J Dec 6 '18 at 1:06
  • In case of email delivery the mx record would be searched as it is "dedicated" for email delivery-using mx record you can differentiate target for e-mail from the other service like web and to have option to use even record from other domain(shared email server-e.g. mail.sample.org).In case of xyz@demo.example.com there is no mx but in case of no mx there should be "fall back" for A/AAAA, next search would be for A record for exact match of "domain" so in this case existing A for demo.example.com.The email would be delivered-depends on server config for (not) accepting. – Kamil J Dec 6 '18 at 7:33

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.