Solved

Postfix - Binding IP based on sender

Posted on 2013-01-22
1
1,148 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Local Continuous Replication is a cost effective and quick way of backing up Exchange server data. The following article describes the steps required to configure Local Continuous Replication. Also, the article tells you how to restore from a backup…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

685 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