Haproxy configuration binding an interface

haproxy

I have a setup question for my future configuration.
I have a vm jessie with 2 networks interfaces (eth0 and eth1) and i want to tell to my haproxy configuration to bind trafic from eth1.
Is someone can help ?

Best Answer

Just use bind directive:

bind [<address>]:<port_range> [, ...] interface <interface>

Comes from the manual: http://www.haproxy.org/download/1.3/doc/configuration.txt

Update: It's the same for newer versions - check out:

http://www.haproxy.org/download/1.5/doc/configuration.txt > 5.1. Bind options > interface < interface >

Restricts the socket to a specific interface. When specified, only packets received from that particular interface are processed by the socket. This is currently only supported on Linux. The interface must be a primary system interface, not an aliased interface. It is also possible to bind multiple frontends to the same address if they are bound to different interfaces. Note that binding to a network interface requires root privileges. This parameter is only compatible with TCPv4/TCPv6 sockets.

Related Topic