Topic: Bind multiple IP addresses postfix

- iRedMail version (check /etc/iredmail-release):  0.9.9
- Deployed with iRedMail Easy or the downloadable installer? easy
- Linux/BSD distribution name and version: Debian 9
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): mysql
- Web server (Apache or Nginx): nginx
- Manage mail accounts with iRedAdmin-Pro?
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.

Dear Users,

Maybe someone could help me out with the following case.

I have two IP addresses which is allocated to a server. I want that the second IP address is used as a fall back IP. If the main IP address is blocked for some reason it would be nice that a second IP addresses could try to deliver the e-mail. Does anyone has some experience with this case within the iRedMail project.

I have seen some examples online, only i am afraid i would break postfix.

Does someone has a working example?


Re: Bind multiple IP addresses postfix

An extention of my first message.

I found this tutorial: https://docs.iredmail.org/send.out.emai … esses.html

But this looks like domain (@example) specific. I dont want to be domain specific. The case is, when IP one (main) fails just try to use the second IP.


Re: Bind multiple IP addresses postfix

An extend on the last messages. For now i made the following changes.

main     unix  -       -       n       -       -       smtp
  -o smtp_bind_address= 
  -o inet_interfaces=
  -o myhostname=mail.xxxxxxxx.yy
  -o smtp_helo_name=mail.xxxxxxxx.yy
  -o syslog_name=relay1
secundaire     unix  -       -       n       -       -       smtp
  -o smtp_bind_address=
  -o inet_interfaces=
  -o myhostname=failover.xxxxxxxx.yy
  -o smtp_helo_name=failover.xxxxxxxx.yy
  -o syslog_name=relay2

sender_dependent_default_transport_maps =

In this case the IP and are local IP addresses which PREROUTING and POSTROUTING on the main server to its real IP.

Is this the right configuration? Any suggestions?

Also is it possible to create a priority list instead of a randmap in "sender_dependent_default_transport_maps"


Re: Bind multiple IP addresses postfix

Does anyone have any idea how to make a priority list ip addresses (relays)?

5 (edited by Neutro 2019-07-22 23:50:47)

Re: Bind multiple IP addresses postfix


IP failover are designed to be used on 2 different servers, not on the same one.

The principle is easy: you have 2 identical mail servers running syncing their data between each other (using rsync for example).

You then setup your domain DNS to declare 2 MX (mail) servers.

When a mail is sent to your domain, it will be redirected to the first MX server in your domain DNS record, which is your main mail server.

If for some reason your main mail server in unavailable, your domain DNS will route the request to the backup (failover) mail server.



Re: Bind multiple IP addresses postfix

Hi Neutro,

Thank you for your reply. I am aware of this fact. The problem is not that i want multiple mailservers. The problem is that for some reason the "main ip" cannot connect to the receiving mailserver, but when i switch to the second ip then the mailserver can connect to the receiving server and the message get delivered. So to get more "sending coverage" i want to add a second ip address, but only use the second one when the main ip fails.

This is the reason i wanted to connect a second IP.

Do you have any suggestions to create a IP / relay priority list?


Re: Bind multiple IP addresses postfix

Maybe you can try Postfix parameter "fallback_relay"?


Does my reply help a little? How about buying me a cup of coffee ($5) as an encouragement?

buy me a cup of coffee