Solved

Postfix - Binding IP based on sender

Posted on 2013-01-22
1
1,133 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
Comment Utility
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

How does your email signature look on mobiles?

Do your employees use mobile devices to reply to emails? With mobile becoming increasingly important to the business world, it is in your best interest to make sure that your email signature looks great across all types of devices.

Join & Write a Comment

Microsoft has released various new features which are capable of handling various tasks. One of these tasks is ‘Migration from pop3 to Exchange Server’. Pop3 data stores various data along mailboxes like contacts, tasks, etc. So, it becomes the need…
Granting full access permission allows users to access mailboxes present in their database. By giving full access permission one can open and read the content of any mailbox but cannot send emails from that mailbox.
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…
In this video we show how to create a Shared Mailbox 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 Recipients >> Sha…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now