I run RHEL 5 and have two NICs on one machine connected to the same subnet:
My application needs to receive and transmit UDP packets (both unicast & broadcast) via these interfaces. I've found the way to handle the ARP problem and I've added routes to handle the routing problem:
ip rule add from 192.168.100.10 lookup 10
ip route add table 10 default src 192.168.100.10 dev eth0
(and similarly, table 11 for eth1)
The problem is that only unicast packets gets routed properly. Broadcast packets always go out through eth0. I tried removing the rule for 192.168.100.0 & 192.168.100.255 from table 255 and adding them to my tables. But then I see ARP requests being given out for packets to 192.168.100.255 (obviously, no nodes respond and nobody gets any data).
Due to several techno-political issues, I'm stuck with this configuration and can't change subnets or try something different. I've tried SO_BINDTODEVICE and it works, but I'd prefer a solution that doesn't need my application to run as root.
Is there a way to get this working? Any help is highly appreciated.