I would like to send data between two Ethernet interfaces that are connected to the crossover cable in Linux. Two ethernet interfaces are in one window. I defined Ethernet interfaces for different static IP addresses (1.2.3.4 and 5.6.7.8) and used sockets to send bytes from one IP address to another. I want to emphasize that I want the data to leave the field of one interface of the field and get it on another interface of the same window. One consequence of this is that disconnecting the cable will prevent communication between the client and server in the same field.
The core is smarter than I, I think, and decides that it does not need to send information to the wire and send data directly between the sockets inside, thereby denying the test. I tried using SO_BINDTODEVICE to force the client to send data from a specific interface, but the server never sees it. I'm really stuck, and it doesn't seem like it should be that hard.
There are two entries in the route table -n
Dest Gateway Genmask flags metric use interface
1.2.3.0 0.0.0.0 255.255.255.0 U 0 0 eth0
5.6.7.0 0.0.0.0 255.255.255.0 U 0 0 eth1
source
share