I tried the ip route ... table local method above. Either it doesn't work or I am doing something wrong.
The trick is to use a set of dummy IP addresses to force the kernel into routing it through the wire, and NAT to change it back to the real IP address.
Let eth0 and eth1 be the two ethernet cards; IP0 and IP1 its IP address; MAC0 and MAC1 its MAC address respectively. We will be using two dummy IP addresses: IP00 and IP11.
arp -s IP00 MAC0
arp -s IP11 MAC1
ip route add IP00 dev eth1
ip route add IP11 dev eth0
iptables -t nat -A POSTROUTING -d IP11 -j SNAT --to-source IP00
iptables -t nat -A POSTROUTING -d IP00 -j SNAT --to-source IP11
iptables -t nat -A PREROUTING -d IP00 -j DNAT --to-destination IP0
iptables -t nat -A PREROUTING -d IP11 -j DNAT --to-destination IP1
Use the dummy IP addresses IP00 and IP11 instead of the real one.