transfer files between windows servers

Load Balance Incoming Email Using DNS MX Records

This article describes how load balancing can be achieved using DNS MX records. The steps provided are also applicable when load balancing incoming emails in a Multi-Server environment.

The following are two possible ways used to load balance mail servers using DNS:

  1. Define multiple MX records with the same priority
  2. Define multiple A records with the same name and different IP addresses

MX records, DNS and how emails are routed

A Mail Exchanger (MX) record is a type of resource record in the Domain Name System (DNS) specifying how Internet e-mail should be routed using the Simple Mail Transfer Protocol (SMTP). DNS provides a lookup of domain names to IP addresses. An MX record is a type of DNS record that identifies the IP address(es) responsible for a particular domain.

The MX record will usually return the Fully Qualified Domain Name (FQDN) of the mail server(s). For example, when you query for the MX records of test.com, you will get 2 FQDNs mx1.test.com and mx2.test.com. DNS then translates the FQDNs to an IP address which the sending mail servers use when sending emails.

The rest of the article will provide information on how to achieve load balancing for inbound emails. You only need to apply one of the solutions mentioned below, which assumes that you are load balancing 2 mail servers. The same steps apply if the number of mail servers is more than two.

Option 1: Define multiple MX records with the same priority

In this case, you will be defining 2 MX records with an equal value. This is illustrated in the example provided below.

The example shows that the two records have an equal MX Preference of 10. When using this method, the DNS server will return both MX records and their respective associated IP addresses. You may need to check how to configure your DNS server to provide the IP addresses in random order. The sending email server then selects one IP address based on this algorithm and uses it to deliver the mail.

Record FQDNRecord TypeMX PreferenceRecord Value
yourdomain.comMX10mail1.test.com
yourdomain.comMX10mail2.test.com

(IP addresses resolved below)

mail1.test.com A 10.0.0.1
mail2.test.com A 10.0.0.2

Option 2: Define multiple A records with the same name and different IP addresses

When using the second method, the IP addresses of your mail servers are defined in A records with the same name. This can be configured when MailEssentials is running on the SMTP gateway or multiple relay perimeter servers in a Multi-Server setup. The A record is then configured as the FQDN in the MX record. The sending mail server will then send the email to the first IP address in the list. You may need to check how to configure your DNS server to provide the IP addresses in random order.

Record FQDNRecord TypeMX PreferenceRecord Value
yourdomain.comMX10mail.test.com
yourdomain.comMX10mail.test.com

mail.test.com A 10.0.0.1
A 10.0.0.2

Leave a Reply

Your email address will not be published. Required fields are marked *

PHP Code Snippets Powered By : XYZScripts.com