From owner-freebsd-questions@FreeBSD.ORG Wed Jan 17 21:31:42 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F08A016A40F for ; Wed, 17 Jan 2007 21:31:42 +0000 (UTC) (envelope-from mksmith@adhost.com) Received: from mail-in04.adhost.com (pop.adhost.com [216.211.128.3]) by mx1.freebsd.org (Postfix) with ESMTP id D412813C45E for ; Wed, 17 Jan 2007 21:31:42 +0000 (UTC) (envelope-from mksmith@adhost.com) Received: from ad-exh01.adhost.lan (unknown [216.211.143.69]) by mail-in04.adhost.com (Postfix) with ESMTP id 6FFF1B801E; Wed, 17 Jan 2007 13:31:40 -0800 (PST) (envelope-from mksmith@adhost.com) MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5 x-cr-puzzleid: {AA8A3F25-715C-4478-9687-9E27A3916BE9} Content-class: urn:content-classes:message x-cr-hashedpuzzle: Aar8 CZlR D3Nv EU+X F9KP Iwba Khd+ Lozd OPUo OyNg SCpP TK5W VtiR V32H WYjo XVgh; 2; ZgByAGUAZQBiAHMAZAAtAHEAdQBlAHMAdABpAG8AbgBzAEAAZgByAGUAZQBiAHMAZAAuAG8AcgBnADsAZgByAGUAZQBiAHMAZABAAGcAbwByAGwAYQBuAGkALgBuAGUAdAA=; Sosha1_v1; 7; {AA8A3F25-715C-4478-9687-9E27A3916BE9}; bQBrAHMAbQBpAHQAaABAAGEAZABoAG8AcwB0AC4AYwBvAG0A; Wed, 17 Jan 2007 21:31:16 GMT; UgBFADoAIABMAG8AYQBkACAAYgBhAGwAYQBuAGMAaQBuAGcAIABvAHUAdABnAG8AaQBuAGcAIABtAGEAaQBsACAAcgBlAGwAYQB5AA== Date: Wed, 17 Jan 2007 13:31:16 -0800 Message-ID: <17838240D9A5544AAA5FF95F8D5203160187E79C@ad-exh01.adhost.lan> In-Reply-To: <000801c73a23$017bdeb0$6601880a@Enigma> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Load balancing outgoing mail relay thread-index: Acc6JvCFr9iG4XSiSiyg1h1o1bdJEwAVlzMQ References: <000801c73a23$017bdeb0$6601880a@Enigma> From: "Michael K. Smith - Adhost" To: "freebsd" , "FreeBSD Questions" Cc: Subject: RE: Load balancing outgoing mail relay X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jan 2007 21:31:43 -0000 Hello: > -----Original Message----- > From: owner-freebsd-questions@freebsd.org [mailto:owner-freebsd- > questions@freebsd.org] On Behalf Of freebsd > Sent: Wednesday, January 17, 2007 2:34 AM > To: FreeBSD Questions > Subject: Load balancing outgoing mail relay >=20 > 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 >=20 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=3D"em1" # replace with the interface name from your machine $ext_if=3D"em0" # replace with the interface name from your machine $smart_host_01=3D"192.168.1.1" $smart_host_02=3D"192.168.1.2" $smart_host_03=3D"192.168.1.3" $mail_server_01=3D"10.1.1.1" table persist { \ $smart_host_01, \ $smart_host_02, \ $smart_host_03 \ } rdr on $int_if proto tcp from $mail_server_01 to any port 25 -> round-robin=20 The configuration can become more granular (complex) by including NAT and ALTQ if you want to do rate-shaping. Regards, Mike