Postfix with Gmail relay and IPv6

If you notice a message in maillog similar to the following, an easy fix (for now at least!) is to set Postfix to use IPv4:

error:
connect to smtp.gmail.com[2607:f8b0:4001:c05::6c]:587: Network is unreachable

As you can see from the error, Postfix is attempting to communicate with smtp.gmail.com by using an IPv6 address, and somewhere in the network path this is failing. Since IPv4 is still supported for now and will be well into the future, the best solution at this point is to simply set Postfix to use IPv4 and restart it:

vi /etc/postfix/main.cf

Find the line with “inet_protocols” and change it from “all” to “ipv4”:

# Enable IPv4, and IPv6 if supported
inet_protocols = ipv4

Finally, restart Postfix:

/etc/init.d/postfix restart

or

systemctl restart postfix

Be the first to comment

Leave a Reply

Your email address will not be published.


*