Two ethernet cards in a single network, how to route packets from both interfaces?
I have a server and two clients that i use to measure for example the round trip time. The server is an individual computer with an IP= 192.168.0.4 and the clients are in the same computer, so i have one computer with two ethernet cards :
I am sending packets from .2 to .3 via the server and viceversa. So, each client has a receiver and a sender. Programming the sockets, i bind one of the clients to .2 and the other .3 in both the sender and receiver hoping that this will make the computer two use the rigt ethernet card.
Unfortunately by looking at wireshark i realise that i am sending packets from the same ethernet card , that is, wireshark shows different IPs (as expected from binding the sockets) but the MAC address is alwasy the same.
I have a look to the routing table by netstat -nr and indeed i understand what is happening, the routing table says
Destination | Gateway | Mask | ... Interface
192.168.0.0 0.0.0.0 255.255.255.0 eth0
192.168.0.0 0.0.0.0 255.255.255.0 eth2
So all packets routed to the server are going through eth0. How can i make use of eth2??? any ideas how to program to bind to a MAC address rather than IP address??