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 -> (onboard nic) eno1 -> (USB-nic)

Both adapters are directly to a different destination pc with an Ethernet cable: -> (destination PC 1) -> (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("", 2000)
sock.sendto("test", ("", 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

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?

| improve this question | | | | |
  • 1
    Using multiple network interfaces simultaneously in Linux isn't as straightforward as that. It requires setting up a separated routing table for each of the interface askubuntu.com/a/151966/20381 While you are at that, have a look also at multi-path kernel project – Flint Jan 14 '16 at 13:32

I think it works as it is supposed to. I believe you have problems with the routing table.

When you connect the first adapter the default routing is set up through this adapter. When you connect another one, the default routing is already setup for the first adapter. The second adapter does not work because there is no routing that would use it. Try to type /sbin/route of /sbin/route -n. You will see how the packets are routed.

I would add routes for your two connections, because if I understand correctly you only want to send your UDP packets via these connections. What about other traffic? Try it this way:

/sbin/route add -net netmask dev eno0
/sbin/route add -net netmask dev eno1

In that way you specify that traffic for should go via eno0 and traffic for via eno2. If you only need these to connections it should work. However, if you have other connection and want them to work too. You would need to make sure other routes are correct too.

I would recommend to use different address ranges for two connections. In that way you don't need to change routing tables manually:

eno0:, PC1:
eno1:, PC2:
netmask: for all connections
default gateway is not important in this case, because pairs are on the same network range
| improve this answer | | | | |
  • This worked for me, thank you very much for your help! – Brilsmurfffje Jan 15 '16 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.