If i have a Linux 2.2.x machine with a loopback interface bound to address
<A>, is it possible (for testing purposes) get the machine to send packets
bound for <A> over eth0 to a gateway with address <G>?
Under FreeBSD you can do this with:
route add <A> <G>
But under Linux 2.2.12 when I tried:
route add <A> gw <G> dev eth0
this gives a routing table that seems reasonable:
Kernel IP routing table
Dest Gateway Genmask Flags Metric Ref Use Iface
<A> <G> 255.255.255.255 UGH 0 0 0 eth0
But despite this routing table, packets bound for <A> do *not* go to the
gateway, but rather through the loopback interface.
Is this a bug or a feature? How do i do this in Linux?