Tutorials

Specify Alternate Text

DNS Records and MS Exchange Email

A popular topic on the forum is about the configuration of Public DNS records to allow the delivery of SMTP email direct to your exchange server.

Author: Robert Pearman

If you are not lucky enough to have a hosting partner who knows what, or how, to configure this for you it can be a worrying time, where half way through a migration or setup, you discover that email is not flowing, or something that has happened to me on two separate occasions, you have to abort an installation half way through because someone somewhere cant edit a record, or because you simply cant find the right person at your hosting company to ask.

So with all this in mind, I thought it might be an idea to write down the basics to serve as not only a guide, but also a check list for you to tick off if you are about to switch over from POP3 email to your first SMTP server, or even if you are switching hosting company’s, ISP, or your just curious as to how it all works.

The first thing to understand, is the terminology behind the various different DNS records. In SMTP email we only need to focus on two types of record – A (Host) records, and MX records. Hopefully all of you will be familiar with the term host name. This is what we refer to a computer or server by, a friendly name we can use instead of remembering an IP address. The host name is the unique portion of the FQDN (fully qualified domain name) for any PC. For example, my computer I am using to write this article is Operations-01, the fully qualified domain name of my computer is Operations-01.sbs.local. A fully qualified domain name, is simply the hostname and the domain name it belongs to. This is also mirrored on the internet. A server with an internet connection has a public host name, and an FQDN. However on the internet we only ever use the FQDN to connect to it. For example, I have a web server named WWW. It belongs to the domain msjr.co.uk so it’s FQDN is www.msjr.co.uk. The host name, is JUST – WWW, this is an A (Host) record which is created inside the public DNS zone, msjr.co.uk. The A(Host) record has a public IP address associated with it. If we open up a CMD prompt we can run some simple commands to find this information.

Click start, then run, then type CMD and press enter. (Users of Windows Vista, or Windows 7, just type CMD into the search bar after clicking the Windows Pearl). From your command prompt, type:

Nslookup www.msjr.co.uk

You will receive some information back, which tells us that www.msjr.co.uk is located at: 81.81.81.100
DNS Records and MS Exchange Email
An A(Host) record is the first record you need to have setup in order to have SMTP email, the host name of this record can be anything you want it to be, however most people use the word ‘mail’ or ‘smtp’ as their host record for email. If you have control over your DNS zone, or if you have a hosting partner that controls it for you, set yourself up a new A(Host) record and make sure it is pointing to the public IP Address of the firewall device you have in front of your SMTP Server, in this example I am adding a new record ‘Mynewhostrecord’ which I will point to my public ip address 81.81.81.200. When it is created, perform an nslookup to verify it has been created correctly.

From a CMD prompt, type

Nslookup Mynewhostrecord.msjr.co.uk

DNS Records and MS Exchange Email
You will hopefully see your new record and the correct IP address returned. Note : If you are editing an existing A(Host) record, it may take a few hours to see the changes, so this is why I would suggest creating a brand new record. At this point we should now have an A(host) record that points to our public IP address. From an external source, such as your home internet connection, you should now be able to ping your public IP address using this new FQDN.

From a CMD prompt, type

Ping mynewhostrecord.msjr.co.uk

You should see:

DNS Records and MS Exchange Email

Pinging mynewhostrecord.domain.com [XXX.XXX.XXX.XXX] with 32 bytes of data:

I have two MX records one is a preference 5, the other a preference 10. If someone sends me a message, their mail server will first attempt to deliver the message to the server identified by the MX record with preference 5 – if this is unsuccessful, the message will be resent to the server identified by the MX record with preference 10.

msjr.co.uk

