name {ttl} addr-class MX preference value mail exchange
Munnari.OZ.AU. IN MX 0 Seismo.CSS.GOV.
*.IL. IN MX 0 RELAY.CS.NET.
Mail eXchange records, MX, are used to specify a list of hosts
which are configured to receive mail sent to this domain name. Every name
which receives mail should have an MX since if one is not found at the
time mail is being delivered, an MX will be ``imputed'' with a cost
of 0 and a destination of the host itself. If you want a host to receive
its own mail, you should create an MX for your host's name, pointing
at your host's name. It is better to have this be explicit than to let it
be imputed by remote mailers.
In the first example, above,
Seismo.CSS.GOV. is a mail gateway that knows how
to deliver mail to Munnari.OZ.AU.. These two
machines may have a private connection or use a different transport medium.
The preference value is the order that a mailer should follow when there is
more than one way to deliver mail to a single machine. Note that lower
numbers indicate higher precedence, and that mailers are supposed to randomize
same-valued MX hosts so as to distribute the load evenly if the costs
are equal. See RFC974 for more detailed information.
Wildcard names containing the character ``*'' may be used for mail routing with MX records. There are likely to be servers on the network that simply state that any mail to a domain is to be routed through a relay. Second example, above, all mail to hosts in the domain IL is routed through RELAY.CS.NET. This is done by creating a wildcard resource record, which states that *.IL has an MX of RELAY.CS.NET. Wildcard MX records are not very useful in practice, though, since once a mail message gets to the gateway for a given domain it still has to be routed within that domain and it is not currently possible to have an apparently-different set of MX records inside and outside of a domain. If you won't be needing any Mail Exchanges inside your domain, go ahead and use a wildcard. If you want to use both wildcard ``top-level'' and specific ``interior'' MX records, note that each specific record will have to ``end with'' a complete recitation of the same data that is carried in the top-level record. This is because the specific MX records will take precedence over the top-level wildcard records, and must be able to perform the top-level's if a given interior domain is to be able to receive mail from outside the gateway. Wildcard MX records are very subtle and you should be careful with them.