飞羽小随笔

Proxmox VE(PVE)开启IOMMO并开启网卡(82576)SRIOV功能【时隔半年,我回来了】

82576在KVM虚拟机下使用网卡的SRIOV功能直通进虚拟机,减少使用Proxmox VE虚拟网卡的NAT功能,提高网卡性能,降低CPU占用。

哔哩哔哩链接:文字不带劲,来视频

一、pve介绍

简单来说:Proxmox VE是一个集成OPENVZ 支持KVM应用的环境。

二、单根I/O虚拟化(SRIOV)介绍

[collapse title="单根I/O虚拟化(SRIOV)介绍" status="false"]
I/O虚拟化可以提高服务器性能和简化硬件要求,而且同时可以在服务器上增加I/O密集型虚拟机的最大数量。
SR-IOV技术现已可以开始把具有SR-IOV功能的设备定义成为一种外围设备物理功能模块(PF)并且使之能与主机hypervisor系统直接相互交互信息。PF主要用于在服务器中告诉hypervisor系统关于物理PCI设备运行的状态是否可用。
  SR-IOV在操作系统层,现在能在所有的外围物理设备PF下,创建不只一个的虚拟功能设备(VFs)。VFs能共享外围设备的物理资源(像网卡端口或网卡缓存空间)并且与SR-IOV服务器上的虚拟机系统进行关联。SR-IOV能允许一个物理PCIe设备把自身虚拟为多个虚拟PCIe设备。
[/collapse]

三、基础环境以及软件安装

3.1 软件安装

安装基本的软件
root@pve:~# apt update
root@pve:~# apt-get install net-tools vim ethtool -y\

3.2 打开IOMMU

GRUB_CMDLINE_LINUX_DEFAULT=" intel_iommu=on pcie_acs_override=downstream"
GRUB_CMDLINE_LINUX_DEFAULT="  amd_iommu=on pcie_acs_override=downstream"
root@pve:~# update-grub
 vfio
 vfio_iommu_type1
 vfio_pci
 vfio_virqfd
root@pve:~# update-initramfs -u -k all
root@pve:~# reboot

3.3 检查IOMMO功能是否开启

root@pve:~# dmesg | grep -e DMAR -e IOMMU -e AMD-Vi
[    1.140539] DMAR: Host address width 40
[    1.140626] DMAR: DRHD base: 0x000000fbffe000 flags: 0x1
[    1.140740] DMAR: dmar0: reg_base_addr fbffe000 ver 1:0 cap c90780106f0462 ecap f020f6
[    1.140865] DMAR: RMRR base: 0x000000000ed000 end: 0x000000000effff
[    1.140959] DMAR: RMRR base: 0x000000bf7ed000 end: 0x000000bf7fffff
[    1.141053] DMAR: ATSR flags: 0x0
[    1.141445] DMAR: dmar0: Using Queued invalidation
[    1.141552] DMAR: Setting RMRR:
[    1.141911] DMAR: Setting identity map for device 0000:00:1a.0 [0xbf7ed000 - 0xbf7fffff]
[    1.142336] DMAR: Setting identity map for device 0000:00:1a.7 [0xbf7ed000 - 0xbf7fffff]
[    1.142711] DMAR: Setting identity map for device 0000:00:1d.0 [0xbf7ed000 - 0xbf7fffff]
[    1.143088] DMAR: Setting identity map for device 0000:00:1d.1 [0xbf7ed000 - 0xbf7fffff]
[    1.144741] DMAR: Setting identity map for device 0000:00:1d.2 [0xbf7ed000 - 0xbf7fffff]
[    1.145156] DMAR: Setting identity map for device 0000:00:1d.7 [0xbf7ed000 - 0xbf7fffff]
[    1.145301] DMAR: Setting identity map for device 0000:00:1a.0 [0xed000 - 0xeffff]
[    1.145438] DMAR: Setting identity map for device 0000:00:1a.7 [0xed000 - 0xeffff]
[    1.145574] DMAR: Setting identity map for device 0000:00:1d.0 [0xed000 - 0xeffff]
[    1.145710] DMAR: Setting identity map for device 0000:00:1d.1 [0xed000 - 0xeffff]
[    1.145846] DMAR: Setting identity map for device 0000:00:1d.2 [0xed000 - 0xeffff]
[    1.145982] DMAR: Setting identity map for device 0000:00:1d.7 [0xed000 - 0xeffff]
[    1.146120] DMAR: Prepare 0-16MiB unity mapping for LPC
[    1.146460] DMAR: Setting identity map for device 0000:00:1f.0 [0x0 - 0xffffff]
[    1.146781] DMAR: Intel(R) Virtualization Technology for Directed I/O
 options vfio_iommu_type1 allow_unsafe_interrupts=1

