MX-record - what is it?

Table of contents:

MX-record - what is it?
MX-record - what is it?
Anonim

MX record, or mail exchanger record, is a type of resource record in the Domain Name System that specifies the mail server responsible for accepting email messages on behalf of the recipient's domain and a preference value used to prioritize mail delivery. A set of mail exchanger records on behalf of a domain specifies how email should be routed using the Simple Mail Transfer Protocol (SMTP).

mx records
mx records

MX Records: Technology Overview

Resource records are the primary information element of the Domain Name System (DNS). They differ in type identification (A, MX, NS) and DNS class (Internet, CHAOS). Records have an expiration date (time to live) assigned to them, indicating when the information they store must be updated from an authoritative name server. Resource records are organized in DNS based on their recipient's email FQDN (the part of the name after the symbol@).

Specific MX record payload information is the fully qualified domain name of the mail host and a preference value that should appear directly in one or more address records. When an email message is sent over the Internet, the sending agent Mail Transfer Service (MTA) queries the Domain Name System for MX records for each recipient domain. This query returns a list of mail exchange server hosts that accept incoming mail for this domain. The sending agent then attempts to establish an SMTP connection.

mx domain records
mx domain records

Prioritization basics

In the simplest case, a domain can have only one mail server. For example, if the MTA is looking up MX records for example.com and the DNS server only responds with mail.example.com with a preference count of 50, the MTA will attempt to send mail to the specified server. In this case, the number 50 can be any integer allowed by the SMTP specification. But when more than one server is returned for an MX request, the preference number for each entry determines the relative priority of the specified server. When a remote client (usually another mail server) does an MX lookup for a domain name, it gets a list of servers and their preference numbers. Any server with the lowest preference number should be checked initially. To ensure reliable mail transmission, the SMTP client must be able to check each of the matching addresses in this list in order until the delivery attempt succeeds.

Load balancing between arrays of mail servers

The method used to load load incoming mail across an array of servers must return the same preference number for each server in the set. When determining which server has an equal preference for sending mail, the sender must randomize them to spread the load across multiple mail exchangers for a particular organization. Multihomed servers are handled differently, as in this case any randomization is considered to have already been applied by the nameserver. It mainly deals with routing problems. Other types of server loading can be resolved using an SMTP proxy.

check mx records
check mx records

Backup

The target server, that is, the one that knows how to deliver the corresponding user's mailbox, is usually the preferred one. Lower priority servers, called standby or secondary MX records, typically keep messages in a queue while waiting for the primary server to show up. If both servers are online or somehow connected to each other, the MX backup will forward the email to the main mail exchanger. The backup acts as a vault.

How to set up MX records: priority

Mail is sent to the exchange server with the lowest preference number (highest priority), so the mail exchanger entry that is used for routing should have the lowest preference number, usually 0. Prioritydefines the order in which the servers should be associated (if multiple servers with different priorities are specified). The servers with the highest priority and lowest preference number will be checked first. In DNS records, the preference number is usually set and specified.

Setup errors

A common misconception about ordering domain MX record preferences is that it is intended to increase the likelihood of mail delivery. However, simply using multiple entries with the same preference provides this benefit.

configure mx records
configure mx records

Another common misinterpretation of the MX-preference order is that it is intended to provide a "failover" in the event of a server overload. While it can be used in this way, it is a poor resource management technique because it intentionally creates congestion, does not fully utilize the available hardware, and does not allow MX records to be checked. Assigning the same value to all available servers provides the same benefit, can help avoid congestion situations and thus increase system throughput by reducing latency.

SMTP logging

The SMTP protocol establishes a store-and-forward network, and if a domain's mail servers are offline, the sending servers need a queue of messages destined for that domain to try again later. However, these sending servers cannot be notified that there are now availablestand-alone domain servers and only detect that the domain is available if the next attempt is made when sending deferred messages.

check domain mx record
check domain mx record

The delay between when domain servers come online and when pending messages are finally delivered can be anywhere from minutes to several days, depending on the retry schedule of the sending servers. The problem is that the backups are uniquely qualified to solve and do not allow you to check the MX record of the domain.