栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

USB redirection

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

USB redirection

前言

物理上插在某A机器上,需要在某B系统中使用,而这个B系统,运行在某台服务器C的虚拟化环境中。

A:192.168.131.102 (USB在此物理机)
B:192.168.131.101上起的虚拟机 centos
C:192.168.131.101

A配置

使用kvm管理工具 virt-manager 的过程中,通过USB passthrough,映射本地usb设备。意外发现有usb重定向选项。

usb重定向的类型选择中,除了Spice通道,还有TCP的方式,可以填写host和port。

yum install dnf

dnf install usbredir-server -y

yum install usbutils

查看usb

yum install usbutils

Bus 002 Device 006: ID 0930:6545 Toshiba Corp. Kingston DataTraveler 102/2.0 / HEMA Flash Drive 2 GB / PNY Attache 4GB Stick
Bus 002 Device 002: ID 8087:8002 Intel Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 004: ID 046b:ff10 American Megatrends, Inc. Virtual Keyboard and Mouse
Bus 001 Device 003: ID 046b:ff01 American Megatrends, Inc.
Bus 001 Device 002: ID 8087:800a Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub


选择usb的ip号
usbredirserver -p 8686 -v 3 0930:6545
端口可以自定义。

verbosity level(-v)级别从0-5,0:Silent 1:Errors 2:Warnings 3:Info 4:Debug 5:Debug++。

这将把对应的usb设备映射到网上。可以通过 netstat 命令检查,新开一个终端

yum install net-tools

usbredirserver -p 8686 -v 3 0930:6545

通过netstat -altunp检查

netstat -altunp | grep usbredirserve
tcp6       0      0 :::8686                 :::*                    LISTEN      48338/usbredirserve

B配置

先创建虚拟机,编写xml文件:


  centostest
  be26b846-42a1-455c-9c96-2ce7ad2a220f
  208896
  208896
  2
  
    hvm
    
    
  
  
    
    
    
  
  
  destroy
  restart
  restart
  
    /usr/libexec/qemu-kvm
    
      
      
      
      

创建

virsh define centostest.xml
Domain centostest defined from centostest.xml

virsh start centOS
Domain centOS started

修改xml文件,加入


  
  
  

重启动虚拟机即可

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/828354.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号