r/exchangeserver • u/J4NN7J0K3R • Dec 21 '25
Question Loadbalancing solution for Exchange-Servers
Hi,
we are running a Microsoft Exchange infrastructure behind a destination NAT load balancer and want to change to a software solution.
I discovered HAProxy and think it could be a possible solution for us, except for IMAP and SMTP in TCP mode because we can't see the correct source IP address in the IMAP and SMTP logs.
However, we can add the Forwarded-For HTTP header for IIS. Is there nothing equivalent for IMAP or SMTP, right?
Microsoft Exchange doesn't support the proxy protocol, if I'm not mistaken?
What can I do to get the correct IP address for the backend Microsoft Exchange servers?
Thanks in advance for your answers!!
9
u/BlackCodeDe Dec 21 '25
Try https://kemptechnologies.com/
They have Exchange Templates.
2
u/8bit_dr1fter Dec 21 '25
I know Kemp was mentioned, personally though after doing a POC with their virtual appliance and then using a Citrix ADC (formerly and now once again NetScaler) for several years, the Kemp is awful. I’ve unfortunately reinforced this opinion in the last couple years with a new employer who exclusively uses Kemp hardware load balancers.
If you can make the budget work, go for NetScaler.
1
u/hftfivfdcjyfvu Dec 21 '25
2 x virtual 1gb f5 appliances with the ltm license (all that’s needed for exchange) and 3 years of support is 40k. That’s not a lot of money Or as other poster mentioned do Netscaler.
Or there is haproxy or yes even kemp
1
u/ntwrkmstr Dec 21 '25
We use HAproxy for Web, SMTP, IMAP and POP3 traffic across our exchange servers. It works well, but failover is done by the hypervisor, not the appliance.
SMTP, IMAP and POP3 use Least Connection in TCP mode because they are session based anyway. It is just for making sure it gets to a server. I'm about 99% sure we get the true source IP at the server as we have some allow lists / rules in exchange and they are working ok last time i checked. It has been a while though, so I may be wrong
The other one we use for RDgateway (because HAProxy couldn't do it) was loadbalancer.org which works really well. It uses OpenSource under the hood anyway, but it is packaged well and does the UDP and raw TCP sessions a little better. They had good support for things like exchange
1
u/nervehammer1004 Dec 22 '25
We use two Haproxy nodes to load balance all the exchange traffic for our org. One is primary and one secondary using a single virtual ip that both nodes trade when one goes down. The allow lists for ip’s are handled on the haproxy with acl’s and not on the Exchange servers. Also the haproxy nodes handle the ssl certs. Google for ezoltan.blogspot.com for the post he made in 2014 for load balancing Exchange. It’s an excellent reference
1
u/Mr_Tomasz Dec 22 '25
Running Exchange HTTPS/SMTP/IMAP without any problems for more than 5 years behind Haproxy, full node health checking, etc. If you want a GUI to deal with more complicated configs - check OPNsense.
1
u/stubby1985 Dec 22 '25
F5 works well for my cluster of 8 servers. I use x-forwarded-for to preserve the source IP’s in the logs but don’t use f5 for smtp load balancing yet.
1
u/adc_opinion_ Dec 22 '25
Which version of Exchange are you looking to load balance? Many guides on how to configure your load balancer for MS Exchange here; https://www.loadbalancer.org/applications/microsoft-exchange/
1
u/Forumschlampe Dec 22 '25 edited Dec 23 '25
Look at Loadbalance.org, basically stunnel, haproxy with Support and Setup Guides. If u check their guides u see whats possible but in Most cases, yes Client ips are Not visible to Exchange Servers
In most cases nlb will work, too
1
u/xPWn3Rx Dec 22 '25
We used NetScaler because we had it. We are Exchange Online now.
1
u/dragoangel Dec 26 '25
To preserve source ip in tcp you have 2 options :
send-proxydirective, which basically injection srcip:port into start of every package. There are plenty of examples on the web that show how to do that. The only point that backend app must be explicitly configured (and obviously support) to use proxy protocol. The issue that Exchange not implemented one on their end, for SMTP they support XCLIENT extension which can pass srcip from upstream SMTP server, f.e. postfix and postfix can read proxy protocol, for imap/pop there no option at all to utilize it unfortunately. https://www.haproxy.com/blog/use-the-proxy-protocol-to-preserve-a-clients-ip-addressusesrc clientipwhich tells HAProxy to spoof the client source IP, then Exchange sees the real client IP, not the load balancer. HAProxy must run as root or with: CAP_NET_ADMIN & CAP_NET_RAW, and kernel must allow to bind non-local source IPs0
u/KStieers Dec 21 '25
Google "haproxy client ip preservation"
You have to handle it with iptables rules...
-3
u/sembee2 Former Exchange MVP Dec 21 '25
You don't need load balancing on SMTP, it is unnecessary. Just list both servers in the MX records.