The Domain Name System (DNS) and SMTP mail routing

The Domain Name System (DNS) is a directory used by SMTP to convert a name, such as renovations.com, to a list of servers that can receive connections for that name and to find the IP address of a specific server. By looking up a destination server's address in the DNS, the sending server can properly route a message to a recipient.

DNS uses two kinds of records: Mail Exchanger (MX) records and A records. An MX record maps a domain name to the names of one or more mail hosts. An A record maps a host name to the IP address of a server.

Mail servers also use other DNS records. For example, servers that receive Internet mail perform a reverse lookup to a DNS PTR record to determine the host name for a given IP address. Reverse lookups are useful in verifying the source of a message, an important tool for restricting relay access through your server or preventing unsolicited commercial e-mail (UCE).

You must correctly configure DNS to support your use of SMTP. To determine the IP address of the mail server for the destination domain, IBM® Domino® does the following:

  1. The server looks up the domain part of each recipient's address in DNS.
  2. If DNS finds an MX record, the server tries to connect to the server listed in that MX record. If there is more than one MX record, the server tries to connect to the record that has the lowest cost. If more than one MX record has the lowest cost, the server randomly selects one and tries to connect to the server listed in that MX record.
    Note: There may be more than one MX record for a specific domain name. The host name is looked up in DNS to find an A record. An A record contains the IP address for the host.
  3. If DNS finds only an A record, Domino® routes the message to the IP address in that A record.
  4. If DNS does not find a record, Domino® cannot deliver the message and sends a nondelivery message to the sender.

An MX record maps a domain name to one or more host names. An A record maps a host name to the IP address of a server. You may want to use a host name in the MX record instead of just an A record for the following reasons:

  • Some third-party tools recognize only host names, not IP addresses.
  • If you replace or relocate a machine, you can assign the existing host name and IP address to the new or relocated machine. This change is transparent to users, and messages continue to route properly.

You can use DNS to provide failover and load-balancing for your mail servers by creating multiple MX records for a domain name on the DNS server. When you set more than one MX record for a name, you can set preference values to control how DNS selects those records. DNS selects smaller value preferences first -- for example, DNS selects 5 before 10. If more than one MX record has the same preference value, DNS randomly selects from among those MX records. If one of those MX records fails -- for example, because a server is unavailable -- DNS caches that failure and tries other MX records of equal weight, followed by less-preferred MX records.

For example, the renovations.com domain has four MX records:

  • MX record: renovations.com IN MX 5 mail1.renovations.com
  • MX record: renovations.com IN MX 5 mail2.renovations.com
  • MX record: renovations.com IN MX 10 mail3.renovations.com
  • MX record: renovations.com IN MX 10 mail4.renovations.com

When a server tries to connect to renovations.com, the DNS first uses MX records with preferences of 5. If there are two MX records with preferences of 5, DNS randomly selects between the MX record for mail1.renovations.com or mail2.renovations.com. If the DNS returns the MX record for mail1.renovations.com and mail1.renovations.com is unavailable, the DNS returns the MX record for mail2.renovations.com. If mail2.renovations.com is unavailable, both MX records with a cost of 5 have failed. The DNS then selects MX records that have a cost of 10 and uses them the same way it used the MX records that have a cost of 5.