Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

selecting outbound IP

29 views
Skip to first unread message

Joe Wong

unread,
Feb 7, 2012, 3:53:06 AM2/7/12
to
Hello,

Say my MTA has multiple IP addresses on it. Is there a way to
configure Postfix (outbound) to use IP 1 when matching condition A and
IP2 if matching condition B and IP3 and none of the conditions are
matched?

Thanks,

- joe

Reindl Harald

unread,
Feb 7, 2012, 4:36:09 AM2/7/12
to
you can define "smtp_bind_address" for each outgoing process
defined in "master.cf"

cat /etc/postfix/master.cf | grep smtp_bind
smtp unix - - n - 50 smtp -o smtp_bind_address=10.0.0.6 -o max_idle=300 -o
max_use=500
relay unix - - n - - smtp -o smtp_bind_address=10.0.0.6 -o max_idle=300 -o
max_use=500 -o smtp_fallback_relay=

signature.asc

Wietse Venema

unread,
Feb 7, 2012, 7:00:23 AM2/7/12
to
Reindl Harald:
If you do this on a firewall, then be sure to read the Postfix
manpage for smtp_bind_address and inet_interfaces, to avoid
some common pitfalls with routing.

http://www.postfix.org/postconf.5.html#smtp_bind_address
http://www.postfix.org/postconf.5.html#inet_interfaces

Wietse

Joe Wong

unread,
Feb 7, 2012, 9:19:18 AM2/7/12
to
Thanks for the reference. How could this be used with some condition?
I am looking for binding sender domain A with IP 1 and domain B go
through IP 2, go to IP3 otherwise.

- Joe

Reindl Harald

unread,
Feb 7, 2012, 9:33:42 AM2/7/12
to
http://www.postfix.org/MULTI_INSTANCE_README.html
but never used because no need

"smtp_bind_address" is here only in use to make sure
that outgoing mail is using the ip matching SPF
--

Mit besten Grüßen, Reindl Harald
the lounge interactive design GmbH
A-1060 Vienna, Hofmühlgasse 17
CTO / software-development / cms-solutions
p: +43 (1) 595 3999 33, m: +43 (676) 40 221 40
icq: 154546673, http://www.thelounge.net/

http://www.thelounge.net/signature.asc.what.htm

signature.asc

Joe Wong

unread,
Feb 7, 2012, 10:01:43 AM2/7/12
to
Thanks Reindl.

Joe Wong

unread,
Feb 8, 2012, 3:46:33 AM2/8/12
to
I read the details of the multiple instance support but it's not clear
to me how I can use it to achieve my goal. Do anyone have similar
setup and share your configuration here?

Many Thanks,

- Joe

Andrew Beverley

unread,
Feb 8, 2012, 12:43:44 PM2/8/12
to
On Wed, 2012-02-08 at 16:46 +0800, Joe Wong wrote:
> I read the details of the multiple instance support but it's not clear
> to me how I can use it to achieve my goal. Do anyone have similar
> setup and share your configuration here?

Please don't top post.

You'll have to give some more details as to what "condition A" and
"condition B" are that define which outgoing IP address should be used.

Andy

Joe Wong

unread,
Feb 8, 2012, 8:21:56 PM2/8/12
to
Hello Andy,

Sorry I should state the details initially. I am hosting multiple domains say

joe.com
jay.net
some other domains

I would like to route email sent from user in joe.com through IP
address 1, user in jay.net via IP address 2, the rest go through IP
address 3.

after looking into the multiple instance support, I am not sure how
this will work with my setup. Appreciated your opinion here.

Best regards,

- Joe

Noel Jones

unread,
Feb 8, 2012, 9:27:38 PM2/8/12
to
On 2/8/2012 7:21 PM, Joe Wong wrote:
> Hello Andy,
>
> Sorry I should state the details initially. I am hosting multiple domains say
>
> joe.com
> jay.net
> some other domains
>
> I would like to route email sent from user in joe.com through IP
> address 1, user in jay.net via IP address 2, the rest go through IP
> address 3.


The sender_dependent_default_transport_maps feature is intended
exactly for this. See:
http://www.postfix.org/postconf.5.html#sender_dependent_default_transport_maps
and the mail list archives.




-- Noel Jones

Joe Wong

unread,
Feb 8, 2012, 10:24:01 PM2/8/12
to
Hello Noel,

The IP I mentioned was not the remote IP, but the IP address in the
oubound MTA machine.

- Joe

Noel Jones

unread,
Feb 8, 2012, 10:41:46 PM2/8/12
to
On 2/8/2012 9:24 PM, Joe Wong wrote:
> Hello Noel,
>
> The IP I mentioned was not the remote IP, but the IP address in the
> oubound MTA machine.
>
> - Joe


[please don't top post]

Indeed. Use sender_dependent_default_transport_maps to select a
transport defined in master.cf that is bound to a specific IP with
"... -o smtp_bind_address=0.1.2.3"

a brief example (you can find other examples in the archives):


# master.cf
#(these are copies of the smtp...smtp default transport)
out_joe unix - - n - - smtp
-o smtp_bind_address=192.0.1.10

out_bob unix - - n - - smtp
-o smtp_bind_address=192.0.1.20


# main.cf
sender_dependent_default_transport_maps =
hash:/etc/postfix/sender_transport


# sender_transport
@joe.example.com out_joe:
@bob.example.com out_bob:





-- Noel Jones

Joe Wong

unread,
Feb 8, 2012, 11:25:27 PM2/8/12
to
Thanks Noel. That means it does not need the multiple instance support at all.

And sorry for the top-post :)

- Joe

0 new messages