I have a small Haproxy server set up with 2 NICs. The OS is CentOS7 and I have configured both NICs on the same subnet per CentOS documentation.
— 192.168.0.1, 192.168.0.2 ---- both on 192.168.0.0/24 192.168.0.1 is used for management and the web gui, 192.168.0.2 is used for the LB traffic.
Traffic coming into the LB hits the 192.168.0.2 address, but seems to be egressing to the 192.168.0.1 address to the backend servers. I’ve tried specifying “source IP” in the config to no avail.
Version is 1.8.16.
If I do the telnet from the LB CLI inside Linux, the routing seems to work correctly, so it seems the LB application itself isn’t going out on the correct interface/IP.
EDIT-1: Backend servers are on the same subnet as the LBs (192.168.0.0/24).
ip-a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether [mac screened] brd ff:ff:ff:ff:ff:ff inet 192.168.0.1/24 brd 192.168.0.255 scope global noprefixroute eth0 valid_lft forever preferred_lft forever 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether [mac screened] brd ff:ff:ff:ff:ff:ff inet 192.168.0.2/24 brd 192.168.0.255 scope global noprefixroute eth1 valid_lft forever preferred_lft forever
The following routes and ip rules have been manually added (per the guide https://access.redhat.com/solutions/30564)
# ip route show table eth0table default via 192.168.0.0 dev eth0 192.168.0.0/24 dev eth0 scope link src 192.168.0.1 # ip route show table eth1table default via 192.168.0.0 dev eth1 192.168.0.0/24 dev eth0 scope link src 192.168.0.2
0: from all lookup local 32762: from all to 192.168.0.2 lookup eth1table 32763: from 192.168.0.2 lookup eth1table 32764: from all to 192.168.0.1 lookup eth0table 32765: from 192.168.0.1 lookup eth0table 32766: from all lookup main 32767: from all lookup default
default via 192.168.0.0 dev eth0 proto static metric 100 default via 192.168.0.0 dev eth1 proto static metric 101 192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.1 metric 100 192.168.0.0/24 dev eth1 proto kernel scope link src 192.168.0.2 metric 101
ip roon the haproxy host (presumably the same as the "LB" loadbalancer, although that's an assumption; you could be doing load balancing separately and using haproxy e.g. for SSL offloading; hence we need more info) in your question.