Postfix is a general-purpose mail system that can be configured to provide a variety of services like mail relay and domain rewriting. A single Postfix configuration can provide these services to users than belong to different groups. But what can be done if a specific user group requires different configuration rules? To solve the conflict there are two options: either install a new Postfix server on a separate host or create and manage multiple Postfix instances on the same host. In this article we take the view that multiple Postfix instances is the preferable way to follow.

A multi-instance configuration consists of one primary Postfix instance, and one or more secondary instances whose configuration directory pathnames are recorded in the primary instance’s file. Postfix instances share program files and documentation, but have their own configuration, queue and data directories. The only requirement before we continue is that your host has more than one IP address (logical or physical) because each instance will bind on a separate IP address. Let us see the steps with an example.

1. Turn on multi-instance mode. By default, the Postfix runs in single-instance mode. Note that this step is executed just once, before adding the first secondary instance. The “postmulti -e init” command updates the primary instance’s file.

postmulti -e init

2. Create the secondary instance and add it to the multi_instance_directories parameter of the primary instance.

postmulti -I postfix2 -e create

3. Enable the secondary instance. This just sets the multi_instance_enable parameter to “yes” in the instance’s file.

postmulti -i postfix2 -e enable

4. Comment out the following lines in file /etc/postfix2/

master_service_disable = inet
authorized_submit_users =

5. Bind each instance to a separate IP with parameter inet_interfaces.

/etc/postfix/ inet_interfaces =
/etc/postfix2/ inet_interfaces =

6. Restart Postfix to apply the changes.

postfix stop
postfix start