简体   繁体   中英

not able to forward client IP to server using HAProxy

I am trying to connect my android app to server, using TCP connection. for that, i am using HAProxy server. below is the configuration for same.

frontend fe-plain-cs
bind xx.xx.xx.xx:8443 transparent
default_backend be-plain-cs 

backend be-plain-cs
fullconn 50000
balance roundrobin
source 0.0.0.0 usesrc clientip 
server k010 xx.xx.xx.xx:8443  check inter 10m fall 1 rise 1 maxconn 25000
server k011 xx.xx.xx.xx:8443  check inter 10m fall 1 rise 1 maxconn 25000

if you need more info let me know.

below is my iptable rules:

  :PREROUTING ACCEPT [2:230]
  :INPUT ACCEPT [2:230]
  :OUTPUT ACCEPT [3:370]
  :POSTROUTING ACCEPT [0:0]
  -A PREROUTING -s 10.13.0.0/16 ! -d xx.xx.xx.xx/32 -j ACCEPT
  -A PREROUTING -p tcp -m tcp --dport 80 -j DNAT --to-destination :8080
  -A PREROUTING -p tcp -m tcp --dport 443 -j DNAT --to-destination :8443
  -A PREROUTING -p tcp -m tcp --dport 843 -j DNAT --to-destination :8843
  -A POSTROUTING -s xx.xx.xx.xx/32 -j ACCEPT
  -A POSTROUTING -s 10.13.0.0/16 -j MASQUERADE
  COMMIT

below is my sys

  /etc/sysctl.conf
  net.ipv4.ip_forward = 1
  net.ipv4.ip_nonlocal_bind = 1
  net.ipv4.conf.default.rp_filter = 1

Stop your iptables service and Selinux should be disabled. service iptables stop Vi etc/selinux/config selinux=disabled

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM