Re: mail delivery via alternate IP gateway
- On Thu, Jul 31, 2008 at 2:41 AM, Michal Soltys <soltys@...> wrote:Luigi Rosa wrote: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:
Given a Linux server with three network cards:
eth0: 192.168.1.1 (local LAN)
eth1: 220.127.116.11 (default GW, hi speed Internet, dynamic address)
eth2: 18.104.22.168 (Internet, reserved to e-mail, static address)
This server is the default gateway of the organization and NATs the local addresses via 22.214.171.124. Al traffic must go through 126.96.36.199 EXECPT e-mail that should go through 188.8.131.52.
Binding Postfix (via inet_interfaces directive) to 192.168.1.1 and 184.108.40.206 (and localhost) will be enough to tell Postfix to deliver mail via 220.127.116.11 and NOT via the system default gateway 18.104.22.168?
smtp-external unix - - y - - smtp
and then in main.cf:
This will cause the source IP to be 22.214.171.124, 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