Michal Soltys 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
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
binding postfix will set the IP in the packets, but it won't change the
network routes (by default, routing is done by destination). so you also
need to play with "advanced" routing to make sure the packets go out of
eth2. this is linux question.