Single DOMAIN, Multiple Servers (or Office Branches)

Hi guys

Sorry for starting a new threat. I’ve been Googling for about 6 months, and I searched through lots of forums, and can’t find the answer I’mn looking for.

A bit of history. I used to work for a company whom used their own flavour of Gentoo Linux. We used Exim with Cyrus. It was easy to do what I’m now struggling to do on Virtualmin.

Here is the scenario:
My client, lets call their domain, has 2 different offices. Each office has their own mail server. Both offices uses the same domain.

Office 1: (Head Office)

Office 2: (Depot)

Above are just examples!

More details:’s MX records point to the ISP. Each office’s mail server POP’s mail from the ISP (at 2 minute intervals).

We had several ways of setting this up, but in most cases we used to drop mail sent to a user unknown to Office 1’s server. Office 2’s mail server would drop mail destined for Office 1’s users.

Further, if a user from Office 1 sent a mail to a user at Office 2 (using Office 1’s server as SMTP), Office 1 would know the user doesn’t exist at Office 1, and sent that mail to the ISP. Office 2’s server would then grab that mail at its next poll.

In same cases we had Exim setup to deliver directly to the second office’s mail server etc.

Like I said, it was fairly simple and logical to do.

Now heres my problem, I’m trying to do exactly the same with Virtualmin, Postfix and Dovecot. My first idea was to change the conf so that mail to any unknown mailbox gets delivered to the ISP (or wherever the MX are pointed). Unfortunately I couldn’t get this working. I tried setting up mail routing etc, but theres really not much info available on this.

I ended up with a very nasty hack, which is still working (and hey, I was desperate!)
Currently, both servers POP from the ISP, so inbound mail is fine. The problem comes in when someone from Office 1 sends a mail to someone at Office 2. So my hack for this was to create all users at all branches. All the users NOT at the branch, gets a forwarder so their mail gets delivered to a completely different domain (I used my own mail server for this purpose, just to get the client going). Then the correct server pop’s that account.

A bit more detail on how I configured Virtualmin:
I’m using Webmin Cluster to replicate the users. Then I go to Virtualmin to enable the user’s mailbox.
Both servers have a Virtual Server setup in Virtualmin, called

I thought of naming those virtual servers and, but that seems to bring a whole new problem to the mix.

Could someone please guide me in the correct or ideal way of setting this up?

Ideally, all mail servers for the domain should be aware of each other, and deliver mail between themselves. BUT, there are cases where I would do the IT work for the client’s say Cape Town branch, and another IT company would manage the client’s Johannesburg branch. For this reason I feel the easiest way to get this working, is for the mail server to send mail not destined for any of its users back to the ISP.

Thanks all for your help!!!


Is it really possible that I’m the only person in the world who wants to have a server at each branch office??

I’m sure there has to be more people trying to do the same thing, otherwise, what exactly is the use of having a localised mail server?

If you really want to keep a local server at each office and you have to keep them sharing the same domain, here is my suggestion:

-First, ditch the ISP mail; running POP3 from that server is doing you no favors and is delaying your delivery.

-Second, you should configure the MX records so that one server is listed as a high-priority and the other as a low priority.

-Third, you should configure your SMTP software on each server to receive mail for the domain.

-Fourth, you should setup each server so that there are only the users from that particular site on that particular server (i.e. only Cape Town’s users on Cape Town’s server and only Johannesburg’s users on Johannesburg’s server)

-Fifth, you can configure forwarders in the SMTP software (not in the users) to forward any mail for users at the other site to that site’s email server.

This solution would mean that when you create a user on one server, you would have to login to the other to put another forwarder in the mail server table, but I can tell you from experience that Webmin can control it well. (Although I did it with Postfix and not Exim)

Let me give you an example:

At Cape Town you have the following:

Bob Grey

Lindsey Shuffle

Mark Lightbulb

At Johannesburg:

John Tanner

Sarah Screwup

Tina Fun

You would have the following domain record:

MX 5

MX 10 would have the following mail delivery table:

Address: Deliver To: greyb shufflel lightbulbm would have the following mail delivery table:

Address: Deliver To: tannerj screwups funt

It will take some work to get your email server setup for this, but once you do, it should just work. I have done this before with Virtualmin in operation, and it works, but I would suggest not using Virtualmin if possible to simplify the situation.

My best suggestion for your situation would actually be Microsoft’s Exchange 2010. I know it costs a lot of money, but it’s automated Site delivery sounds like just what you need. If you already have Active Directory in place, a DC at each location, and the users divided into Sites, all you would need to do is deploy a server at each location with the basic configuration and the software will know who is on site and will know how to get mail to the other server for the users that are not. It will even redirect users logging into the wrong webmail to the portal that they need to use. I am usually not an advocate of Microsoft (I think they screw up WAY too much), but Exchange is the only thing that will completely automate this solution.