Changing Postfix Outbound IP Address
Published on January 25, 2016•Updated on November 21, 2023
When a server has more than one IP address assigned to it, Postfix randomly selects an IP address for outbound emails. This default Postfix behavior can result in emails being listed as spam due to the sending IP not matching the IP address to which the server hostname is resolving.
The solution is to bind Postfix to the server's primary IP, or the IP to which the server's hostname is resolving.
Using your favorite text editor, open the Postfix configuration file:
vim /etc/postfix/main.cf
Add the line:
smtp_bind_address = 192.168.0.1
Where 192.168.0.1 has to be replaced with the primary IP address of the server.
Then, restart Postfix:
/etc/init.d/postfix restart