Postfix on two servers. Can I route all mail though just one of them

postfixsmtp

I have at least two web servers which utilise Postfix to send mail from web applications. One is what I call the 'master' which will remain static and the other is what I call the 'slave', which is cloned often for load distribution. Each clone is given a random external IP. All of the servers are on a private IP range of 192.168.x.x to talk to each other.

I have a requirement to send mail via a particular SMTP relay from a client but an IP is needed for firewall rules. The issue is that I can't guarantee the IP of the servers except for the 'master'.

Is there a way I can direct mail from the 'slave' servers to the 'master'? Ideally, the master will then route mail to the SMTP relays that are set up for each domain.

Thanks

Best Answer

Yes, that's what the transport table is for, depending on what you use (SQL, dbm, flat text files, etc) the setup is fairly simple.

On the slave you'd create an entry like this client.domain smtp:[ip.of.the.master]

That will mean that when the slave server receives mail for that domain, it will use smtp to relay it to your master server, who will then send it on to its final destination.