routing between local addresses using an external network

From: Ritesh Kumar
Date: Sat Oct 29 2005 - 02:15:32 EST

I have two tun interfaces on my box and I was trying to route
packets between the two local addresses through a "userspace router"
hooked up to the file descriptors of the tun devices. I see the packet
appearing on both the interfaces (using tcpdump -i) but my (udp)
server listening for my packets on a particular port doesn't get any
of them. I force the packets to not take the localhost route by
explicitly specifying the interface on which I want the packet to be
sent (I think socat udp4:<dest addr>:<port>,interface=<ifname> ...)
does it using setsockopts() ).
In other words it seems that if linux receives a packet through an
interface (not the loopback) which has a src address equal to one of
the local addresses then the packet is not sent to the server
listening for it. Is there a way to work around this?
Searching for this on the web gave me a pointer to a mail in which
routing packets through an ethernet crossover (between two NICs
connected to the same computer) was discussed. It seems that there is
a small patch for it, but I was hoping if somebody had tricks to do it
using configuration changes (routing, /proc/sys settings etc) only.

Thanks for your attention!
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at