Next Previous 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 into one box, we don't want to tell everyone about it :-)

4.2 How to install the server

The trick to reading the mail is exactly the same as with virtual WWW: you need IP addresses. Here is most of the setup. Suppose we want to create three 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 three independent servers, each serving one single email domain. This is what we will describe here and at the end, we will show how these three servers can be merged into 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 one server (the real one) per email domain (The current status quo before the virtual email domain is set up).

Installing the servers

To continue the setup (be it real or virtual), we edit 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 install three Linux servers with these IPs and tell sendmail on each server to accept one of the three domains.

Getting virtual

Instead of installing three 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 a replacement for the standard POP daemon you are using on your distribution? Maybe not. Various distributions ship with different pop3d's, supporting NIS, PAM and other authentication features. The best way to support all these easily is to let the native pop3d daemon handle the main email domain; vpop3d only manages the virtual ones.

To get this result, simply pass, as an argument to vpop3d, the path of the native pop3 daemon. Vpop3d will give itself 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.

How to install vpop3d on xinetd systems (RedHat 7)

After installing the package imap, edit the file /etc/xinetd.d/ipop3 and modify the line server and disable, and insert the line server_args. The file will look like this:

        service pop3
        {
                socket_type             = stream
                wait                    = no
                user                    = root
                server                  = /usr/lib/linuxconf/lib/vpop3d
                server_args             = /usr/sbin/ipop3d
                log_on_success          += USERID
                log_on_failure          += USERID
                disable                 = no
        } 
        


Next Previous Contents