by Sangeetha Naik, co-Founder, Bobcares.com
MX stands for Mail Exchange Records. MX records are used in DNS records(or Zone files) to specify how email should be routed.
Lets take an example of say firstname.lastname@example.org.
This is what a typical DNS record(for mydomain.com) looks like.
; ; Zone file for mydomain.com @ 14400 IN SOA ns.mynameserver.com. root.ns.mynameserver.com. ( 109157199 86000 7200 3600000 600 ) mydomain.com. 14400 IN NS ns.mynameserver.com. mydomain.com. 14400 IN NS ns2.mynameserver.com. mydomain.com. 14400 IN NS ns3.mynameserver.com. ; A Record mydomain.com. 14400 IN A 126.96.36.199 localhost.mydomain.com. 14400 IN A 127.0.0.1 ; MX record mydomain.com. 14400 IN MX 0 mydomain.com. mail 14400 IN Cname mydomain.com. www 14400 IN Cname mydomain.com. ftp 14400 IN Cname mydomain.com.
Notice the line with the ``MX'' in it. This is called the MX record.
mydomain.com. 14400 IN MX 0 mydomain.com.
The MX record shows that all emails @ mydomain.com should be routed to the mail server at mydomain.com. The DNS record shows that mydomain.com is located at 188.8.131.52. This means that email meant for email@example.com will be routed to the email server at 184.108.40.206. This finishes the task of the MX record. The email server on that server(say sendmail) then takes over, collects the email and then proceeds to distribute it to the user ``liz''.
It is important that there be a dot(``.'') after the domain name in the MX record. If the dot is absent, it routes to ``mydomain.com.mydomain.com''. The number 0, indicates Preference number. Mail is always routed to the server which has the lowest Preference number. If there is only one mail server, it is safe to mark it 0.
Multiple email servers are useful for the sake of redundancy. If the Highest Priority email server (one with the lowest Preference number) is down, then the email is routed to the Server with the second highest Preference number.
mydomain.com. 14400 IN A 220.127.116.11 server2.mydomain.com. 14400 IN A 18.104.22.168 mydomain.com. 14400 IN MX 0 mydomain.com. mydomain.com. 14400 IN MX 30 server2.mydomain.com.
You can have unlimited MX entries for Fallback.
If all the MX records are equal Preference numbers, the client simply attempts all equal Preference servers in random order, and then goes to MX record with the next highest Preference number.
Its not possible to have an MX record pointing directly to an IP. For example 'mydomain.com. 14400 IN MX 0 22.214.171.124`` is wrong. Define an ``A Record'' first and then have the MX record pointing to it.
server2.mydomain.com. 14400 IN A 126.96.36.199 mydomain.com. 14400 IN MX 30 server2.mydomain.com.
A Subdomain is something like this ``Subdomain.mydomain.com''. Assume you want to send an email to firstname.lastname@example.org and to capture that on another server.
mydomain.com. 14400 IN A 188.8.131.52 server2.mydomain.com. 14400 IN A 184.108.40.206 mydomain.com. 14400 IN MX 30 mydomain.com. subdomain.mydomain.com. 14400 IN MX 30 server2.mydomain.com.
In this configuration, email@example.com would go to 220.127.116.11 and firstname.lastname@example.org would go to 18.104.22.168.
Once you setup your MX record, always test it to see if it is setup correctly. You can do with tools like nslookup.
[root@localhost sangeetha]# nslookup > set q=mx > yahoo.com Server: 192.168.1.1 Address: 192.168.1.1#53 Non-authoritative answer: yahoo.com mail exchanger = 1 mx1.mail.yahoo.com. yahoo.com mail exchanger = 1 mx2.mail.yahoo.com. yahoo.com mail exchanger = 1 mx3.mail.yahoo.com. yahoo.com mail exchanger = 5 mx4.mail.yahoo.com. Authoritative answers can be found from: yahoo.com nameserver = ns2.yahoo.com. yahoo.com nameserver = ns3.yahoo.com. yahoo.com nameserver = ns4.yahoo.com. yahoo.com nameserver = ns5.yahoo.com. yahoo.com nameserver = ns1.yahoo.com. mx1.mail.yahoo.com internet address = 22.214.171.124 mx1.mail.yahoo.com internet address = 126.96.36.199 mx1.mail.yahoo.com internet address = 188.8.131.52 mx1.mail.yahoo.com internet address = 184.108.40.206 ns1.yahoo.com internet address = 220.127.116.11 ns2.yahoo.com internet address = 18.104.22.168 ns3.yahoo.com internet address = 22.214.171.124 ns4.yahoo.com internet address = 126.96.36.199 ns5.yahoo.com internet address = 188.8.131.52 >
Spammers will typically target your lowest priority Email servers, in the hopes of encountering a poorly configured box. The Spam program reads the MX records, locates the Email server with the lowest Priority(highest Preference number) and attempts to spam with that server.
So it is important to equally update all your email servers with Antivirus and Antispam.
Sangeetha Naik is Co-Founder of Bobcares.com, Tech support company for WebHosts and ISPs .Bobcares is an ISO 9001:2000 certified company and employes over 140 engineers.
Got something to add? Send me email.
(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Printer Friendly Version
Increase ad revenue 50-250% with Ezoic
More Articles by Sangeetha Naik © 2012-07-15 Sangeetha Naik