Two ethernet cards in a single network, how to route packets from both interfaces?
Hi,
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 : eth0 192.168.0.2 eth1 192.168.0.3 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?? Thanks |
I'm not aware of any way that your configuration would work with both cards on the same network, IP routing would always use eth0 for outbound packets. I'd add a network card to the server and configure 2 separate networks
Code:
[client_eth0]------(net1)-----[server_eth0] |
Change the metric.
|
Wouldn't that just swap the outbound adapter ? .. OP wants the clients to send traffic out the interfaces they're bound to as far as I can tell
|
Hi,
Thanks for the suggestions. I think i ll take kbp's suggestion. I ll be installing a new ethernet card on the server and insert some routing entrance to make sure that each card is actually being used. Thanks |
My final solution,
I generated a virtual network on my ethernet card (on the server side), then the clients send the packets to the virtual ip address with an static routing entrace with iproute. for the record, at the server, add the next lines in /etc/network/interfaces auto eth0:1 iface eth0:1 inet static address 192.168.10 netmask 255.255.255.0 gateway 192.168.0.1 hwaddress eher xx:xx:xx:xx:xx where you have to substitude the x for your mac address at the client add at the routing table by tiping in a command route add -host 192.168.0.2 dev eth0 route add -host 192.168.0.10 dev eth1 Thanks for your comments |
All times are GMT -5. The time now is 01:26 AM. |