Polarian via Postfix-users: > Hello, > > Firstly thank you for the response. > > > RFC 5321 requires that the Postfix SMTP CLIENT connects to hosts > > with primary MX preference, before connecting to hosts with a > > secondary MX preference. > > > > For example, given the following DNS records: > > > > example.com. IN MX 10 primary.example.com > > example.com. IN MX 20 secondary.example.com > > > > primary.example.com. IN AAAA fc00::1 > > primary.example.com. IN A 10.0.0.1 > > > > secondary.example.com. IN A 10.0.0.2 > > secondary.example.com. IN AAAA fc00::2 > > > > With "smtp_address_preference = ipv4", Postfix will connect to: > > > > - First, MX preference 10 address 10.0.0.1, then fc00::1, > > > > - Then, MX preference 20 addresses 10.0.0.2, then fc00::2. > > This is the expected behaviour, I do not see why this needed to be > clarified, but thank you anyways \o/
You asked this question: > What technology do you use to pick between the protocols? So I helpfully gave you that answer. > preference implies priority, so what you are saying here is if you set > it to prefer IPv6, then it will ONLY attempt IPv6 addresses? Look back at the lengthy example that I gave above for the case that "smtp_address_preference = ipv4". It should not be difficult adapt that example for the case that "smtp_address_preference = ipv6". But in case that it is too difficult, I'll do it for you. Given the following DNS records: example.com. IN MX 10 primary.example.com example.com. IN MX 20 secondary.example.com primary.example.com. IN AAAA fc00::1 primary.example.com. IN A 10.0.0.1 secondary.example.com. IN A 10.0.0.2 secondary.example.com. IN AAAA fc00::2 With "smtp_address_preference = ipv6", Postfix will connect to: - First, MX preference 10 address fc00::1, then 10.0.0.1. - Then, MX preference 20 addresses fc00::2, then 10.0.0.2. > What if I simply want to prioritise one, and use the other as a > fallback? That seems the more logical way of doing it. RFC 5321 requires that an MTA connects to primary MX addresses before secondary MX addresses. RFC 5321 does not allow an MTA to connect to IPv6 primary and secondary MX addresses, before IPv4 primary and secondary MX addresses. > - IPv6 should be attempted first In the example above, Postfix tries to reach the primary MX over IPv6, before trying to reach the primary MX over IPv4. If the primary MX is not available, Postfix tries IPv6 before IPv4 for the secondary MX. > - IPv4 should be attempted as a fallback if the IPv6 route did not > exist (remote doesn't support IPv6, aka no AAAA record) Postfix does not try to connect over IPv6 when a destination has no AAAA record. Hint: in the examples above, delete the AAAA records and keep the A records. Let me do that for you: Given the following DNS records: example.com. IN MX 10 primary.example.com example.com. IN MX 20 secondary.example.com primary.example.com. IN A 10.0.0.1 secondary.example.com. IN A 10.0.0.2 With all possible smtp_address_preference settings, Postfix will connect to: - First, MX preference 10 address 10.0.0.1. - Then, MX preference 20 address 10.0.0.2. > - Emails should ALWAYS be deliverable, it should NOT get stuck within > the queue trying to connect to a single protocol, IPv4 should only be > used as a fallback. Follow the rules of RFC 5321, use "smtp_address_preference = ipv6". See the example above for details. Keep in mind that RFC 5321 does not allow this order: - First, MX preference 10 address fc00::1, then, MX preference 20 address fc00::2. - Then, MX preference 10 address 10.0.0.1, then, MX preference 20 address 10.0.0.2. You could try to fake it with: main.cf: default_transport = smtp6 smtp_fallback_transport = smtp4 master.cf: smtp6 .... smtp -o inet_protocols=ipv6 smtp4 .... smtp -o inet_protocols=ipv4 But that would not work. When a domain has MX hosts with only A records, the smtp6 client will return mail as undeliverable with "Name service error for name=mx.example.com type=AAAA: Host found but no data record of requested type". You would also have to configure an smtp_delivery_status_filter that replaces a '5.x.x' status code for "Name service error for name=mx.example.com type=AAAA: Host found but no data record of requested type" with a '4.x.x' status code. And you might have more hoops tp jump through. Or you could just play by the rules of RFC 5321, and follw the easy path. Wietse _______________________________________________ Postfix-users mailing list -- postfix-users@postfix.org To unsubscribe send an email to postfix-users-le...@postfix.org