How to set different outgoing IP to each domain.

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
Post Reply
0gg1
Posts: 5
Joined: Sat Sep 13, 2014 2:52 am

How to set different outgoing IP to each domain.

Post by 0gg1 »

Hi. I have domain1.com, domain2.com, domain3.com ..... domain30.com

I want to set IP address 1.1.1.1 as outgoing for domain1.com and IP address 2.2.2.2 as outgoing for domain2.com ..... domain30.com.

How to do that ?
ypong
Advanced member
Advanced member
Posts: 66
Joined: Sat Sep 13, 2014 12:03 am

How to set different outgoing IP to each domain.

Post by ypong »

To succintly answer your question, you need multiple IPs on your server (I'm running linux servers, so it's an easy task to create some aliases and restart the networking stack), then assuming domain2.com is already created in the zimbra admin interface, provision the IP using the command zmprov md domain2.com zimbraVirtualIPAddress "2.2.2.2"
Note that this is assuming you have installed and are using the proxy subsystem. Without the proxy subsystem, you'd have to probably also manually edit the master.cf.in file in .../zimbra/postfix/conf
0gg1
Posts: 5
Joined: Sat Sep 13, 2014 2:52 am

How to set different outgoing IP to each domain.

Post by 0gg1 »

I have installed CentOS 6.0 and I used:

zmprov md domain1.com +zimbraVirtualHostName domain1.com +zimbraVirtualIPAddress 1.1.1.1

zmprov md domain2.com +zimbraVirtualHostName domain2.com +zimbraVirtualIPAddress 2.2.2.2

zmprov md domain3.com +zimbraVirtualHostName domain3.com +zimbraVirtualIPAddress 2.2.2.2



but when I send e-mail from domain1, domain2 or domain3 to account on an other server and view log file an other server I see that received e-mail is coming from one IP: 1.1.1.1
ypong
Advanced member
Advanced member
Posts: 66
Joined: Sat Sep 13, 2014 12:03 am

How to set different outgoing IP to each domain.

Post by ypong »

did you restart the proxy server after doing the changes? zmproxyctl restart
0gg1
Posts: 5
Joined: Sat Sep 13, 2014 2:52 am

How to set different outgoing IP to each domain.

Post by 0gg1 »

No, but I do "zmcontrol restart".
speno
Advanced member
Advanced member
Posts: 56
Joined: Sat Sep 13, 2014 1:08 am

How to set different outgoing IP to each domain.

Post by speno »

I'm skeptical of this answer but it is likely because I'm ignorant.
1) the zimbraVirtualIPAddress: I thought this mapped users into a domain based on which IP they connected to and didn't have anything to do with outgoing connections from Zimbra.
2) the Zimbra proxy system is separate from the MTA. The proxy handles incoming pop, imap and http connections, but doesn't have anything to do with smtp.
0gg1
Posts: 5
Joined: Sat Sep 13, 2014 2:52 am

How to set different outgoing IP to each domain.

Post by 0gg1 »

I solved issue, used postfix (master.cf & main.cf).

1) Backup master.cf.in and main.cf files in /opt/zimbra/postfix/conf/

2) Create new file named sdd_transport_maps.regexp and use regular expression for sites that you want to route.

In my case, file include this:

/@domain1.com$/ domain1_com:

/@domain2.com$/ domain2_com:
Edit: domain1_com and domain2_com are just name, you can rename that how do you want.
3) At the last line on file master.cf.in add this:

domain1_com unix - - n - - smtp

-o smtp_bind_address=1.1.1.1

-o smtp_helo_name=domain1.com

-o syslog_name=postfix-domain1_com

domain2_com unix - - n - - smtp

-o smtp_bind_address=2.2.2.2

-o smtp_helo_name=domain2.com

-o syslog_name=postfix-domain2_com



4) At the last line on file main.cf add this:

sender_dependent_default_transport_maps = regexp:/opt/zimbra/postfix/conf/sdd_transport_maps.regexp


I hope this issue will be help on other people. :)
ypong
Advanced member
Advanced member
Posts: 66
Joined: Sat Sep 13, 2014 12:03 am

How to set different outgoing IP to each domain.

Post by ypong »

oops, my bad, speno is right, you will have to bind (as you've found out), manually edit the master.cf.in file. I have a firewall cluster in front of my mailservers so I do my mapping from there, my apologies for misleading you.
brijendrasial
Posts: 4
Joined: Sat Sep 13, 2014 3:31 am

How to set different outgoing IP to each domain.

Post by brijendrasial »

@0gg1 i tried what you wrote and everything went perfect but when i send email i get error. I created transport emarketing_in.


Feb 16 02:02:53 mail postfix/qmgr[23809]: warning: connect to transport private/emarketing_in: No such file or directory
Feb 16 02:02:53 mail postfix/error[1956]: 358B89B67B: to=, relay=none, delay=2839, delays=2839/0.02/0/0.06, dsn=4.3.0, status=deferred (mail transport unavailable)
Post Reply