1

Topic: Bind multiple IP addresses postfix

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- 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?

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

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.

3

Re: Bind multiple IP addresses postfix

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

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

main.cf
sender_dependent_default_transport_maps =
  randmap:{main,secundaire}
smtp_connection_cache_on_demand=no


In this case the IP 192.168.1.50 and 192.168.1.51 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"

4

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

Hi,

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.

https://www.howtoforge.com/postfix_backup_mx

6

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?

7

Re: Bind multiple IP addresses postfix

Maybe you can try Postfix parameter "fallback_relay"?
http://www.postfix.org/postconf.5.html#fallback_relay