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.

—, ---- both on is used for management and the web gui, is used for the LB traffic.

Traffic coming into the LB hits the address, but seems to be egressing to the 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 (

    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 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 brd 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 brd 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 dev eth0 dev eth0 scope link src
# ip route show table eth1table
default via dev eth1 dev eth0 scope link src 

ip rules:

0:  from all lookup local 
32762:  from all to lookup eth1table 
32763:  from lookup eth1table 
32764:  from all to lookup eth0table 
32765:  from lookup eth0table 
32766:  from all lookup main 
32767:  from all lookup default 

ip ro

default via dev eth0 proto static metric 100 
default via dev eth1 proto static metric 101 dev eth0 proto kernel scope link src metric 100 dev eth1 proto kernel scope link src metric 101
  • Outgoing traffic simply uses the network routes provided. You need to give a lot more info, e.g. on what subnet are the backend servers? What does the routing table look like? Include the output of ip a and ip ro on 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.
    – wurtel
    Jan 10, 2019 at 10:50
  • Edited original question to reflect the info. Jan 10, 2019 at 16:35
  • @customcables067 is this a gateway?
    – c4f4t0r
    Jan 11, 2019 at 14:21
  • "yes" it's the gateway (I've simplified the IPs from the real setup, so in real life, no, it's not the gateway. I realized the problem after I posted this but didn't wanna go back and edit everything. Jan 11, 2019 at 16:29

2 Answers 2


If you want traffic to to originate from, then you need to add a rule:

ip rule add prio 32761 to lookup eth1table

As it is now, no rules match, and routing falls to the main routing table which has dev eth0 proto kernel scope link src metric 100 as first most-specific entry, so eth0 will be used with IP address

  • I only want traffic from eth1 to originate from Jan 11, 2019 at 18:26

Problem ended up being related to NetworkManager controlling the routes somehow. Uninstalled NetworkManager, cleaned up the interface config files and things started behaving as expected, including with tables and rules.

Source: https://www.howtoforge.com/community/threads/first-ip-ok-second-ip-times-out.38613/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.