HAProxy cannot bind socket for proxy on a remote machine

clusterhaproxyload balancing

I'm using HAProxy to load balance the incoming requests on my two tomcat backend servers.
In the config file when I specify HAProxy to listen to the same machine on which the HAProxy is installed, everything is fine and it starts to work like a charm.
I need HAProxy to listen to a virtual IP on another machine (so that I can install another LB as failover), but when I config HAProxy to do so, I get this error on starting HAProxy:

cannot bind socket for proxy http_proxy. Aborting.

here is my config file:

global
    maxconn 4096 # Total Max Connections. This is dependent on ulimit
    daemon
    nbproc 4 
defaults
    mode http
    clitimeout 60000
    srvtimeout 30000
    contimeout 4000
    option httpclose # Disable Keepalive

listen http_proxy 10.0.5.99:80 #the virtual IP I want to listen to
    mode http
    stats enable
    stats auth xxx:xxx
    balance source # Load Balancing algorithm
    option httpchk
    option forwardfor # This sets X-Forwarded-For
    ## Define your servers to balance
    server web1 10.0.5.102:8080 weight 1 maxconn 512 check
    server web2 10.0.5.103:8080 weight 1 maxconn 512 check

I'm using CentOS 5.1 installed on some virtual machines. It's necessary to say that I completely stopped the iptables service on the remote machine and the problem is still there. I suppose something is interfering with haproxy in the remote machine. Any Ideas?

Best Answer

You can also allow a process to bind to a non-local (i.e., non-existent IP) by adding net.ipv4.ip_nonlocal_bind=1 to /etc/sysctl.conf and running sysctl -p. But what sysadmin1138 is valid: you may want to look at how you've architected your failover.