Previous Next Table of Contents

4. How to setup virtual email domains

Here is a step by step explanation.

4.1 How to adapt POP clients

There is nothing special to do on the POP user side, which is a good thing(tm): We want to merge several email servers in one box, we don't want to tell everyone about it :-)

4.2 How to install the server

The trick to read the mail is exactly the same as with virtual WWW: You need IP addresses. Mostly here is the setup. Suppose we want to create 3 virtual email domains: va.foo.com, vb.foo.com, vc.foo.com. Think about it in the same way as you would do for installing 3 independent servers, each serving one single email domain. This is what we will describe here and at the end, we will show how these 3 servers can be merged in a single machine.

On the DNS

From a DNS standpoint, we have one email server per domain. So the MX of each domain is

With the DNS, this is what we are telling the world. This is also what we are telling to email users. Mostly va.foo.com users, get your mail at mailhost.va.foo.com, vb.foo.com users, get your mail at mailhost.vb.foo.com and so on.

So far, with such a setup, we could very well have 1 server (real one) per email domain (The current state of affair before virtual email domain).

Installing the servers

To continue the setup (be it real or virtual), we go in the DNS and allocate an IP number for each server (this is the key). Here I am using private IP numbers as an example. One will see that I have allocated IP numbers from the same network.

Then we could go and install 3 linux servers with those IPs and tell Sendmail on each one to accept one of the three domains.

Getting virtual

Instead of installing 3 linux servers, we install a single one. For each virtual email domain, we must

The IP alias is the key. The POP protocol has no way to identify the target of a request, except with the IP destination number. This is why POP clients must use a different name (a different IP in fact) to read the messages from different email domains. From their point of view, this is expected anyway.

How to install vpop3d

Is vpop3d is a replacement for the standard POP daemon you are using on your distribution ? Maybe not. Various distribution ships with different pop3d supporting NIS, PAM and other authentication features. The best way to support all this easily is to let the native pop3d daemon handles the main email domain: vpop3d only manage the virtual ones.

To get this result, simply pass as an argument to vpop3d the path of the native pop3 daemon. vpop3d will give it control when a POP request is made to the main domain. Here is an example of how to set /etc/inetd.conf:

    pop-3   stream  tcp     nowait  root    /usr/sbin/tcpd      /usr/lib/linuxconf/lib/vpop3d /usr/sbin/ipop3d
        

So to install it, do not replace the pop3d command, but simply insert /usr/lib/linuxconf/lib/vpop3d. The exact line varies a little from distribution to distribution btw.


Previous Next Table of Contents