Yes, Pedro, you can configure Postfix to use IPv4 only for outgoing connections while allowing both IPv4 and IPv6 for incoming connections. This is useful for your case, where Spamhaus checks against IPv6/64 and your server has an IPv6/128 address.
To force Postfix to use IPv4 only for outgoing connections, set the following in /etc/postfix/main.cf:
inismtp_address_preference = ipv4
This ensures that Postfix will only use IPv4 when connecting to other mail servers.
To allow both IPv4 and IPv6 for incoming connections, ensure the following settings are in place:
iniinet_protocols = all inet_interfaces = all
This allows Postfix to accept connections on both IPv4 and IPv6.
smtp_address_preference = ipv4: Forces Postfix to use IPv4 for outgoing SMTP connections.inet_protocols = all: Allows Postfix to listen on both IPv4 and IPv6 for incoming connections.After making these changes, reload Postfix:
bashsudo systemctl reload postfix
Check the active configuration:
bashsudo postconf | grep -E 'smtp_address_preference|inet_protocols|inet_interfaces'
Confidence level: High (95%) This configuration is standard and widely used in Postfix deployments.
Vibe can make mistakes. Check answers. Learn more