[root@localhost ~]# yum -y install haproxy
[root@localhost ~]# cat /etc/haproxy/haproxy.cfg
global
log 127.0.0.1 local0 info
defaults
log global
option tcplog
option httplog
option forwardfor
timeout client 30s
timeout server 30s
timeout connect 30s
frontend MyFrontend
bind *:80
default_backend TransparentBack_http
backend TransparentBack_http
mode http
source 0.0.0.0 usesrc client
server 192.168.174.139:80 192.168.174.139:80
server 192.168.174.139:90 192.168.174.139:90
listen stats
bind 192.168.3.68:9000
mode http
stats enable
stats uri /haproxy_stats
stats realm Haproxy\ Statistics
stats auth 123:123
iptables -t mangle -N DIVERT iptables -t mangle -A PREROUTING -p tcp -m socket -j DIVERT iptables -t mangle -A DIVERT -j MARK --set-mark 1 iptables -t mangle -A DIVERT -j ACCEPT
- ip rule add fwmark 1 lookup 100
- ip route add local 0.0.0.0/0 dev lo table 100
- [...]
- frontend ft_application
- bind 1.1.1.1:80 transparent
- [...]
- [...]
- backend bk_application
- source 0.0.0.0 usesrc clientip
- [...]