It is not important that you receive replies, or request timed out to this ping request – the important thing here is that you can see you’re A(Host) record name, and the correct public IP address beside it. Now we can move on to the creation of our MX record. When an email server sends a message from one address to another, the sending server must find out what the IP address of the destination server is. To do this the sending server performs a DNS lookup of the email recipients server address, this information is stored on the internet as an MX (Mail Exchanger) record. It is simply a sign post to the A(Host) record of the recipients server, which in turn points to the public IP address of their mail server. The MX record itself contains two pieces of information, the destination A(Host) record, and it’s preference. The preference of an MX record is a value which identifies it’s priority compared to any other MX records you may have for your domain. You can have multiple MX records to allow for redundancy and load balancing. The lower the preference the higher priority that MX record has. For example, for my domain

You can alter the nslookup tool to only show you information regarding MX records by typing

Set type=mx into your nslookup session

DNS Records and MS Exchange Email
Your cursor will be returned to the next line, you can now query your DNS server for MX record information. Enter just the domain name of the domain you wish to check, in my example I enter just

Msjr.co.uk <enter>

As you can see I receive two MX records in response to my query, I also then receive the information for the A(Host) records that make up the MX records.

msjr.co.uk MX preference = 10, mail exchanger = mynewhostrecord.msjr.co.uk

msjr.co.uk MX preference = 5, mail exchanger = mail.msjr.co.uk

mynewhostrecord.msjr.co.uk internet address = 81.81.81.200

mail.msjr.co.uk internet address = 81.81.81.205

From this output I can see that email for msjr.co.uk should be first routed to mail.msjr.co.uk at public ip address 81.81.81.205, if this fails mail will be routed to mynewhostrecord.msjr.co.uk at 81.81.81.200. You should already have setup your SMTP server so it is ready to receive email, and also created all the required email addresses for your users. At this point you can now open up your firewall/router to receive SMTP mail. You should open TCP port 25 only. This should be directed to the IP Address of your SMTP server, if using SBS 2003 Premium, this is the EXTERNAL IP of your SBS Server. If using SBS 2003 Std, or SBS 2008 – use your SBS servers IP Address (it should only have one)

Reverse DNS

Reverse DNS is also a subject that comes up in the forum quite often, and again due to inexperienced hosting or ISP staff can lead to some headaches for the SBS administrator. Reverse DNS is the process of looking up an IP address and resolving that to an FQDN. In 99% of cases it is the responsibility of the ISP – The company providing your internet connection – to create a Reverse DNS entry for you. That is not to say they HAVE to, it may be an extra chargeable service for some ISP’s however the fact remains that they alone have the power to create the entry for you. More discussion on RDNS is beyond the scope of this article but can be found here http://en.wikipedia.org/wiki/Reverse_DNS_lookup. Suffice to say, that having RDNS is a requirement to send email to a lot of mail servers. If you do not have RDNS you may find that some of your email is rejected, especially to large companies like AOL. If your ISP has delegated control of the RDNS zone for your IP Address (which is quite rare) you will have to host the zone yourself, and you will then be responsible for the creation of the records. In my opinion hosting your own DNS zones is not a best practice and should be discouraged, and I would suggest you look to move to an ISP which can do this for you. Your RDNS record, should map your public IP address to an FQDN. It does not have to be the same FQDN that you use for your MX records, however to keep things simple it is often the best way to do things.

If you open a CMD prompt, and enter

Nslookup

To perform a reverse lookup, enter simply the IP Address you wish to check in this example I enter

81.81.81.200

I am shown the result –

Name: mynewhostrecord.msjr.co.uk

Address: 81.81.81.200

This shows that my RDNS record is working correctly.

Hopefully this article has been useful in explaining the basics of setting up DNS for SMTP Email.

About www.server-essentials.com 

www.server-essentials.com is founded by Mariette Knap, a Dutch Microsoft MVP. www.server-essentials.com is a community for IT Consultants and Business Owners who, themselves, take care of the IT infrastructure and Employees who do that little extra in the company to keep things running. Our forum is for discussing all things ‘IT’ and more.  Our documentation is top notch and written by and for the community.

Change your cookie settings


 
Contact Us

Concentrix BV

C. de Rijcklaan 1

3723 PM Bilthoven

The Netherlands

KvK 30202318

VAT Id 814036739B01

The layout of this page is made to be viewed online.