Old 1st June 2010, 15:48
warlock warlock is offline
Join Date: Nov 2008
Posts: 93
Thanks: 1
Thanked 6 Times in 4 Posts
Default 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 = smtp1.box.com and smtp2.box.xom

postfix: fatal: relayhost parameter setting must not contain multiple values: smtp.mweb.net smtp.vbmail.co.za
Is there an option to alternate for load balancing or at least for fail-over

Reply With Quote
Sponsored Links
Old 10th July 2010, 12:52
yui72o yui72o is offline
Junior Member
Join Date: Jul 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

You should check this tutorial :
At 4.2 they configure /etc/postfix/main.cf
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
gmail.com smtp:[smtp.gmail.com]:587
# Except mail going to the tape and closet server
tape.squeezel.com relay:[tape.squeezel.com]
closet.squeezel.com relay:[closet.squeezel.com]
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
Reply With Quote
Old 20th July 2011, 21:52
XoCine XoCine is offline
Junior Member
Join Date: Jul 2011
Posts: 1
Thanks: 0
Thanked 1 Time in 1 Post

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 mysweetdomain.com 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 mxr.mysweetdomain.com
mxr.mysweetdomain.com has address
mxr.mysweetdomain.com has address
mxr.mysweetdomain.com has address
mxr.mysweetdomain.com has address
mxr.mysweetdomain.com has address

Standard roundrobin rulez :-D

Then only that little line in postfix/main.cf

relayhost = mxr.mysweetdomain.com

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 :-)

Last edited by XoCine; 20th July 2011 at 21:59. Reason: A little addon :-)
Reply With Quote
The Following User Says Thank You to XoCine For This Useful Post:
falko (21st July 2011)


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR: Connection dropped by IMAP server. [Centos 5.4, courier imap,squirrel, etc] darevil HOWTO-Related Questions 7 9th June 2010 15:49
Postfix not responding to telnet CarbonCopy Server Operation 6 8th May 2009 06:39
localhost postfix/master: fatal: bind port 125: Permission denied g18c Installation/Configuration 4 24th March 2009 18:39
Centos 4.4 32bit Hangs, High Server load 3cwired_com Server Operation 11 16th November 2006 16:47
Verify email setup meekish Installation/Configuration 28 27th October 2006 16:36

All times are GMT +2. The time now is 19:05.

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