Set Up MX Records
An MX record is simply the method used by DNS to route mail bound for one machine to another instead. An MX record is created by a single line in one of your named(8) files:
hostA IN MX 10 hostB
This line says that all mail destined for hostA
in your domain
should instead be delivered to hostB
in your domain. The IN
says that this is an
Internet-type record, and the 10
is the cost for using this MX
record.
An MX record can point to another host or to the original host:
hostA IN MX 0 hostA
This line says that mail for hostA
will be delivered to hostA
. Such records might
seem redundant, but they are not because a host can have
many MX records (one of which can point to itself
):
hostA IN MX 0 hostA IN MX 10 hostB
Here, hostA
has the lowest
cost (0
versus 10
for hostB
), so the first
delivery attempt will be to hostA
. If hostA
is unavailable, delivery will be
attempted to hostB
instead.
Usually, MX records point to hosts inside the same domain. Therefore, managing them does not require the cooperation of others. But it is legal for MX records to point to hosts in different domains:
hostA IN MX 0 hostA IN MX 10 host.other.domain.
Here, you must contact the administrator at other.domain
and obtain
permission before creating this MX record. We cover this
concept in more detail when we discuss disaster preparation
later in this chapter.
Although MX records are usually straightforward, there is one risk, and there can be a few problems associated with them.
Get sendmail, 4th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.