TransWikia.com

Issue with HAProxy 2.0.7 setup with tproxy on Centos-7

Server Fault Asked by Shailendra Pratap Singh on September 13, 2020

I am Trying to setup HAProxy with transparent proxy on Centos-7 machine.
Env: ( 2-http server ==>> HAProxy server ==>> ClientVM )

I have configured http servers with normal haproxy and it works fine.

When i configure haproxy.cfg file as below:

global
   log /dev/log local0
   log /dev/log local1 notice
   chroot /var/lib/haproxy
   stats timeout 30s
   #user haproxy
   #group haproxy
   user root
   group wheel
   daemon

defaults
   log global
   mode tcp
   option tcplog
   option dontlognull
   timeout connect 5000
   timeout client 50000
   timeout server 50000

frontend App_in
       **bind haproxy-ip:80 transparent**
       mode tcp
       default_backend App_out
    
backend App_out
       mode tcp
       log global
       **source 0.0.0.0 usesrc clientip**
       balance roundrobin
       server http-1 http-1-ip:80
       server http-2 http-2-ip:80

i am able to start the haproxy server and i get the response curl from the terminal of haproxy server but when i curl from ClientVM i get response as curl: (52) Empty reply from server :

I have also executed an iptables-rule.sh script to configure iptables on HAProxy server as below:

#!/bin/bash
iptables -F
iptables -F -t nat
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

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP