I'm just a bit confused about the correct DNS setup for hosting multiple domains on a single server with one ip.
For example the mail server (domain/reverse: example.com) should host 3 domains:
example.com
domain.com
test.com
So whats the correct dns setup?
example.com mx 1 example.com
domain.com mx 1 example.com
test.com mx 1 example.com
or
example.com mx 1 example.com
domain.com mx 1 domain.com
test.com mx 1 test.com
And whats about the mx priority? Only 1 entry for each host? I guess thats fine, because there is only one server and no extra failover server.
Choose a domain name for your mail server. The MX record should point to the FQDN (Fully Qualified Dommain Name) of the mail server, such as
smtp.example.com
. All domains should use this FQDN in their MX. Use a priority higher than 1 so that you can add servers with both higher and lower priority. Something like:Consider adding an SPF record for the Host definition for the server should be something like the following:
The mail server should identify itself its FQDN
mail.example.com
when sending messages. This name is commonly included in the header when clients connect. The PTR record for the mail server's IP address should also return the FQDN of the mail server. This will enable reverse DNS lookup.MX and SPF specifications for the domains should be something like the following. (This assumes a policy that all outgoing mail will be send via the MX. Additional authorized servers can be added as required.)
An MX record for a domain can "point" to any host, so having them all "point" to the same server is fine. As for the preference, you can set it to whatever you like. If you add servers in the future you can add them with a higher or lower preference, dependent upon your needs.