The best way to do TCP/IP over USB on Linux

10

8

I want to establish a TCP/IP link between two Linux machines that have several USB 2.0 ports as the only connection options. Since both host and slave ports are available, I can connect them via a simple USB cable. What are the possibilities to forward TCP/IP over that cable and which one should I use to achieve highest bandwidth?

So far I've tried ADB (Android Debug Bridge) forwarding, but the throughput is poor -- only 30-40Mbps. I think that it should be possible to achieve at least 150-200Mbps using a specialized driver -- USB hard drives occasionally move files at 240-280Mbps out of the 480 theoretically available.

jons34yp

Posted 2013-05-10T03:03:18.260

Reputation: 389

1You could get two USB network cards (you can get gigabit ones, but they won't max out at their full speed) and just use the normal networking stack..? – Mark Henderson – 2013-05-10T03:05:57.587

They cost more and add additional overhead. – jons34yp – 2013-05-10T03:12:18.807

1Well, you didn't mention anything in your question about budget requirements, and they might be overhead but it's going to be faster than 40Mbps. – Mark Henderson – 2013-05-10T03:28:28.390

What do you mean both master and slave ports are available? PCs only have master ports. – psusi – 2013-05-10T03:55:22.677

1@MarkHenderson - "get two USB network cards" - it's not (correctly) called a "card" when it's no longer a naked PCB (printed circuit board). When it's encased, then it's a module or an adapter. Otherwise I agree, a pair of USB-to-Ethernet adapters is the most straightforward (and maybe the "best") solution. Unless "best" only means "fastest". – sawdust – 2013-05-10T07:28:27.077

Answers

11

Ethernet over USB drivers are included into Linux. The relevant host-size drivers are CDC_ETHER and RNDIS. Their slave-size counterparts (that essentially emulate an USB-Ethernet bridge in software) are USB_ETH, USB_ETH_RNDIS. USB_G_ANDROID also supports RNDIS protocol, which is great in my case, since the devices in question use Android kernel, so the driver is enabled by default.

The measured bandwidth of the USB bridge using the USB_G_ANDROID driver is ~130Mbps from host to slave and ~90Mbps the other way round.

jons34yp

Posted 2013-05-10T03:03:18.260

Reputation: 389