Auteur: John Jetmore Date: À: Exim Users Sujet: [exim] Disconnect between docs and reality when choosing IPv4/IPv6
addresses?
I think I found a disconnect between the docs and the code with
respect to choosing which IP addresses to use when MX records have
both A and AAAA records. I haven't looked at the code yet, just
wanted to get a second opinion on my interpretation of the behavior.
The relevant doc (ch17, paragraph 2 and 3):
"MX records of equal priority are sorted by Exim into a random order.
Exim then looks for address records for the host names obtained from
MX or SRV records. When a host has more than one IP address, they are
sorted into a random order, except that IPv6 addresses are always
sorted before IPv4 addresses. If all the IP addresses found are
discarded by a setting of the ignore_target_hosts generic option, the
router declines."
As I read that, MX priority is always honored, then, if an individual
MX record points to both A and AAAA records, the AAAA record is
prefered. However, neither of those statements seems to be true.
To state simply before this wall of text, I believe that in practice
the presence of any AAAA record, in any MX host, will cause only AAAA
records to be considered for use.
Here are my tests:
1) a mail domain whose primary MX has both A and AAAA. Expect first
MX's AAAA record to be used, then first MX's A record. Actual
behavior: all non-AAAA records, for all MXs, are ignored.
jetmore@lappy:~/dev/exim-local/bin$ host mail-both.jetmore.net
mail-both.jetmore.net mail is handled by 6 mx-ipv6.jetmore.net.
mail-both.jetmore.net mail is handled by 10 g3.jetmore.net.
mail-both.jetmore.net mail is handled by 0 mx-both.jetmore.net.
mail-both.jetmore.net mail is handled by 5 mx-ipv4.jetmore.net.
jetmore@lappy:~/dev/exim-local/bin$ host mx-both.jetmore.net
mx-both.jetmore.net has address 192.168.0.41
mx-both.jetmore.net has IPv6 address fc00::c0a8:29
jetmore@lappy:~/dev/exim-local/bin$ exim -bt foo@???
R: dnslookup for foo@???
foo@???
router = dnslookup, transport = remote_smtp
host mx-both.jetmore.net [fc00::c0a8:29] MX=0
host mx-ipv6.jetmore.net [fc00::c0a8:74] MX=6
2) a mail domain whose primary MX only has an A record, but with AAAA
records on lesser priority MXs. Expect first MX's A record to be
used. Actual behavior: all non-AAAA records, for all MXs, are
ignored.
jetmore@lappy:~/dev/exim-local/bin$ host mail-ipv4.jetmore.net
mail-ipv4.jetmore.net mail is handled by 0 mx-ipv4.jetmore.net.
mail-ipv4.jetmore.net mail is handled by 5 mx-ipv6.jetmore.net.
mail-ipv4.jetmore.net mail is handled by 6 mx-both.jetmore.net.
mail-ipv4.jetmore.net mail is handled by 10 g3.jetmore.net.
jetmore@lappy:~/dev/exim-local/bin$ host mx-ipv4.jetmore.net
mx-ipv4.jetmore.net has address 192.168.0.41
jetmore@lappy:~/dev/exim-local/bin$ exim -bt foo@???
R: dnslookup for foo@???
foo@???
router = dnslookup, transport = remote_smtp
host mx-ipv6.jetmore.net [fc00::c0a8:74] MX=5
host mx-both.jetmore.net [fc00::c0a8:29] MX=6