RE: Load balancing outgoing mail relay

2007-01-17 Thread Michael K. Smith - Adhost
Hello:

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:owner-freebsd-
 [EMAIL PROTECTED] On Behalf Of freebsd
 Sent: Wednesday, January 17, 2007 2:34 AM
 To: FreeBSD Questions
 Subject: Load balancing outgoing mail relay
 
 Hi
  I have a simple question but googling does not lead to a valid/usable
 answer.
 I need to load balance OUTGOING emails. I have serveral smart hosts. I
 need
 my internal SMTP server to send mail using ALL of the smart hosts
 together,
 making some kind of load balancing (no need for wheighted one).
 Someone pointed out to use a name for the smart host, and have DNS to
 resolve that name to the IP of all the relays (multiple A records) but
 this
 turned out in doing failover, not load balancing.
 Anyone has a *working* idea for solving this apparently simple
problem?
 Thanks
 

PF will definitely do what you want via its round-robin and redirect
features.  You would redirect all inbound traffic on port 25 to your
smart host group/table which would then load balance across all of your
servers.  In pf.conf, something like the following, with the
understanding that there are other things you may need to do first
before a pf config will work:

$int_if=em1  # replace with the interface name from your machine
$ext_if=em0  # replace with the interface name from your machine

$smart_host_01=192.168.1.1
$smart_host_02=192.168.1.2
$smart_host_03=192.168.1.3
$mail_server_01=10.1.1.1

table smtp_roundrobin persist { \
$smart_host_01, \
$smart_host_02, \
$smart_host_03 \
}

rdr on $int_if proto tcp from $mail_server_01 to any port 25 -
smtp_roundrobin round-robin 

The configuration can become more granular (complex) by including NAT
and ALTQ if you want to do rate-shaping.

Regards,

Mike

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Load balancing outgoing mail relay

2007-01-17 Thread Charles Trevor

freebsd wrote:

Hi
I have a simple question but googling does not lead to a valid/usable 
answer.
I need to load balance OUTGOING emails. I have serveral smart hosts. I 
need my internal SMTP server to send mail using ALL of the smart hosts 
together, making some kind of load balancing (no need for wheighted one).
Someone pointed out to use a name for the smart host, and have DNS to 
resolve that name to the IP of all the relays (multiple A records) but 
this turned out in doing failover, not load balancing.

Anyone has a *working* idea for solving this apparently simple problem?
Thanks

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to 
[EMAIL PROTECTED]


This (multiple A records) works for me, at least approximately. Both 
Bind and MS DNS will round robin when multiple A records exist for the 
same hostname. What is your setup?


Charlie

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Load balancing outgoing mail relay

2007-01-17 Thread freebsd

This (multiple A records) works for me, at least approximately. Both
Bind and MS DNS will round robin when multiple A records exist for the
same hostname. What is your setup?


FreeBSD 6.2 with Sendmail (initially) and now postfix.
MS DNS with round robin (and TTL set to 0 on the records).
Resolving with nslookup gives something like:
smarthost.domain.tld
192.168.0.1, 192.168.0.2, 192.168.0.3

If I kill 192.168.0.1 then it goes on the second one. But this is failover, 
and I need (approximately) load balancing.
I understand this is related to the MTA and not to the OS, but hopefully 
someone solved this problem using Sendmail or Postifx that are both used on 
FreeBSD.

Thanks


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Load balancing outgoing mail relay

2007-01-17 Thread Noel Jones


FreeBSD 6.2 with Sendmail (initially) and now postfix.
MS DNS with round robin (and TTL set to 0 on the records).
Resolving with nslookup gives something like:
smarthost.domain.tld
192.168.0.1, 192.168.0.2, 192.168.0.3

If I kill 192.168.0.1 then it goes on the second one. But this is failover,
and I need (approximately) load balancing.


Postfix will always internally shuffle equal-weight MX records (or
multiple A records if there is no MX).  I think sendmail does this
also.

This will not give strict round-robin use of the smarthosts, but over
thousands of messages will give an equal share to each host.

It sounds as if the host has primary/secondary MX records and you
haven't disabled MX lookups for the relayhost.  Use in main.cf
relayhost = [smarthost.domain.tld]
As documented, the brackets are required to disable MX lookups.

You may want to adjust initial_destination_concurrency_limit and
default_destination_concurrency_limit if your smarthosts will allow
more than the default 20 connections.

If sending small amounts of mail, postfix connection caching may
interfere with observed load sharing.  You may want to turn off
smtp_connection_cache_on_demand if sending small amounts of mail, but
leave it on if sending thousands of messages at a time.



--
Noel Jones
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Load balancing outgoing mail relay

2007-01-17 Thread Charles Trevor

freebsd wrote:

This (multiple A records) works for me, at least approximately. Both
Bind and MS DNS will round robin when multiple A records exist for the
same hostname. What is your setup?


FreeBSD 6.2 with Sendmail (initially) and now postfix.
MS DNS with round robin (and TTL set to 0 on the records).
Resolving with nslookup gives something like:
smarthost.domain.tld
192.168.0.1, 192.168.0.2, 192.168.0.3

If I kill 192.168.0.1 then it goes on the second one. But this is 
failover, and I need (approximately) load balancing.
I understand this is related to the MTA and not to the OS, but hopefully 
someone solved this problem using Sendmail or Postifx that are both used 
on FreeBSD.

Thanks



What happens if you do multiple dig/nslookups for smarthost.domain.tld. 
Are the records returned in a different order each time? If not the 
problem may be at the NS.


Charlie
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Load balancing outgoing mail relay

2007-01-17 Thread Noel Jones

On 1/17/07, Charles Trevor [EMAIL PROTECTED] wrote:


What happens if you do multiple dig/nslookups for smarthost.domain.tld.
Are the records returned in a different order each time? If not the
problem may be at the NS.



Nope.  Postfix shuffles equal-weight MX records internally, so it
doesn't matter what order the NS presents them.  Multiple A records
without an MX record (or when MX lookups are suppressed) are treated
as equal-weight MX records per RFC.

This is likely a postfix configuration problem.  The original poster
should seek further help on the postfix-users list.
http://www.postfix.org/DEBUG_README.html#mail


--
Noel Jones
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]