Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a subdomain subdomain.mydomain with two servers server1.subdomain.mydomain and server2.subdomain.mydomain running CentOS 5.5. server1 runs a Postfix server for subdomain.mydomain that acts as a second level SMTP server, i.e., it does relay through another server relay.mydomain (on a higher level domain mydomain).

I need to set up another Postfix on server2 to act as a backup server for server1, so that server2 relays to server1 all mail sent through server2.

I have been digging through the Postfix documentation site and found a section named Configuring Postfix as primary or backup MX host for a remote site, but it is too brief and not very clear.

How can I set up the Postfix service on server2 to relay to/backup server1?

What I have understood from the previous link to Postfix documentation is that I have to set up the following:

On server1 (main server)

  • relay_domains must be equal to relay.mydomain
  • transport_maps must be equal to hash:/etc/postfix/transport
  • /etc/postfix/transport must contain the line subdomaing.mydomain relay:[relay.mydomain] (and brackets are mandatory for Postfix not to perform MX lookup)

On server2 (backup server)

  • subdomain.mydomain must not be listed in mydestination
  • smtpd_recipient_restrictions must be equal to permit_mynetworks reject_unauth_destination
  • relay_recipient_maps must be equal to hash:/etc/postfix/relay_recipients
  • /etc/postfix/relay_recipients must contain a line of the form user@subdomain.mydomain x for every mailbox user in the system

However, this does not work. When I start the Postfix server on server2 and connect using telnet, Postfix does not send any message (no welcome message and no response to any command).

share|improve this question

If server2 is a backup to server1, why do you want it relaying messages to server1? The point of a backup is to provide service if the primary is down. So if server1 is down, server2 still needs to deliver.

For just a basic backup, server2 could be configured identically to server1. Then just create an MX record for server2, with server1's MX having a preference of 10 and server2's having a preference of 20.

share|improve this answer
I pressumed that server2 should not store any of the messages, but send them to server1 to be stored on server1. For example, if server1 is down and user2@subdomain.mydomain send an e-mail to user1@subdomain.mydomain, that e-mail should be relayed from server2 to server1 as soon as server1 is up again, but should not be stored on a mailbox in server2. I do not know if my solution behaves that way, but relaying was the only idea I had, and it is what I understood from the link I put above. – Genba Mar 25 '11 at 21:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.