Linux: Split networking

We have a CentOS server that has two network interfaces. Each of them is connected to a different network.

Think of it as a server connected to two different ISPs.

The challenge is that because the server can have only one default gateway, connections to this server can happen only through the network where default gateway belongs to. When somebody tries to connected from another network server’s reply goes via default gateway and gets rejected by the router.

On Linux this can be fixed with setting up Split networking. The idea is to have a separate routing table for each interface. This way reply goes through the same interface the original message was received on.

The following article describes in details on how to set it up:

These changes once made will stay on the server until it’s rebooted or until network service is restarted. To make these changes permanent they need to be added to the following files for each interface:


This is what should be done:

vi /etc/iproute2/rt_tables
250 T_27
251 T_34

from x.x.34.202 table T_34

default via x.x.34.1 table T_34
x.x.34.0/24 dev eth0 src x.x.34.202 table T_34

from x.x.27.175 table T_27

default via x.x.27.129 table T_27
x.x.27.128/26 dev eth1 src x.x.27.175 table T_27