USB With Linux All articles
Networking

One Scanner, Three Desktops: USB over IP That Earns Its Keep at Home

USB With Linux
One Scanner, Three Desktops: USB over IP That Earns Its Keep at Home

Photo: hbo, Public domain, via Wikimedia Commons

The scanner lives in the office. You mostly work in the basement, and the laptop on the kitchen counter occasionally needs the label printer. Nobody wants to buy three scanners, and USB extension cables over 5 meters start doing interpretive dance with signal integrity.

USB over IP is the pragmatic answer, and on Linux it is built into the kernel. It is also oversold, misunderstood, and quietly insecure by default. Here is the version that holds up in a house or a small office.

What usbip actually does

USB/IP splits the USB stack in two. A server machine runs usbip-host, binds a specific device, and exposes it over TCP. A client machine loads vhci-hcd, a virtual host controller, and attaches to the remote device. The device then appears in lsusb on the client as though it were plugged into a local port, and the normal in-kernel driver binds to it.

Everything above the host controller is fooled. That is the trick, and it is also the catch: the driver behaves exactly as if the device were local, including all of its assumptions about timing.

The ten-minute setup

On the machine with the hardware attached (the server):

sudo apt install usbip-utils
sudo modprobe usbip-host
sudo usbipd -D
usbip list -l
sudo usbip bind -b 1-3

On the machine that wants to use it (the client):

sudo modprobe vhci-hcd
usbip list -r 192.168.1.20
sudo usbip attach -r 192.168.1.20 -b 1-3

Check with usbip port on the client and lsusb to confirm the device appeared. Detach with usbip detach -p 0, and always unbind on the server before you power anything down, or the next attach may find the bus ID has shifted.

Package names differ slightly by distro — Fedora ships usbip and the modules in kernel-modules-extra — but the commands are identical everywhere. There is also a Windows client if one machine in the house is not running Linux.

What survives the trip and what falls apart

The dividing line is transfer type. USB has four: control, interrupt, bulk, and isochronous. USB/IP handles the first three well and the last one badly enough that you should not bother.

Works fine:

Do not bother:

The network matters more than the config

Wired gigabit, same switch, ideally same VLAN. Wi-Fi will technically carry it, and then the scanner will time out halfway through a 30-page duplex job. If the two machines are on different floors, run the cable — this is the one place in a home network where pulling Cat 6 is genuinely worth the effort.

The security problem nobody mentions

USB/IP has no authentication. Any host that can reach TCP port 3240 can list and attach the bound devices. There is no password, no token, no TLS.

So treat it accordingly:

Alternatives, honestly ranked

Before you install anything, ask whether USB/IP is the right tool:

  1. Printers — use IPP Everywhere and CUPS. Driverless printing over the network is mature, and USB/IP adds a failure mode for no gain. Skip this entire article for printers.
  2. Scanners — try sane-airscan first; it covers a surprising number of modern multifunction devices with zero server component. Fall back to saned if the device is supported. USB/IP when neither works.
  3. Serial — ser2net or socat is lighter than USB/IP, survives reconnects better, and does RFC 2217 if you need it.
  4. Everything else — USB/IP is the right answer, and it costs you one daemon.

Making it survive a reboot

By default nothing auto-attaches, which means the scanner is invisible every time the client reboots. A small systemd unit on the client, ordering after network-online.target with a retry loop, is the standard fix. On the server, bind the device at boot with a udev rule keyed to the vendor and product IDs rather than the bus path, because bus numbering changes when you unplug and replug.

Add a timeout and a couple of retries — the daemon often starts before the device has finished enumerating.

The verdict

USB/IP is a genuinely excellent tool with a narrow job description: mid-bandwidth, non-isochronous devices that need to live on a machine other than the one they are plugged into. Scanners, serial adapters, dongles. It is not a way to turn your desktop into a remote peripheral farm, and it is not secure unless you make it so.

If that describes your setup, it is ten minutes of work and it quietly solves a decade-old annoyance. If it does not, buy the second scanner — it will cost less than the weekend you would spend debugging timeouts.

All Articles

Related Articles

Ports on a Leash: A Working USBGuard Allowlist for Real Linux Desktops

Ports on a Leash: A Working USBGuard Allowlist for Real Linux Desktops

Your DAC Is Probably Fine: A Diagnostic Ladder for Crackly USB Audio on Linux

Your DAC Is Probably Fine: A Diagnostic Ladder for Crackly USB Audio on Linux

When USB Ports Lie: Power Budgets, Brownouts, and PD Negotiation on Linux

When USB Ports Lie: Power Budgets, Brownouts, and PD Negotiation on Linux