One mailserver with multiple IPs

Hello there,

Ubuntu 24.04
Webmin version - 2.202
Virtualmin version - 7.20.2

I deployed this server only with 1 net interface eth0 (let’s say 1.1.1.1)
this IP is shared between several domains
while ago I added second interface eth1 and IP (lets say 2.2.2.2)
I want eth0 and eth1 to serve different domain independently, so far I am using is for mail server and I want to have different IPs for different domains.

I added new IP in network interfaces from Webmin;
also added in shared IPS from Virtualmin.
And changed IP address for one particular domain (let’s say domain2.com), it sent email anyway with 1.1.1.1 (mail-tester is offering to add 1.1.1.1 also in SPF records, cause only 2.2.2.2 is in it).

After this I tried to bind domain2.com with 2.2.2.2 and in postfix main.cf :slight_smile:

sender_dependent_default_transport_maps = hash:/etc/postfix/sender_transport

created “sender_transport” in postfix dir with record:
@domain2.com 2.2.2.2

this did not work and changed to

@domain2.com smtp:[2.2.2.2]

Also not working.

I asked different AIs for a solution and each of them suggested this changes I already described.

Maybe someone can help me out with this?

Thank you in advance

You’ve skipped a step, I think. (postmap hash:/etc/postfix/dependent)

Hello Joe,

I forgot to mention in my post, but I did postmap command also, after every change in dependent file (in my case ender_transport file).

I read the documentation you replied, It’s a same way I described.

And I had all those steps, actually.

Is there anything else to consider or I missed?

Do you actually have a route from the new interface to the internet?

Hello Joe,

ip a , ifconfig both are showing me both interfaces in list.
als in virtualmin dashboard both interfaces are marked as active.

i can ping both ips and reach test website hosted on 2.2.2.2

this problem is only for outgoing emails IP

problem is fixed so far:

in sender_transport file :
instead binding directly domain with IP
i binded domains with smtpnames and thenin master.cf i configured smtp name with ip binding and helo name.

Thanks again.

Regards

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.