Solved

Postfix - Binding IP based on sender

Posted on 2013-01-22
1
1,145 Views
Last Modified: 2013-01-23
Hi all,

I've been dealing with a specific postfix setup for the past few days involving postfix (mail_version = 2.9.5) and the sender_dependent_default_transport_maps directive to make postfix use different bindings for different mailings based on sender envelope. I've postmapped all files, reloaded and restarted postfix, even restarted the server after these changes.

After sending many test emails playing around with the headers, etc. the server always sends email out via 10.1.1.1 (eth0) and not the alias interfaces that i've
binded.

I'm running CentOS 6.3 64bit if it makes any difference. Only thing i can think of is trying with Fedora, SuSE, Ubuntu or any other distro because i ran out of ideas. Is there any debugging that can be enabled to figure out how postfix is deciding what interface to use?



ifconfig:

eth0      Link encap:Ethernet  HWaddr 00:50:56:XX:XX:XX
          inet addr:10.1.1.1  Bcast:10.1.1.255  Mask:255.255.255.0
          inet6 addr: fe80::250:ffff:ffff:ffff/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:23083 errors:0 dropped:0 overruns:0 frame:0
          TX packets:19581 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3062523 (2.9 MiB)  TX bytes:3775988 (3.6 MiB)

eth0:0    Link encap:Ethernet  HWaddr 00:50:56:XX:XX:XX
          inet addr:10.1.1.2  Bcast:10.1.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

eth0:1    Link encap:Ethernet  HWaddr 00:50:56:XX:XX:XX
          inet addr:10.1.1.3  Bcast:10.1.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

eth0:2    Link encap:Ethernet  HWaddr 00:50:56:XX:XX:XX
          inet addr:10.1.1.4  Bcast:10.1.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

Open in new window



postconf -m:
btree
cidr
environ
fail
hash
internal
ldap
memcache
nis
pcre
proxy
regexp
static
tcp
texthash
unix

Open in new window



stuff added to /etc/postfix/master.cf:

onecom  unix - - - - - smtp
   -o smtp_bind_address=10.1.1.2
   -o smtp_helo_name=mail.one.com

twocom  unix - - - - - smtp
   -o smtp_bind_address=10.1.1.3
   -o smtp_helo_name=mail.two.com

threecom  unix - - - - - smtp
   -o smtp_bind_address=10.1.1.4
   -o smtp_helo_name=mail.three.com

Open in new window


main.cf

...
myhostname = server.domain.com
mydomain = $myhostname
myorigin = $mydomain
inet_interfaces = all
relayhost =
...
sender_dependent_default_transport_maps = hash:/etc/postfix/sender_transport

Open in new window


/etc/postfix/sender_transport
user@one.com onecom:
user@two.com twocom:
user@three.com threecom:

Open in new window


postmap -q user@one.com hash:/etc/postfix/sender_transport
onecom:

Open in new window


postmap -q user@two.com hash:/etc/postfix/sender_transport
twocom:

Open in new window


postmap -q user@three.com hash:/etc/postfix/sender_transport
threecom:

Open in new window

0
Comment
Question by:ddiazp
1 Comment
 
LVL 10

Accepted Solution

by:
ddiazp earned 0 total points
ID: 38810932
This same config works on OpenSUSE 12 with a minor change on sender_transport (without the colon at the end):

user@one.com onecom
user@two.com twocom
user@three.com threecom

That change didn't fix it for CentOS. An OS thing I suppose...
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Nearly six years ago I was hired by a company to be their senior server engineer. One of my first projects was to implement Exchange Server 2007 on a Windows Server 2008 Single Copy Cluster for high availability. That was the easy part; read on to l…
Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
To show how to create a transport rule in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Rules tab.:  To cr…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question