DNS MX and A records
As mentioned in the previous section, a web page only needs one DNS record for web browsers to find a the site. Email is slightly more complicated. Two DNS records are required for email delivery to be possible.
There are two types of DNS records that are important in email delivery. The A record and the MX record. The a record is typically what's used to resolve a web page. For example, If you point your browser at spam-dam.com your browser will try to resolve the name spam-dam.com into a more computer friendly IP address. This is done by querying the DNS server specified in your network configuration. The A record is looked up by the DNS server, and the corresponding IP address is returned.
The A record is what allows a BIND or DNS server to translate the name spam-dam.com into the computer friendly IP address of 66.249.10.153. For sending an Email, the MX record is first queried for, and then the corresponding A record. So when sending email to someone at mycompany.com, your Emil server will first look up the MX record for mycompany.com.
That MX record could be anything. Lets say the MX record returns mail.mycompany.com. Next, your mail server will query the a record for mail.mycompany.com to get the IP address of the mail server hosting the mycompany.com domain. That's how email is routed. There can be any number of hops an email takes during delivery. An email traveling to or from a large organization might have stop-overs at a dozen or more servers on its path to finally destination.
To clear things up a little, an A record consists of a name / IP pair. That is, the name spam-dam.com resolves to 66.249.10.153.
An MX record on the other hand is a name / name pair, such that mycompany.com -> mail.mycompany.com. So when the MX record lookup is performed on mycompany.com, the name returned is mail.mycompany.com.
The trick here, is that once I've setup my MX record so that mycompany.com -> mail.mycompany.com my next task is to create an A record such that mail.mycompany.com -> <some IP address>
Lets go over that again. You send an email to someone@mycompany.com. Your mail server does the MX lookup, and gets mail.mycompany.com. Then it does the A record lookup on mail.mycompany.com, and gets back the IP address of the email server hosting mycompany.com Simple, right?
Some DNS or BIND hosting companies will hide this complexity from you so that you need only specify something like mail.mycompany.com and the IP address of the mail server. But it is good to be aware of this distinction.
MX records have some other important parameters that become clear in the next section on secondary MX records.
|