Load Balancing Outgoing Traffic with HAProxy

To work around some restrictions, I need to load balance outgoing traffic such that they appear to be coming from different IPs.

Here is how you do it with HAProxy:

    backend servers
        server srv1 target.example.com:8080 check source 0.0.0.0 usesrc 10.10.0.4
        server srv2 target.example.com:8080 check source 0.0.0.0 usesrc 10.10.0.5
        server srv3 target.example.com:8080 check source 0.0.0.0 usesrc 10.10.0.6

Use mode tcp and this works for SSL connections too. The IPs like 10.10.0.4 in the example are private IPs, but they will be translated to different public IPs thanks to Azure’s SNAT.

Tags// , ,