Postfix什么时候使用IPv6,什么时候使用IPv4?

naz*_*zco 12 email postfix ipv6

我已经为 IPv6 和 IPv4 配置了我的邮件服务器,但在大多数情况下它使用 IPv4,而 IPv6 在远程主机上可用。我在 2.9 版中使用 Postfix。所以我的想法是 postfix 使用 IPv6(如果可用)并回退到 IPv4 还是我错了?

and*_*dol 15

您是否将smtp_address_preference选项设置为显式首选 IPv6?

从 postconf(5):

smtp_address_preference (default: any)
       The address type ("ipv6", "ipv4" or "any") that the Postfix SMTP client will try first, when a destination has IPv6 and IPv4 addresses with equal MX preference. This feature has no effect unless  the
       inet_protocols setting enables both IPv4 and IPv6.  With Postfix 2.8 the default is "ipv6".

       Notes for mail delivery between sites that have both IPv4 and IPv6 connectivity:

       ·      The setting "smtp_address_preference = ipv6" is unsafe.  It can fail to deliver mail when there is an outage that affects IPv6, while the destination is still reachable over IPv4.

       ·      The setting "smtp_address_preference = any" is safe. With this, mail will eventually be delivered even if there is an outage that affects IPv6 or IPv4, as long as it does not affect both.

       This feature is available in Postfix 2.8 and later.
Run Code Online (Sandbox Code Playgroud)

  • 在可以通过 IPv6 连接但存在其他问题的情况下,它会很有用。没有为源 IPv6 地址设置反向 DNS 是很常见的。目标(即 Google Mail)接受 IPv6 连接,但随后拒绝您的邮件,因为反向 DNS 检查失败。当您更喜欢 IPv6 时,您总是会遭到拒绝。当您随机化协议时,消息可能会延迟一点,但在下一次尝试时它会通过。 (4认同)
  • 不确定在什么条件下会发生这种故障。我自己设置了“smtp_address_preference = ipv6”,并验证了在针对 AAAA 记录的连接失败后它回落到 A 记录的情况。 (3认同)