I have a laptop running with Ubuntu 15.10. Here there is one integrated Network adapter to which I added another one via USB. I now have two network interfaces which both show when I type ifconfig. Next I configured them both with a static IP: eno0 -> 192.168.0.21 (onboard nic) eno1 -> 192.168.0.22 (USB-nic)
Both adapters are directly to a different destination pc with an Ethernet cable: 192.168.0.21 -> 192.168.0.1 (destination PC 1) 192.168.0.22 -> 192.168.0.2 (destination PC 2)
Next I have a Python script to send UDP packets from the laptop to the destination PC:
import socket
import time
#create socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind("192.168.0.21", 2000)
sock.sendto("test", ("192.168.0.1", 2000))
This works if only one adapter is connected. When both adapters are connected this will only work for the interface that connected first. I then tried to send a ping via the interface not working. Lets say interface eno0 is working and can succesfully send UDP packets via the Python script, then this will not work:
ping -I eno1 192.168.0.2
It show that the packets leave the pc, and via Wireshark I can see them leaving the nic, I can even see the destination PC sending a reply but in the termnial it does not show and when aborting with ctrl+c I see that 5 packets have been send and all of them got lost. Pinging via eno0 works perfectly fine to the destination pc.
How do I fix this?