Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Postfix Documentation
Previous Page Home Next Page

Running Postfix behind a firewall

The simplest way to set up Postfix on a host behind a firewalled network is to send all mail to a gateway host, and to let that mail host take care of internal and external forwarding. Examples of that are shown in the local area network section above. A more sophisticated approach is to send only external mail to the gateway host, and to send intranet mail directly. That's what Wietse does at work.

Note: this example requires Postfix version 2.0 and later. To find out what Postfix version you have, execute the command "postconf mail_version".

The following example presents additional configuration. You need to combine this with basic configuration information as discussed the first half of this document.

 1 /etc/postfix/
transport_maps = hash:/etc/postfix/transport
relayhost =
 4     # Optional for a machine that isn't "always on"
 5     #
fallback_relay = []
 7 /etc/postfix/transport:
 8     # Internal delivery.
 9      :
10     :
11     # External delivery.
12     *                


  • Lines 2, 7-12: Request that intranet mail is delivered directly, and that external mail is given to a gateway. Obviously, this example assumes that the organization uses DNS MX records internally. The [] forces Postfix to do no MX lookup.

  • Line 3: IMPORTANT: do not specify a relayhost in

  • Line 5: This prevents mail from being stuck in the queue when the machine is turned off. Postfix tries to deliver mail directly, and gives undeliverable mail to a gateway.

Specify dbm instead of hash if your system uses dbm files instead of db files. To find out what lookup tables Postfix supports, use the command "postconf -m".

Execute the command "postmap /etc/postfix/transport" whenever you edit the transport table.

Postfix Documentation
Previous Page Home Next Page