How can configure linux routing to send packets out one interface, over a bridge and into another interface on the same box

I'm trying to test a ethernet bridging device. I have multiple ethernet ports on a linux box. I would like to send packets out one interface, say eth0 with IP 192.168.1.1, to another interface, say eth1 with IP 192.168.1.2, on the same subnet.

I realize that normally you don't configure two interfaces on the same subnet, and if you do the kernel routes directly to each interface, rather than over the wire. How can I override this behavior, so that traffic to 192.168.1.2 goes out the 192.168.1.1 interface, and visa-versa?

Thanks in advance!


ANSWERS:


This is a guess, but I hope it is in the right direction.

Make more-specific routing table entries, along the lines of:

route add -host 192.168.1.2 dev eth0
route add -host 192.168.1.1 dev eth1

You may also need to fiddle with the accept_local configuration for both interfaces -- or the all setting. (Turning this on may make your machine more susceptible to IP source spoofing attacks; be sure you have good ingress firewall rules elsewhere to prevent trouble.) (See sysctl -a | grep accept_local for what I'm talking about.)


I think you need something like Mac-Vlan in your Linux. This cannot be done with NAT only. Read this: .



 MORE:


 ? Forcing external routing in XP with multiple NICs
 ? ping google.com or 8.8.8.8 fails
 ? Linux : I programatically changed my default route to eth0 but now I can't ping, any suggestions?
 ? Route command output
 ? Distance vector algorithm - maximum paths with 4 points
 ? Distance vector algorithm - maximum paths with 4 points
 ? Distance vector algorithm - maximum paths with 4 points
 ? Exchanges in Distance Vector routing
 ? Exchanges in Distance Vector routing
 ? Exchanges in Distance Vector routing