Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Administrators

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-10-2008, 11:33 AM
Loyal Member
 
Posts: 91
Default [SOLVED] Force Zimbra to send mail using another interface

I need to force Zimbra to make outgoing SMTP connection on a certain interface/ip address because it's not the primary interface. We are using a VIP with heartbeat, and until we can get this straight, we have a DNS/reverse DNS name mismatch.

How can I force Zimbra to using bond0:0 or 216.27.19.204 (the VIP interface and IP) when it makes outgoing SMTP connections.

Thanks
Reply With Quote
  #2 (permalink)  
Old 11-10-2008, 12:23 PM
Moderator
 
Posts: 7,928
Default

So do you have multiple NICs ? For the specific IPs you need to connect too have you tried setting a preferred route ?
__________________
Reply With Quote
  #3 (permalink)  
Old 11-10-2008, 12:32 PM
Loyal Member
 
Posts: 91
Default

No, same NICs.

However, it dawned on me a few minutes after writing this that I could accomplish this using source-nat and IP tables.

Here is the rule I'm using:
Quote:
iptables -t nat -D POSTROUTING -p tcp --dport 25 -j SNAT --to-source 216.27.19.204
Here is a cron script I wrote that runs every minute, it's pretty self explanatory. I don't know why I didn't think of doing it this way before. Since we use heartbeat, and /opt is only mounted on the "active" server, I check to see if /opt is mounted and then check the rule status.

Code:
volume="/opt"
rule="to:216.27.19.204"

if mount | grep "on ${volume} type" > /dev/null
then
        if iptables -L -v -t nat | grep -v grep | grep "${rule}" > /dev/null
        then
                echo "IPTables rule already exists!"
        else
                echo "IPTables rule doesn't exist, we need to add it!"
                iptables -t nat -A POSTROUTING -p tcp --dport 25 -j SNAT --to-source 216.27.19.204
        fi
else
        echo "Zimbra isn't running here"
        if iptables -L -v -t nat | grep -v grep | grep "${rule}" > /dev/null
        then
                echo "IPTables rule exists, we need to remove it!"
                iptables -t nat -D POSTROUTING -p tcp --dport 25 -j SNAT --to-source 216.27.19.204
        else
                echo "IPTables rule doesn't exist, we don't do anything!"
        fi
fi
Does anyone know of a reason not to do it this way?
__________________
Visit my webste online: http://www.dougware.net
Reply With Quote
  #4 (permalink)  
Old 11-10-2008, 12:48 PM
Moderator
 
Posts: 7,928
Default

Would it be better with /opt/zimbra ? or do you have other software on your ZCS installation ?
__________________
Reply With Quote
  #5 (permalink)  
Old 11-10-2008, 12:55 PM
Loyal Member
 
Posts: 91
Default

Zimbra is in the /opt/zimbra directory, but that's on the /opt mount for us. It was configured this way so that other applications (backup software, etc) would only run on the active system. Thus, when we check for the active server, we check the /opt mount.
__________________
Visit my webste online: http://www.dougware.net
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.