Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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'm running a high availability cluster, and so far, most things work great. I have two external machines that act as outgoing mail hosts (smarthosts). The internal hosts are configured to relay all email through these two external facing hosts.

My smarthosts' looks like this:

myhostname =
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination =, localhost
relayhost =
mynetworks =

My internal hosts' looks like this:

mynetworks =
myhostname =
mydestination = $myhostname, localhost.$mydomain, localhost
relayhost = []
smtp_fallback_relay = []

lb1's internal IP is, and lb2's internal IP is

On the external hosts, email for root and www-data is forwarded to with /etc/aliases.

One advantage to using the smarthost setup is that spam filters and the like can connect back to the sending sending server. All email is sent fine, and headers look like this:

Received: from ([])
        by with ESMTP id y17si1571259icb.76.2011.;
        Thu, 13 Jan 2011 18:20:32 -0800 (PST)
Received-SPF: neutral ( is neither permitted nor denied by best guess record for domain of client-ip=;
Received: from (unknown [])
    by (Postfix) with ESMTP id D364823C0BE
    for <>; Thu, 13 Jan 2011 21:20:31 -0500 (EST)
Received: by (Postfix)
    id C9FA7760D6A; Thu, 13 Jan 2011 21:20:31 -0500 (EST)
Delivered-To: www-data@localhost
Received: by (Postfix, from userid 0)
    id C1632760D6C; Thu, 13 Jan 2011 21:20:31 -0500 (EST)

The problem is bounced/reject email. The external machine tries to forward the email back to the internal machine, e.g. www-data on web1 sending an email that bounces (such as a user signing up with a bad email address).

An additional complication is using Google mail for the main domain.

In lieu of specifying every internal host in the external hosts' mydestination, is there a better way of setting things up, keeping in mind I can't adjust touch the mx for

share|improve this question
up vote 0 down vote accepted

Set the sender address to an address that can receive email. Email will bounce to the sender address. The sender should always be an address which can receive email. Look at the options for header rewriting in the Postfix documentation.

share|improve this answer
Thank you for pointing me in the right direction. I found this and it worked: – Mark Rose Jan 20 '11 at 19:09

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.