3.3 部署SRIOV

root@pve:~# echo "options igb max_vfs=6,6,6,6,6,6" > /etc/modprobe.d/igb.conf
root@pve:~# depmod -a
root@pve:~# update-initramfs -u
root@pve:~# reboot

1.2 6,6···说明我这里有6个intel 82576网卡,每个网卡虚拟出6个,总共是36个虚拟网卡

3.4 检查虚拟网卡

root@pve:~# dmesg | grep 82576
[    2.527369] igbvf 0000:07:10.1: Intel(R) 82576 Virtual Function
[    2.532109] igbvf 0000:07:10.3: Intel(R) 82576 Virtual Function
[    2.535583] igbvf 0000:07:10.5: Intel(R) 82576 Virtual Function
[    2.539074] igbvf 0000:07:10.7: Intel(R) 82576 Virtual Function
[    2.542565] igbvf 0000:07:11.1: Intel(R) 82576 Virtual Function
[    2.546055] igbvf 0000:07:11.3: Intel(R) 82576 Virtual Function
[    2.768637] igbvf 0000:07:10.0: Intel(R) 82576 Virtual Function
[    2.771872] igbvf 0000:07:10.2: Intel(R) 82576 Virtual Function
[    2.775080] igbvf 0000:07:10.4: Intel(R) 82576 Virtual Function
[    2.778273] igbvf 0000:07:10.6: Intel(R) 82576 Virtual Function
[    2.781481] igbvf 0000:07:11.0: Intel(R) 82576 Virtual Function
[    2.784682] igbvf 0000:07:11.2: Intel(R) 82576 Virtual Function
[    2.920650] igbvf 0000:05:10.0: Intel(R) 82576 Virtual Function
[    3.128489] igbvf 0000:05:10.2: Intel(R) 82576 Virtual Function
[    3.412422] igbvf 0000:05:10.4: Intel(R) 82576 Virtual Function
[    3.540328] igbvf 0000:05:10.6: Intel(R) 82576 Virtual Function
[    3.580426] igbvf 0000:05:11.0: Intel(R) 82576 Virtual Function
[    3.608433] igbvf 0000:05:11.2: Intel(R) 82576 Virtual Function
[    3.940652] igbvf 0000:05:10.1: Intel(R) 82576 Virtual Function
[    3.960418] igbvf 0000:05:10.3: Intel(R) 82576 Virtual Function
[    3.976422] igbvf 0000:05:10.5: Intel(R) 82576 Virtual Function
[    3.992427] igbvf 0000:05:10.7: Intel(R) 82576 Virtual Function
[    4.008435] igbvf 0000:05:11.1: Intel(R) 82576 Virtual Function
[    4.024426] igbvf 0000:05:11.3: Intel(R) 82576 Virtual Function
[    4.359456] igbvf 0000:04:10.0: Intel(R) 82576 Virtual Function
[    4.380383] igbvf 0000:04:10.2: Intel(R) 82576 Virtual Function
[    4.400395] igbvf 0000:04:10.4: Intel(R) 82576 Virtual Function
[    4.424404] igbvf 0000:04:10.6: Intel(R) 82576 Virtual Function
[    4.440398] igbvf 0000:04:11.0: Intel(R) 82576 Virtual Function
[    4.464396] igbvf 0000:04:11.2: Intel(R) 82576 Virtual Function
[    4.795365] igbvf 0000:04:10.1: Intel(R) 82576 Virtual Function
[    4.820409] igbvf 0000:04:10.3: Intel(R) 82576 Virtual Function
[    4.836453] igbvf 0000:04:10.5: Intel(R) 82576 Virtual Function
[    4.856446] igbvf 0000:04:10.7: Intel(R) 82576 Virtual Function
[    4.872448] igbvf 0000:04:11.1: Intel(R) 82576 Virtual Function
[    4.888444] igbvf 0000:04:11.3: Intel(R) 82576 Virtual Function

[scode type="blue"]注意把原来网卡标记一下,否则会乱的[/scode]

以下是我的网卡界面截图

四、【问题1】网卡直通windows不识别怎么办

就像这样:

pnputil -a PRO1000\Winx64\NDIS62\v1q62x64.inf

参考网址:https://peterkieser.com/2014/07/22/intel-e1g42et-82576-controller-sr-iov-with-windows-2008-r2-guest/

五、【问题2】解决群晖不支持驱动问题

boot文件下载地址:
链接:https://pan.baidu.com/s/1vfeznXGAwvfedskn73vL5Q 提取码:cqjt 复制这段内容后打开百度网盘手机App,操作更方便哦

参考网址:https://xpenology.com


当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »