【问题标题】:not able to forward client IP to server using HAProxy无法使用 HAProxy 将客户端 IP 转发到服务器
【发布时间】:2017-02-14 02:26:10
【问题描述】:

我正在尝试使用 TCP 连接将我的 android 应用程序连接到服务器。 为此,我正在使用 HAProxy 服务器。以下是相同的配置。

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

如果您需要更多信息,请告诉我。

以下是我的 iptable 规则:

  :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

下面是我的系统

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

【问题讨论】:

标签: linux unix linux-kernel iptables haproxy


【解决方案1】:

停止你的 iptables 服务,Selinux 应该被禁用。 服务 iptables 停止 vi etc/selinux/config selinux=禁用

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-26
    • 2016-03-13
    • 1970-01-01
    • 2017-12-24
    • 1970-01-01
    相关资源
    最近更新 更多