HAProxy is an open source load balancer. More info here: http://www.haproxy.org. HAProxy can load balance HTTP/HTTPS and supports session persistence.
The View Setup:
Internal Network Subnet: 192.168.100.x
External Network Subnet: 10.1.1.x
Two connection servers with the below IP Addresses:
Connection Server 1: 192.168.100.3
Connection Server 2: 192.168.100.4
Two Security Servers with the below IP Addresses:
Security Server 1: 10.1.1.3
Security Server 2: 10.1.1.4
HAProxy Load Balancer server configuration:
OS: Ubuntu Server 14.04
2 Network Adapters with the below IP Addresses
Network Adapter 1(eth0): 192.168.1.100
Network Adapter 2(eth1): 10.1.1.100
Install HAProxy
- Ensure that the Ubuntu server has internet access
- Run the command, “apt-get install haproxy”
- Backup and edit the file, /etc/default/haproxy and set the “ENABLED” option to “1”
Configure HAProxy
- Rename/Backup the original configuration file using the command. “mv /etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg.orig”
- Create a new haproxy.cfg file with the below configuration. The following config is for the view setup listed above
global
user haproxy
group haproxy
daemon
maxconn 20000
defaults
balance leastconn
clitimeout 60000
srvtimeout 60000
contimeout 5000
retries 3
option redispatch
listen stats 192.168.100.100:9000
mode http
stats enable
stats uri /stats
stats realm HAProxy Statistics
stats auth admin:supersecret
listen http 192.168.100.100:80
mode tcp
balance source
maxconn 10000
server cs1 192.168.100.3:80 maxconn 5000
server cs2 192.168.100.4:80 maxconn 5000
listen https 192.168.100.100:443
mode tcp
balance roundrobin
maxconn 10000
server cs1 192.168.100.3:443 maxconn 5000
server cs2 192.168.100.4:443 maxconn 5000
listen http 10.1.1.100:80
mode tcp
balance source
maxconn 10000
server ss1 10.1.1.3:80 maxconn 5000
server ss2 10.1.1.4:80 maxconn 5000
listen https 10.1.1.100:443
mode tcp
balance roundrobin
maxconn 10000
server ss1 10.1.1.3:443 maxconn 5000
server ss2 10.1.1.4:443 maxconn 5000
- Restart HAProxy using the command, “service haproxy restart”