Setting Up Mail Server Records in the DNS
To set up your mail server in the DNS, you must create the records that other mail servers use to find and connect to your mail server. Making these entries requires that you first have:
- A registered Internet domain name for your local network (for example, domain.com).
- A DNS server for your local network.
Your Local Network's DNS server
Before your mail server can communicate with other mail hosts, you must configure the DNS server to recognize your mail server. Without a functional and correctly set DNS, IMail Server cannot deliver mail, except to domains that are within IMail Server.
For each mail host on your network, you must make the following entries in your DNS:
- An MX record for the mail domain (for example, domain.com). The MX record identifies the host name of the mail host.
- Note that mail hosts (virtual hosts) that do not have an IP address require only an MX record.
- An A record for the host name of the mail host. The A record maps a host name to an IP address.
- A PTR record for the IP address of the mail host. The PTR record maps an IP address to the host name and is used for reverse lookups.
Since there are DNS servers from many vendors available, we cannot describe how to create the records for your specific DNS server. Instead, we show an example using a basic configuration for a single mail host.
Example of a Basic Configuration
In this example, we use a DNS lookup tool to query the DNS server and show the responses. You can use the Windows NT command line program, NSLOOKUP, to query a DNS server. If you are not familiar with this tool, we suggest the Ipswitch WS_Ping ProPack application, which provides a graphical interface for querying a DNS server. Use the Lookup tool in WS_Ping ProPack.
To describe the DNS entries for a mail server, we use examples from a typical small network and start with the following assumptions:
- You have one computer with a network interface card (NIC) installed.
- You have set the IP address for this computer to a valid address within your range of addresses. In the example, we will use 220.127.116.11.
- You have assigned this computer a host name that is valid in your domain. In the example, we will use mail.domain.com.
- You have designated another SMTP server to act as a backup if your mail server is down. In the example, we will use cecil.domain.com.
You must set up the following records for the computer:
- An MX record for the domain domain.com that points to the host name of the computer running IMail (mail.domain.com).
- An A record for mail.domain.com
- A PTR record for mail.domain.com
E-mail for the users on this mail host is addressed to email@example.com.
First, we do an MX lookup (just as a sending mail server would do) to find the mail host for the domain.com network. To simulate this, in the WS_Ping ProPack's Lookup tool, we enter domain.com in the Name/Address box and MX as the Query Type, which returns the following:domain.com10, mail.domain.com 50, cecil.domain.com
This shows that mail.domain.com and cecil.domain.com are both mail hosts for the domain.com network. The cecil.domain.com host is a backup mail server. The number indicates the priority of the mail host - it tells the sending mail server which mail host to try first. The lower the number, the higher the priority. In our case, mail.domain.com is the one we want other mail servers to use first; cecil.domain.com is used only if mail.domain.com is down.
For information about how a backup mail server works, see "Setting Up IMail Server as a Backup Mail Spooler" in the IMail Server User's Guide.
Only a host name is returned in response to an MX query. The sending mail server needs the IP address of this host name so it can connect to the mail host. The sending mail server performs another DNS lookup to get the IP address (defined in the A record) of highest priority mail host. To simulate this, in the Lookup tool, we enter mail.domain.com in the Name/Address box and A as the Query Type, which returns the following:mail.domain.com18.104.22.168
If we query the A record for cecil.domain.com, we get:cecil.domain.com22.214.171.124
With the IP address for the mail.domain.com host, the sending mail server can now connect to that host and deliver the mail. If the attempt is successful, there is no need to go any further. However, if the mail.domain.com host is down, the connection attempt fails and the sending mail server will have to try the next highest priority MX record, in this case, cecil.domain.com.
Sample DNS Records
If we use a DNS lookup tool to query the DNS server for the network in our example (for all information, in verbose mode), you would see entries like the following:domain.com. IN MX 50 cecil.domain.com.IN MX 10 mail.domain.com
cecil.domain.com. IN A 126.96.36.199 mail.domain.com. IN A 188.8.131.52 184.108.40.206.in-addr.arpa.,type = PTR host = mail.domain.com 220.127.116.11.in-addr.arpa.,type = PTR host = cecil.domain.com
If you have multiple mail hosts on your IMail Server, you will need an MX, A, and PTR record for each host. The "Configuration" chapter in the IMail Server User's Guide describes some advanced configuration topics and describes the DNS entries you must make for these advanced configurations.