Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a Linux box with two interfaces: one for data and the other for management purpose. If both are on the same network, I have a route added for both interfaces.

Imagine the routing table is: eth0 eth1 ( management interface)

The problem is that even if a connection is initiated to mgmt IP (eth1), return traffic will be on eth0.

How can I ensure that return traffic on a connection uses the same interface as that of forwardeded traffic?

share|improve this question
up vote 3 down vote accepted

Ideally, both the interfaces should be part of differen IP subnets, but if you are convinced that you need to go this way only, then you should use linux split access routing.

Linux split access description

Split Access example from Novell

First, create two routing tables, T1 and T2 to be used for packets sent to or from these NICs by adding the lines

252 T1
251 T2

to /etc/iproute2/rt_tables.

Next, set up the routing rules to route incoming and outgoing packets via these tables:

ip route add dev eth0 src table T1
ip route add default via dev eth0 src table T1
ip rule add from table T1

ip route add dev eth1 src table T2
ip route add default via dev eth1 src table T2
ip rule add from table T2
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .