Change Outgoing IP of Postfix Mail Server

This can get quite important when your mail server is blacklisted, or if you somehow want to simply change the outgoing IP address.

First of all, check that you DO have another ip address on another interface at the server. Either by ifconfig or anything else.

To change the outgoing IP on a postfix mail server, edit the file /etc/postfix/master.cf

Find this part in the file,
smtp      unix  -       -       -       -       -       smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay     unix  -       -       -       -       -       smtp
-o smtp_fallback_relay=
You should modify it to look like below
smtp      unix  -       -       -       -       -       smtp
-o smtp_bind_address=192.168.1.1
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay     unix  -       -       -       -       -       smtp
-o smtp_bind_address=192.168.1.1
-o smtp_fallback_relay=
Of course, change the IP address 192.168.1.1 to whatever your secondary IP is.

Then restart and reload the postfix server.
[root@mail ~]# /etc/init.d/postfix restart
Shutting down postfix:                                     [  OK  ]
Starting postfix:                                          [  OK  ]
[root@mail ~]# /etc/init.d/postfix reload
Reloading postfix:                                         [  OK  ]
  • Email, SSL
  • 9 Users Found This Useful
Was this answer helpful?

Related Articles

Setting time with NTP in LINUX

NTP (Network Time Protocol) could be used to set time synced with ntp clocks, to do this use the...

Linux version & Operating System info

LINUX Version Info To learn the architecture and kernel version info use the shell command...

Build PHP5.5 on CentOS 6.4 with MSSQL Support [cite]

Most of the yum repos doesn’t include PHP5.5.X on current releases for the time being. So...

Add New Hosting to a System Installed With Plugged.sh

If you use our LAMP installer script and want to add a new domain afterwards, we’ve created...

Getting Network Information in Bash Scripts

Sometimes when writing your bash scripts, you may need some information about the network, such...