HomeWeb HostingReseller Web HostingDedicated ServerResources & Support
 

What is an MX Record..!!!

==============
Introduction:
==============

MX = Mail Exchange.
An MX record or Mail exchange record is a type of resource record in the Domain Name System (DNS or Zone file) specifying how Internet e-mail should be routed. Shortly we can say MX stands for Mail Exchange Records.

Let’s take an example of say test@yourdomain.com.

This is how a typical DNS record (for yourdomain.com) looks like.

Zone file for yourdomain.com

@14400 IN SOA ns.yournameserver.com. root.ns.yournameserver.com. (1091571998600072003600000600)
yourdomain.com. 14400 IN NS ns1.yournameserver.com.
yourdomain.com. 14400 IN NS ns2.yournameserver.com.
yourdomain.com. 14400 IN NS ns3.yournameserver.com.

===============
A Record:
===============
yourdomain.com. 14400 IN A 208.60.84.193

localhost.yourdomain.com. 14400 IN A 127.0.0.1

===============
MX record:
===============
yourdomain.com. 14400 IN MX 0 yourdomain.com.
mail   14400 IN CNAME yourdomain.com.
www    14400 IN CNAME yourdomain.com.
ftp    14400 IN CNAME yourdomain.com.


Notice the line with the “MX'' in it. This is called the MX record.

yourdomain.com. 14400 IN MX 0 yourdomain.com.

The MX record shows that all emails @ yourdomain.com should be routed to the mail server at yourdomain.com. The DNS record shows that yourdomain.com is located at 208.60.84.193. This means that email meant for alex@yourdomain.com will be routed to the email server at 208.60.84.193. This finishes the task of the MX record. The email server on that server(say send mail) then takes over, collects the email and then proceeds to distribute it to the user “alex''.

======================
Multiple mail servers:
======================

Multiple mail 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.

For example

yourdomain.com. 14400 IN A 208.60.84.193
server2.yourdomain.com. 14400 IN A 208.60.84.194
yourdomain.com. 14400 IN MX 0 yourdomain.com.
yourdomain.com. 14400 IN MX 30 server2.yourdomain.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.

=============================
Pointing MX records to an IP:
=============================

It is not possible to have an MX record pointing directly to an IP address. For example, “yourdomain.com. 14400 IN MX 0 216.34.94.184” is wrong. Define an “A Record'' first and then have the MX record pointing to it.

server2.yourdomain.com. 14400 IN A 208.60.84.194
yourdomain.com. 14400 IN MX 30 server2.yourdomain.com.

============================
MX records for Subdomains:
============================

A Subdomain is something like this “Subdomain.yourdomain.com''. Assume you want to send an email to alex@subdomain.yourdomain.com and to capture that on another server.

yourdomain.com. 14400 IN A 208.60.84.193
server2.yourdomain.com. 14400 IN A 208.60.84.194
yourdomain.com. 14400 IN MX 30 yourdomain.com.
subdomain.yourdomain.com. 14400 IN MX 30 server2.yourdomain.com.

In this configuration, alex@subdomain.yourdomain.com would go to 208.60.84.194 and alex@yourdomain.com would go to 208.60.84.193.

==========================
Testing the MX record:
==========================

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 aden] # 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 = 4.79.181.14
mx1.mail.yahoo.com internet address = 4.79.181.15
mx1.mail.yahoo.com internet address = 67.28.113.10
mx1.mail.yahoo.com internet address = 67.28.113.11
ns1.yahoo.com internet address = 66.218.71.63
ns2.yahoo.com internet address = 66.163.169.170
ns3.yahoo.com internet address = 217.12.4.104
ns4.yahoo.com internet address = 63.250.206.138
ns5.yahoo.com internet address = 216.109.116.17
>

=============================
How spammers read your MX:
=============================

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.

Alex R.


(Posted By Alex on Tuesday, April 18, 2006)

 Read All Stories
 


Copyright 2003 - 2009 All rights reserved Accu Web Hosting