USB over IP


Fyzické připojení k jednomu hostovi, používání na druhém. Používáme pro live motion guestů.

Requirements

Distro: EL8 – nejsnadnější cesta OL8

Repo: yum install https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm

Package: dnf install usbip-utils kmod-usbip usbutils

Boot: kernel 4.18

grubby –set-default „/boot/vmlinuz-4.18.0-193.1.2.el8_2.x86_64“

Configuration

usbip list –local

modprobe usbip_core
modprobe usbip_host

echo usbip_core >> /etc/modules-load.d/usbip.conf
echo usbip_host >> /etc/modules-load.d/usbip.conf

sudo usbipd -D

firewall-cmd –add-port=3240/tcp –permanent

sudo usbip bind -b 1-1.3

/etc/systemd/system/usbipd.service

[Unit]
Description=Usbipd
After=network.target

[Service]
Type=forking
ExecStart=/usr/sbin/usbipd -D

[Install]
WantedBy=multi-user.target

systemctl enable usbipd –now

sudo dnf install kernel-uek-modules-extra

/etc/systemd/system/usbip-device@.service

[Unit]
Description=USB-IP Binding device id %I
After=network-online.target usbipd.service
Wants=network-online.target
Requires=usbipd.service

[Service]
Type=simple
ExecStart=/bin/sh -c "/usr/sbin/usbip bind --$(/usr/sbin/usbip list -p -l | grep '#usbid=%i#' | cut '-d#' -f1)"
RemainAfterExit=yes
ExecStop=/bin/sh -c "/usr/sbin/usbip unbind --$(/usr/sbin/usbip list -p -l | grep '#usbid=%i#' | cut '-d#' -f1)"
Restart=on-failure
 
[Install]
WantedBy=multi-user.target

systemctl enable usbip-device@11b0:6298 –now

usbip list –remote 127.0.0.1

dnf install elrepo-release

dnf install kmod-usbip

usbip attach –remote=127.0.0.1 –busid=1-1.3

lsusb

/etc/systemd/system/usbip-client@.service

[Unit]
Description=USB-IP Attaching device id %I
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
ExecStart=/bin/sh -c "/usr/sbin/usbip attach --remote=usb1.pavkamlc.cz --busid=$(usbip list -p --remote=usb1.pavkamlc.cz | grep %i | cut -d : -f 1 | sed 's/^ *//')"
RemainAfterExit=yes
ExecStop=/usr/sbin/usbip detach --remote=usb1.pavkamlc.cz --busid=%i
Restart=on-failure
 
[Install]
WantedBy=multi-user.target

systemctl enable usbip-client@2-2 –now

https://github.com/furbrain/systemd-usbip/tree/master