Cannot config Postfix to send IP4 only

SYSTEM INFORMATION
Ubuntu 22.04.5
2.202 Webmin version REQUIRED
7.30.2 PRO Virtualmin version REQUIRED
APACHE 2.4.52Webserver version REQUIRED
POSTFIX 3.6.4Related packages SUGGESTED

I am trying to set postfix to only send via IP4

I have read the posts here suggesting to change inet_protocols = all in main.cf to inet_protocols = v4

As soon as I do that postfix crashes and I have to manually edit it back to = all to get postfix back.

How do I configure postfix to only send via IP4?

Cheers
Spart

That is not valid (ipv4 would be valid). If there are posts here suggesting that, they are wrong. Please link it, and I will make sure it gets corrected or deleted.

I suggest you read the Postfix docs here: Postfix Configuration Parameters

The sections inet_interfaces and inet_protocols have what you’re after, so search for that.

You are typing in ipv4 not just v4 (Joe beat me)

My postfix is rigged for ipv4, I can post my config tommorow. You will need to make some changes so it matches your hostname.

Many thanks all for the replies. I may have a route to solve the actual issue related to email deliverability with gmail MS etc. It seems some changes at our host made a mess of our PTR records.

They are sorting and hopefully that will solve the issue and allow the use of IPV4 or IPV6. Is there a way to say prefer IPV4?

Cheers

The docs I linked covers that. Specifically, smtp_address_preference

Many thanks Joe.

Posting this snippet here as that is one mega doc!

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

The setting "smtp_address_preference = ipv6" is unsafe. All deliveries will suffer delays during an IPv6 outage, even while the destination is still reachable over IPv4. Mail may be stuck in the queue with Postfix versions < 3.3 that do not implement "smtp_balance_inet_protocols". For similar reasons, the setting "smtp_address_preference = ipv4" is also unsafe.

The setting "smtp_address_preference = any" is safe. With this, and "smtp_balance_inet_protocols = yes" (the default), only half of deliveries will suffer delays if there is an outage that affects IPv6 or IPv4, as long as it does not affect both.

The setting "smtp_address_preference = ipv4" is not a solution for remote servers that flag email received over IPv6 as more 'spammy' (the client IPv6 address has a bad or missing PTR or AAAA record, bad network neighbors, etc.). Instead, configure Postfix to receive mail over both IPv4 and IPv6, and to deliver mail over only IPv4.


It seems to suggest the best setting is ‘any’ with the default “smtp_balance_inet_protocols = yes”

It also seems to suggest this field needs to be set in master.cf and main.cf

The setting “smtp_address_preference = ipv4” is not a solution for remote servers that flag email received over IPv6 as more ‘spammy’ (the client IPv6 address has a bad or missing PTR or AAAA record, bad network neighbors, etc.). Instead, configure Postfix to receive mail over both IPv4 and IPv6, and to deliver mail over only IPv4.

This is the config I may need, but it not clear how to config postfix to receive on both IPV4 and IPV6 and only send on IPV4.

If I look at the associated config items. Setting inet_interfaces = all is stated as equivalent to inet_interfaces = ipv4, ipv6 so that should set postfix to ‘receive’ on both.

Then setting inet-protocols = all is equivalent to inet_protocols = ipv4, ipv6 and then setting smtp_address_preference = ip4 will try ip4 first then use ip6 if there is an issue.

But the result is it is still using IPV6 for gmail!

Cheers

1 Like

look at this setting: inet_protocols = ipv4 it is probably what you want.

I think my smtp_address_preference is left as default so might not be defined in main.cf.

This should give the location of the IP settings.

Just posting the answer back.

Teh only change I needed to make was to enter a new parameter smtp_address_preference = ipv4 with the other parameters set as all. Did work. Still testing but looks good.

Also I finally got my hosting provider to config a PTR for the IPv6 address. They delegate IPv4 PTR records but not IPv6.

Gmail seems to be accepting mail again.

Thank you to all for you helpful comments.

Cheers

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.