Search code examples
load-balancingpostfix-mtaaccess-denied

Postfix configuration when using 2 servers behind a load balancer (failover)


In my company we are facing the following issue. Can you help me to guess what is causing it? Thanks for your help :)

We have a Load Balancer: lbname.glb.itcs.companyname.net

which balances traffic in FAILOVER mode to:

  1. servername1.itcs.companyname.net

  2. servername2.itcs.companyname.net

Our problem is regarding email redirection. We intend to receive email from partners (external company) in our load balancer, but this fails (relay access denied). However, if we send email directly to any of the two servers, it works. Let me explain in more detail.

Case 1: email to the load balancer

The load balancer redirects correctly to the primary server (servername1), but this one rejects and we get back an email with the following content:

servername1.itcs.companyname.net rejected your message to the following e-mail addresses:
account@imspro.glb.itcs.hpecorp.net (account@imspro.glb.itcs.hpecorp.net)
servername1.itcs.companyname.net gave this error:
<account@imspro.glb.itcs.hpecorp.net>: Relay access denied

Case 2: email directly to servername1

It works with no issue and we are able to see the mail in our mailbox at linux level.


We have the following postfix configuration:

  • existing files in /etc/postfix

postfix files

  • main.cf file

main.cf


Solution

  • We solved this issue just adding the Load Balancer to the destinations file, so that the file looks now like this:

    lbname.glb.itcs.companyname.net
    

    It was empty before.

    We also needed to restart postfix service.