3

We are running postfix with single domain (example.com) currently and we have appropriate PTR record for that.

Now we want to add one more domain but i want to isolate that domain totally, Even i want to isolate PTR record too. so we added new public IP address in same server and added PTR entry to abc.com

  1. example.com - 1.1.1.1
  2. abc.com - 2.2.2.2

How i am going to tell postfix run example.com on 1.1.1.1 ip address and abc.com on 2.2.2.2

so from outside if someone try to telnet on 25 port he get different appropriate domain for relevant IP.

$ telnet mail.example.com 25
Trying ::1...
Connected to mail.example.com.
Escape character is '^]'.
220 mail.example.com ESMTP Postfix

And for abc.com

$telnet mail.abc.com 25
Trying ::1...
Connected to mail.abc.com.
Escape character is '^]'.
220 mail.abc.com ESMTP Postfix

1 Answer 1

4

Following should work for postfix equal or higher than 2.7.

You need to modify /etc/postfix/master.cf, change the line smtp inet n - n - - smtpd to something like this:

domain1 unix -       -       n       -       -       smtp
      -o syslog_name=postfix-mail.example.com
      -o smtp_helo_name=mail.example.com
      -o smtp_bind_address=1.1.1.1

domain2 unix -       -       n       -       -       smtp
      -o syslog_name=postfix-mail.abc.com     
      -o smtp_helo_name=mail.abc.com
      -o smtp_bind_address=2.2.2.2
#...

Then in /etc/posfix/main.cf you will need to remove old transport maps (if any) afterwards add sender_dependent_default_transport_maps for exmaple:

sender_dependent_default_transport_maps = hash:/etc/postfix/sender_transport

In /etc/postfix/sender_transport you need to add:

@example.com    domain1:
@abc.com    domain2:
#...

Then you need to create a hash db from the sender_transport file, with command:

postmap hash:/etc/postfix/sender_transport

Restart postfix to pickup the changes.

You could also move the transport maps to a database and create a table for the domains etc. This is just a basic setup but it should give you some ideas.

4
  • You got it right! does you solution with with multidomain senario as well? in case in future i want to add more domain which i want to add in 1.1.1.1 IP where i don't care about banner etc.
    – Satish
    Dec 2, 2014 at 1:42
  • I have not tried it, but it should be possible. You could try to add more domains in the sender_tranposrt file, something like @example.com domain1: @test.com domain1: @anothertest.com domain1: Although I have not used or not tested it.
    – b13n1u
    Dec 2, 2014 at 10:44
  • I have checked my version and it is 2.6.6 does above config will work?
    – Satish
    Dec 8, 2014 at 15:17
  • Your config doesn't working when i changed it to thsi and it works! do you know why? 67.111.xxx.xxx:smtp inet n - n - - smtpd -o myhostname=mail.example.com
    – Satish
    Dec 8, 2014 at 17:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .