Reputation: 21
I'm currently using a postfix server with 4 IP (relay1, relay2, relay 3, relay4) for outgoing emails I'm using transport_maps to define for each email domain (outlook.fr, orange.fr ...) the relay to use It works well but I just realized that my postfix active queue was full, having mostly orange.fr emails, it gets quickly full as only 1 relay is defined to send emails for that domain.
What I'm trying to do is to load balance orange.fr emails between the 4 IP while keeping transport_maps to manage other email domains
I tried using sender_dependent_default_transport_maps = randmap:{relay1,relay2,relay3,relay4}
for load balancing and it works but for all domains.
In postfix release notes a solution seems given but I cannot have it to work: http://postfix.cs.utah.edu/source/official/postfix-3.0.0-RC1.RELEASE_NOTES
/etc/postfix/main.cf:
transport_maps =
# Deliver my own domain as usual.
hash:/etc/postfix/transport
# Deliver other domains via randomly-selected relayhosts
randmap:{smtp:smtp0.example.com, smtp:smtp1.example.com}
From my understanding postfix should read first transport_maps and if the domain is not found send using randmap. But in this case only randmap is working.
Summary:
If I use only transport file = emails are sent to specific relays but can't have one or more relays for a given domain If I use only randmap = emails are sent using the 4 IP but i cant specify relays for specific domains If I use transport and randmap = transport file seems ignored, only randmap is effective
Any idea how to do that?
Upvotes: 2
Views: 6792
Reputation: 11
I'm not sure how you configured your master.cf or your server so I'll just share my experience
My server has 5 IP (let's call them int1-int5)
First I configured these as interfaces in my master.cf
Example with int1
int1 unix - - n - - smtp
-o smtp_helo_name=int1.domain.com
-o syslog_name=postfix-int1
-o smtp_bind_address=x.x.x.x
My main.cf :
sender_dependent_default_transport_maps = hash:/etc/postfix/sender_transport randmap:{int1,int2,int3,int4,int5}
smtp_connection_cache_on_demand = no
transport_maps = hash:/etc/postfix/transport
sender_dependent_default_transport_maps = randmap:{int1,int2,int3,int4,int5}
: the load balancing
sender_dependent_default_transport_maps = hash:/etc/postfix/sender_transport
: specific relay for senders (mail from)
transport_maps = hash:/etc/postfix/transport
: specific relay for recipients (mail to)
/etc/postfix/sender_transport or hash:/etc/postfix/transport example :
[email protected] int5:
domain2.com int5:
Upvotes: 1