1

I have 2 1Gbps USB Ethernet dongles on the same PC that are cabled together, and I'd like to ping (and maybe iperf) between them to quickly verify performance. I've assigned them different static addresses on the same subnet, but my pings are handled in the network stack and don't go through the hardware.

How do I force the pings to go out through the hardware then over the wire between the adapters?

Context: I have dozens of 1G USB RJ-45 Ethernet adapters of various ages, and I'm trying to quickly identify the dead and slow ones without putting traffic onto the LAN.

BTW, it's a Win10 PC with WSL Ubuntu 20.04, so any solution that works via either domain is fine with me.

Edit: Both adapters are on USB3 ports.

1
  • Hi Bob welcome to SuperUser. Just edit your original Question to include that information rather than leaving it in a comment.
    – Spiff
    Jun 4, 2020 at 20:30

2 Answers 2

1

WSL won't help. However, if you can boot actual Linux on the hardware (and if your USB adapters are actually supported on it...), you can easily separate the two interfaces using "network namespaces":

ip addr add fd00::1/64 dev usb1
ip addr add fd00::2/64 dev usb2

ip netns add foo
ip link set usb2 netns foo

ip netns exec foo iperf3 -s &
iperf3 -c fd00::2
1
  • BTW, the IP address for the interface added to the netns must be added from within that netns: The port configuration in the default namespace is not copied to the new namespace, only the interface hardware is reassigned as a new entry.
    – BobC
    Jun 5, 2020 at 19:15
0

Honestly, your best bet would be to get a second machine, or use a VM or two with the Ethernet adapters connected to the VM(s) at the USB level (not bridged / presented as a virtual interface)...


Read up on the "host model" concept.

Fundamentally:

  • The "weak host model" means that a system will accept traffic for any address configured on any interface, regardless of which interface it was received on.
  • The "strong host model" means that a system will only accept traffic destined for an address that is configured specifically on the interface that the packet arrived on.

This situation is further exacerbated in your situation because the destination address you are communicating with is actually on the local system, so there is no need to transmit the data over the wire.

It is possible to set the source address with Window's ping utility using the -S srcaddr option, but I don't expect this to work out for you very well as it's not binding the transmission to a specific interface... even if there was an option to do this, as above, you're probably using the weak host model, and the packet will "short circuit" and never appear on the wire... you might have more joy with the Linux ping utility and -I, but I don't know how WSL works at this level.


ping isn't a great indicator of performance / function, so once the link is confirmed I'd recommend running iperf3 as well.

5
  • Not even by doing something with routes?
    – BobC
    Jun 4, 2020 at 21:28
  • Routing won't help, as both interfaces are on the same subnet - you don't need to send the data to a router / gateway to get to the other interface. If the interfaces were on different subnets and you had a router between them, then routing still likely wouldn't work for the reasons discussed in my answer... and then you'd probably be testing the performance of the router at that point, not the NICs.
    – Attie
    Jun 4, 2020 at 21:34
  • I can change the IP address as needed, if that'll help.
    – BobC
    Jun 4, 2020 at 21:38
  • "If the interfaces were on different subnets [...] then routing still likely wouldn't work for the reasons discussed in my answer"
    – Attie
    Jun 4, 2020 at 21:39
  • I added a Vbox Ubuntu VM, assigned one USB adapter to the VM and configured it there, but the traffic still does not go out over the wire: traffic persists with no cable present between NICs. Surprisingly, I'm seeing only ~500 Mbps on an i7. Weird.
    – BobC
    Jun 5, 2020 at 18:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .