HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (
-   Installation/Configuration (
-   -   Postfix + multiple relayhosts (

warlock 1st June 2010 15:48

Postfix + multiple relayhosts
Hi Guys,

How do I configure postfix to deliver to multiple smtp relay hosts.
We have 2 internet connection on a WAN bonder, if 1 line goes down we'd like post fix to deliver to a secondary smtp relay host.

I have tried this
relayhost = and


postfix: fatal: relayhost parameter setting must not contain multiple values:
Is there an option to alternate for load balancing or at least for fail-over


yui72o 10th July 2010 12:52

You should check this tutorial :
At 4.2 they configure /etc/postfix/

transport_maps = hash:/etc/postfix/transport
and at 4.5 (most usefull for you) is the configuration of multiple relays

# Contents of /etc/postfix/transport
# This sends mail to Gmail smtp:[]:587
# Except mail going to the tape and closet server relay:[] relay:[]
Please note that I think it is not at all for any load-balancing but multiple relays for local mail (Don't think you can ever do that with postfix ...)

I hope this will help

XoCine 20th July 2011 21:52

Maybe that question is ooooooooold but have some nice solution :-)

Well warlock, in searching of solution I did some googling but did not found solution sooo I turned off Google and enable a Brain++ :->

What we want? That Postfix connect to one of FEW hosts (relayhosts).

Welll, lets play with DNS :-)

In example do domain lets make some A lines:

mxr IN A
mxr IN A
mxr IN A
mxr IN A
mxr IN A

Lets flush bind and what we have? Nice :-)

[root@anubis postfix]# host has address has address has address has address has address

Standard roundrobin rulez :-D

Then only that little line in postfix/

relayhost =

and Postfix relays with every of these ips in roundrobin style :-)

Maybe it does not work as failover but better have 3/5 relays working then none :-) 60% delivered mails at once, rest waits for some time

Simple and nice :-) Hace fun :-)

All times are GMT +2. The time now is 14:02.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.