ip routing

From: Rainer Hochreiter
Date: Sun Nov 30 2003 - 03:29:14 EST


hi list!

i have a problem with ip routing!

first of all my configuration:

Tux1 .... embedded linux (kernel-2.4.10) running busybox-0.60.3
and 2 lan interfaces in different networks
default gateway 10.1.0.254 via eth0
R1, R2 .. router (linux for testing)
Tux2 .... linux with network different to Tux1/eth0/eth1

eth0=10.1.0.1/16 +-----+ eth1=10.2.0.1/16
.--|Tux1 |--.
| +-----+ |
eth1=10.1.0.254/16 | | eth1=10.2.0.254/16
+-----+ +-----+
ip_forward=1 | R1 | | R2 | ip_forward=1
+-----+ +-----+
eth0=10.3.1.254/16 | | eth0=10.3.2.254/16
| |
'-----+-----'
| eth0=10.3.0.1/16
+-----+
|Tux2 |
+-----+

i want to achieve, that each packet received on Tux1/eth1 will also be
replied via this interface. this isn't the case now, because the
received packets came from a different network and therefore the replies
are sent back via Tux1/eth0 using the default route.

but the replies have to be sent even when the connection between
Tux1/et0 and R1 is not available. a possible solution is, setting a
network route for network Tux2/eth0 via Tux1/eth1, but in my special
case, i do not know from which network i'll receive the packets!

and here i reached the point where my knowledge ends;-(

i tried to solve this problem in my application running on Tux1, using
the following code:

s = socket();
bind(s, "10.2.0.1"); // bind to Tux1/eth1
listen(s);
s2 = accept(s);
int yes=1;
setsockopt(s2, SOL_SOCKET, SO_DONTROUTE, &yes, sizeof(yes));

...but setting SO_DONTROUTE on socket s2 doesn't have the effect, that
the reply packets are always sent back via Tux1/eth1!
is it possible at all to guarantee this in any case? because this means
bypassing the routing stuff!

any hints welcome!

greetings,
rainer

PLEASE personally CC any answers and comment to my question - thnx!


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/