On Thu, Jul 31, 2008 at 2:41 AM, Michal Soltys <[EMAIL PROTECTED]> wrote:
> 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 > This will cause the source IP to be 30.30.30.30, but I don't think this will necessarily cause packets bound for external hosts to to use a particular gateway, which sounds like what the op is after. AFAIK postfix does not get involved in IP routing. Maybe I am wrong, but I think you will still need to make sure traffic with this source IP gets routed via the correct gateway using some other means, for instance iproute can do this with policy routes in linux. In fact, with policy routing you could cause all SMTP to use a particular gateway without needing a separate IP address for it at all. > > > 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 > >