DNS and Mail

In our earlier example, in the section on SMTP, we managed to telnet to port 25 on the MTA and send some mail. This was easily accomplished, as we knew the name of the machine that we wanted to connect to.

However, if we are sending mail to a different domain, we need to locate the name of the machine that handles mail for the domain; that is, the MTA. Once we know this, we can connect to it and perform the same task. To do this we use a DNS lookup, which will search for the domain's Mail Exchange (MX) records. These records are used to indicate the mail server. For example, if we search for the MX records for Sun's domain, we may see something similar to the following:

hydrogen# nslookup
Server:  antimony.solarisbootcamp.com
Address:  158.43.128.72

set type=mx
> sun.com
<lines removed for clarity>
sun.com preference = 40, mail exchanger = mx6.sun.com
sun.com preference = 40, mail exchanger = mx7.sun.com
sun.com preference = 5, mail exchanger = mx4.sun.com
sun.com preference = 5, mail exchanger = mx1.sun.com
sun.com preference = 5, mail exchanger = mx3.sun.com
sun.com preference = 5, mail exchanger = mx2.sun.com
sun.com preference = 15, mail exchanger = mx5.sun.com
<lines removed for clarity>
hydrogen#

This shows that there are a number of machines acting as mail servers. We can also see that each of them has a “preference” value associated with it. This is used to indicate the priority of the server. When a mailer daemon tries to send mail to the domain, it will try to communicate with a machine that has the lowest priority, moving on to the next if that fails, and so on. The values used do not mean anything other than the relative order of machines. This means that instead of assigning priorities of say 0, 10, and 20 to a series of machines, we could quite easily use 0, 1, 2, or even 5,061, 11,389, or 43,765, if we prefer.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset