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

Originating Or Sending From Correct Domain IP

114 views
Skip to first unread message

Mike McKoy

unread,
May 19, 2015, 3:40:23 PM5/19/15
to
I'm using CENTOS 6.5 I need to configure Postfix to send from the correct IP addresses assigned to each domain.

How easy is it to configure postfix to send using a specific IP address for each domain I have on the server? I've already bound the IPs. When I used Exim all I had to do was create a list of IPs for the server to send as. But als, i'm not using cpanel so I can't use exim. I need to find a way to do this with postfix.

I have heard that I need to masquerade the IPs or that I need to run multiple instances of postfix. I'm not sure what to do. The examples i've found on the internet so far are not highly detailed or vary in instructions. I will ask in postfix forums too but if you know please tell me.

Thanks

Wietse Venema

unread,
May 19, 2015, 4:16:25 PM5/19/15
to
Mike McKoy:
> I'm using CENTOS 6.5 I need to configure Postfix to send from the correct
> IP addresses assigned to each domain.

Use sender_dependent_default_transport_maps to select a suitable SMTP client configuration:

/etc/postfix/main.cf:
sender_dependent_default_transport_maps = hash:/etc/postfix/sender_dependent_transport

/etc/postfix/sender_dependent_default_transport
example.com smtp-example-com

/etc/postfix/master.cf:
smtp-example-com .. .. .. .. .. smtp
-o smtp_bind_addres=192.168.1.1

> How easy is it to configure postfix to send using a specific IP address for
> each domain I have on the server? I've already bound the IPs. When I used
> Exim all I had to do was create a list of IPs for the server to send as.
> But als, i'm not using cpanel so I can't use exim. I need to find a way to
> do this with postfix.

/etc/postfix/master.cf:
192.168.1.1:smtp .. .. .. .. .. smtpd

Wietse

Peter

unread,
May 19, 2015, 7:17:09 PM5/19/15
to
On 05/20/2015 07:39 AM, Mike McKoy wrote:
> I'm using CENTOS 6.5

Then you need to update, CentOS 6.6 is the current version and has a
number of security / bug fixes that are not in 6.5.

> I need to configure Postfix to send from the
> correct IP addresses assigned to each domain.

Actually, you probably don't. What makes you think you need to do this?

> How easy is it to configure postfix to send using a specific IP address
> for each domain I have on the server?

Not very easy, but Wietse has already given you perhaps the easiest
possible way to do it.

> When I
> used Exim all I had to do was create a list of IPs for the server to
> send as. But als, i'm not using cpanel so I can't use exim. I need to
> find a way to do this with postfix.

Using cpanel or not has nothing to do with your choice of postfix vs
exim and both are available for CentOS 6 via a simple yum command. Not
to say that I fault your choice of Postfix over Exim, but your reasoning
for this is misguided.


Peter

Mike McKoy

unread,
May 19, 2015, 7:39:57 PM5/19/15
to
Wietse Venema <wie...@porcupine.org> wrote:

Use sender_dependent_default_transport_maps to select a suitable SMTP client configuration:

/etc/postfix/main.cf:
   sender_dependent_default_transport_maps = hash:/etc/postfix/sender_dependent_transport 

/etc/postfix/sender_dependent_default_transport
    example.com smtp-example-com

So it would look something like this?
 /etc/postfix/sender_dependent_default_transport
    mymodeltalk.com smtp-mymodeltalk-com

/etc/postfix/master.cf:
    smtp-example-com .. .. .. .. .. smtp
        -o smtp_bind_addres=192.168.1.1

And this would look like this?
smtp-mymodeltalk-com .. .. .. .. .. smtp
        -o smtp_bind_addres=52.0.148.79

smtp-inform-mymodeltalk-com .. .. .. .. .. smtp
        -o smtp_bind_addres=52.0.33.25

smtp-myforeverhair-com .. .. .. .. .. smtp
        -o smtp_bind_addres=52.1.130.125
 
> How easy is it to configure postfix to send using a specific IP address for
> each domain I have on the server? I've already bound the IPs. When I used

> Exim all I had to do was create a list of IPs for the server to send as.
> But alas, i'm not using cpanel so I can't use exim. I need to find a way to
> do this with postfix.

/etc/postfix/master.cf:
    192.168.1.1:smtp .. .. .. .. .. smtpd

And this last part would look like this?
/etc/postfix/master.cf:
    52.0.148.79:smtp .. .. .. .. .. smtpd
    52.0.33.25:smtp .. .. .. .. .. smtpd
    52.1.130.125:smtp .. .. .. .. .. smtpd
 

        Wietse

Wietse Venema

unread,
May 19, 2015, 7:52:34 PM5/19/15
to
Mike McKoy:
> Wietse Venema <wie...@porcupine.org> wrote:
>
> >
> > Use sender_dependent_default_transport_maps to select a suitable SMTP
> > client configuration:
> >
> > /etc/postfix/main.cf:
> > sender_dependent_default_transport_maps =
> > hash:/etc/postfix/sender_dependent_transport
>
> > /etc/postfix/sender_dependent_default_transport
> > example.com smtp-example-com
>
> So it would look something like this?
> /etc/postfix/sender_dependent_default_transport
> mymodeltalk.com smtp-mymodeltalk-com
> inform.mymodeltalk.com smtp-inform.mymodeltalk.com
> myforeverhair.com smtp-myforeverhair.com

I just noticed that the table is searched by sender address and
@domain, so you'd need to specify @mymodeltalk.com and so on.

> > /etc/postfix/master.cf:
> > smtp-example-com .. .. .. .. .. smtp
> > -o smtp_bind_addres=192.168.1.1
> >
> And this would look like this?
> smtp-mymodeltalk-com .. .. .. .. .. smtp
> -o smtp_bind_addres=52.0.148.79
>
> smtp-inform-mymodeltalk-com .. .. .. .. .. smtp
> -o smtp_bind_addres=52.0.33.25
>
> smtp-myforeverhair-com .. .. .. .. .. smtp
> -o smtp_bind_addres=52.1.130.125

Yes, assuming that the IP addresses are correct.

> > > How easy is it to configure postfix to send using a specific IP address
> > for
> > > each domain I have on the server? I've already bound the IPs. When I used
> > > Exim all I had to do was create a list of IPs for the server to send as.
> > > But alas, i'm not using cpanel so I can't use exim. I need to find a way
> > to
> > > do this with postfix.
> >
> > /etc/postfix/master.cf:
> > 192.168.1.1:smtp .. .. .. .. .. smtpd

The above is to receive mail. I thought you needed that, too,
but I may have misread your question.

> And this last part would look like this?
> /etc/postfix/master.cf:
> 52.0.148.79:smtp .. .. .. .. .. smtpd
> 52.0.33.25:smtp .. .. .. .. .. smtpd
> 52.1.130.125:smtp .. .. .. .. .. smtpd

If each domain is to have its own mail receiving address, yes.

However, Postfix is not really a multi-personality server. You can
fake it by setting "-o myhostname=mta-name-here" on the smtp and
smtpd process command lines. But when mail is not deliverable, then
(as required by RFC 5321) Postfix will send a non-delivery notification
with the null sender address, and that address will fly past your
sender_dependent_default_transport_maps.

Multiple MTA personalities require multiple Postfix instances.

Wietse

Mike McKoy

unread,
May 19, 2015, 8:02:04 PM5/19/15
to
OK, then i will research setting up multiple postfix instances. I wonder...is exim better for this? I wanted to use it at first but could not find any documentation of centos & exim. Thanks for the support thus far. It's appreciated.

Peter

unread,
May 19, 2015, 8:16:48 PM5/19/15
to
On 05/20/2015 12:01 PM, Mike McKoy wrote:
> OK, then i will research setting up multiple postfix instances. I
> wonder...is exim better for this? I wanted to use it at first but could
> not find any documentation of centos & exim. Thanks for the support thus
> far. It's appreciated.

If you want exim on CentOS 6 (off topic for here, but...):

yum shell
remove postfix
install exim
run
...
quit


...beyond that you need to get help from exim support channels.


Peter

Peter

unread,
May 19, 2015, 9:56:18 PM5/19/15
to
On 05/20/2015 01:02 PM, Mike McKoy wrote:
> Actually, you probably don't. What makes you think you need to do this?
>
> I do and everyone does.

Sorry, no.

> I send massive amounts of email and ever IP has
> its own sender score.

Yes, but provided you do proper spam filtering on your outbound mail
this should work in favor of a single IP, since it will improve the
score of that IP faster and better to have more HAM sent from it.

> Also because I need to authenticate email as
> originating from the domain for certain recipients to receive that mail.

This is completely wrong. Mail does not have to come from a server with
the same hostname as the domain it's sent from, if it did this would end
up breaking tons of legitimate mail sent from everywhere, probably the
vast majority of it, in fact. What is true is that you simply need to
set the SPF records properly so that mail is allowed from the correct IP
address(es).

> My only reasoning is that Exim did before what postfix isn't designed to
> do.

Yes, but this particular feature is one that is usually requested by
either (1) spammers, or (2) people who are misinformed or misguided as
to how email works and restrictions placed on receiving it by other
servers. I am not telling you that you can't or shouldn't do this, but
I am saying to think again because your reasoning seems to be based on
false assumptions or things that other people have told you that are
incorrect.

> i can't use exim because there are no tutorials that exist with
> integrating Centos with exim.

This is simply untrue, you can use exim if you really want and it is
perfectly easy to do so in CentOS. CentOS does ship exim packages that
are easy to install it's just not the default MTA that is installed on
CentOS and I have already given you easy instructions to switch to exim
if you really want. That said, I am not trying to convince you to
switch to exim, I happen to much prefer Postfix, I am simply saying that
your reasoning for not using exim is false.

> I wasn't and have never asked for help
> with that. I simply asked if there was a better solution. I have 7
> domains in production...do i really have to run 7 different instances of
> postfix to send mail from each individual domain?

No you don't, you don't even have to run multi-instances to send mail
from individual IPs for each domain as Wietse has already given you a
solution for that. The only exception to his solution is that it
doesn't work for DSNs, but a properly configured postfix should be
sending out a minimal amount (if any) of those anyways.


Peter

Peter Ajamian

unread,
May 19, 2015, 10:36:04 PM5/19/15
to
On 05/20/2015 02:02 PM, Mike McKoy wrote:
> I'm a bulk emailer I need my newsletter emails to be scored separately
> from community related emails by every email service provider.

Yes, I have clients who do the same. This is different from sending
based on envelope sender's domain. Generally what I recommend here is
to set up a separate VM just for pushing out your bulk mailings, it's
not something you want to share with your regular mail regardless of domain.

> There is a particular domain which only accepts email
> from domains it can reverse ip too. This is for security reasons.

What you are referring to is FCRDNS, which works based on the EHLO
hostname ($myhostname). This does *not* have to be the same as the
domain part of the envelope sender and very rarely is. See
http://en.wikipedia.org/wiki/Forward_Confirmed_reverse_DNS

> Do you or does anyone know a guide of how to setup multiple email
> instances of postfix?

http://www.postfix.org/MULTI_INSTANCE_README.html


Peter

Peter Ajamian

unread,
May 19, 2015, 11:27:49 PM5/19/15
to
On 05/20/2015 03:07 PM, Mike McKoy wrote:
> Thanks for all your help. I will research all of these. Unfortunately my
> dedicated is already a VM and amazon cloud will not let me bind IPs to a
> VM within a VM.

Right, you would simply fire off a new, separate VM instead.

> I found this article also which gives step by step instructions:
> ttp://steam.io/2013/11/05/postfix-multi-instance-configuration/
> <http://steam.io/2013/11/05/postfix-multi-instance-configuration/>.

There is not much non-official documentation I will recommend.
Tutorials and howtos tend to be outdated, littered with mis-conceptions
or just plain wrong. I recommend you use the official docs and if you
have any questions or need clarification feel free to ask on the mailing
list or in #postfix on freenode IRC.


Peter

Mike McKoy

unread,
May 19, 2015, 11:51:53 PM5/19/15
to
Trying to destroy a postfix instance I don't need. I get this error: postmulti: fatal: parameter inet_interfaces: no local interface found for 52.0.148.79


This is the command I'm using: postmulti -i postfix-mmt -e destroy

Peter Ajamian

unread,
May 19, 2015, 11:52:22 PM5/19/15
to
On 05/20/2015 03:50 PM, Mike McKoy wrote:
> Trying to destroy a postfix instance I don't need. I get this error:
> postmulti: fatal: parameter inet_interfaces:
>
> This is the command I'm using: postmulti -i postfix-mmt -e destroy

You need to reply back to the list instead of directly to me. There are
others on the list who can help you with this better than I can.


Peter

0 new messages