How to Force postfix send from specific ip

0

My mail server has 2 public IPs:

IP1: 1.1.1.1 (eth0)
IP2: 2.2.2.2 (eth0:1)

Currently my mx, a, ptr, spf records are pointing to the "2.2.2.2" ip, which i need to be for the mail server only,

But currently when i send any mail, the postfix 3.1.0 decides to send it on "1.1.1.1" ip,

I tried to make the master.cf:

smtps     inet  n       -       y       -       -       smtpd

  -o smtp_bind_address=2.2.2.2

smtp       inet  n       -       y       -       -       smtpd

  -o smtp_bind_address=2.2.2.2

relay     unix  -       -       y       -       -       smtp
  -o smtp_bind_address=2.2.2.2

But it still sends from the "1.1.1.1"

Any help please?

MohammedSimba

Posted 2017-10-29T13:33:30.050

Reputation: 135

Are these public IP addresses directly connected to the server? Or is there an intermediary router with NAT and/or port forwarding? – Appleoddity – 2017-10-29T13:34:58.877

Yes both are public IPs – MohammedSimba – 2017-10-29T13:35:27.743

http://www.postfix.org/postconf.5.html#inet_interfaces . There are indications there – A.B – 2017-10-29T16:07:37.333

I’m not sure if postfix has a specific option to handle this. But you should be able to do this with policy routing rules. You can route all traffic destined to/from port 25 over that particular gateway. – Appleoddity – 2017-10-29T16:52:46.323

No answers