Postfix 何时使用 IPv6,何时使用 IPv4?

Postfix 何时使用 IPv6,何时使用 IPv4?

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

答案1

您是否已设置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.

答案2

假设 Postfix 已正确配置 IPv6,并被指示使用这两种协议,而且它所连接的 MX 主机同时具有 A 和 AAAA 记录,那么 Postfix 每次都会做出随机选择,如下所示Wietse Wenema 本人解释道

最近的 Postfix SMTP 客户端在 IPv4 和 IPv6 之间随机选择,以便当两者之一发生故障时邮件不会被卡住。

相关内容