OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: mail delivery via alternate IP gateway

From: Michal Soltys (soltysziu.info)
Date: Thu Jul 31 2008 - 01:41:23 CDT


Luigi Rosa wrote:
> Given a Linux server with three network cards:
>
> eth0: 192.168.1.1 (local LAN)
> eth1: 20.20.20.20 (default GW, hi speed Internet, dynamic address)
> eth2: 30.30.30.30 (Internet, reserved to e-mail, static address)
>
> This server is the default gateway of the organization and NATs the
> local addresses via 20.20.20.20. Al traffic must go through 20.20.20.20
> EXECPT e-mail that should go through 30.30.30.30.
>
> Binding Postfix (via inet_interfaces directive) to 192.168.1.1 and
> 30.30.30.30 (and localhost) will be enough to tell Postfix to deliver
> mail via 30.30.30.30 and NOT via the system default gateway 20.20.20.20?
>
>

You will need smtp_bind_address in main.cf for that purpose. Depending
on your configuration need, you could create extra service in master.cf
as well, example:

smtp-external unix - - y - - smtp
         -o smtp_bind_address=30.30.30.30

and then in main.cf:

default_transport=smtp-external

Don't forget about relay service definition either, as it's smtp as
well, and uses global smtp_bind_address, unless explicitely overridden
in master.cf