ietf-smtp
[Top] [All Lists]

Re: RFC 2821 Address Resolution

2004-01-04 13:24:02

Hector,

I am a newcomer to DNS so you must consider anything I write to be Non-authoritative. But last month I contributed code to the james.apache.org project which attempts to deal correctly with multi-homed MX hosts, and that code seems to have survived so far. The earlier code in James had found only one IP address for each MX host, even if that host had multiple homes (multiple A records), just as you describe for your former situation.

Just to make sure we are using the same language, a "host" is a name like mailin-02.mx.aol.com which you get in an MX record. A "home" is a single IP address (maybe even a single computer, but this is complicated enough already) which you get in an A record, assuming of course that I know what I am talking about, on which question I would bet even odds.

Oh yeah, and a "domain" is a thing like "aol.com". A domain may have multiple hosts, each with a priority number. A host may have multiple homes, with no indication of priority among the homes. To establish an SMTP connection to a domain, you should ideally not give up until you have tried all the homes of all the hosts.

As I understand RFC 2821, you are supposed to randomize any set of hosts which have the same priority, but you are not asked to randomize the multiple homes of any given host.

Thanks for introducing me to the nslookup command in Windows.

Hector Santos wrote:
> The logic I used is:
>
> 1) Sort the MX records (low to high) preference,
> 2) For each MX, add the A records to the final list removing duplicate ips.

That sounds right to me. My code does not look for or remove duplicate IPs; I do not remember seeing this suggested in the RFC, but it makes sense.

> what should I do with?
>
> aol.com MX preference = 15, mail exchanger = mailin-03.mx.aol.com
> aol.com MX preference = 15, mail exchanger = mailin-04.mx.aol.com
>
> where there is no A records for these exchanged returned in the MX query?

I think the A records appended to the reply to your MX query are put there only as an expedient, a way to fill up a packet with information which may be useful. I think a DNS resolver is supposed to cache this A-record information, since it may save a later call to a DNS server. Further, the list of A-records appended to a MX query does not pretend to be complete. The lists which you show appear to me to be truncated, perhaps at a size limit determined by the packet size.

I think you should make more calls to DNS, asking for A records. My Java code calls the DNS resolver again with an A-record query for each host. And here, with my newly learned nslookup command, I note that I can get this (seven IP addresses to add to the list:

C:\j>nslookup -querytype=a mailin-03.mx.aol.com
Server:  dsldns-nc.sprint-hsd.net
Address:  63.162.197.69

Non-authoritative answer:
Name:    mailin-03.mx.aol.com
Addresses:  64.12.138.57, 64.12.138.120, 205.188.156.249, 205.188.157.25
          205.188.159.217, 64.12.137.121, 64.12.137.152


> Anyway, what would you think the final list should be?

Your lists look correct to me, as far as prioritization of hosts is concerned, although perhaps incomplete as there may be many more A-records to be found.

An optimization: Since there are potentially many homes (maybe sometimes even 100) for a given domain, and since my logs indicate to me that the first attempt to connect to any home usually succeeds, 80% of the time or better, it may be wasteful to prepare the entire list of homes, sorted by host-priority, before attempting to connect to the first home in the list. The first attempt will probably succeed and make the rest of the list useless. Initially, my code does no more DNS lookups than necessary to find the first home that it should attempt for a domain; it postpones further DNS lookups and sorting until needed, if ever.

Rich Hammer
Hillsborough, N.C.


<Prev in Thread] Current Thread [Next in Thread>