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

转自:https://blog.8086k.cn/archives/71/

82576在KVM虚拟机下使用网卡的SRIOV功能直通进虚拟机,减少使用Proxmox VE虚拟网卡的NAT功能,提高网卡性能,降低CPU占用。
哔哩哔哩链接:文字不带劲,来视频
一、pve介绍

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

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

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

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

Proxmox VE 5.4
CPU:E5645*2
网卡:intel 82576

3.1 软件安装
安装基本的软件

root@pve:~# apt update
root@pve:~# apt-get install net-tools vim ethtool -y

3.2 打开IOMMU

在/etc/default/grub文件里,GRUB_CMDLINE_LINUX_DEFAULT行添加以下内容
那么使用vim打开文件,添加
如果你是intel CPU。

GRUB_CMDLINE_LINUX_DEFAULT=" intel_iommu=on pcie_acs_override=downstream"

如果你是AMD CPU,那么添加一下内容:

GRUB_CMDLINE_LINUX_DEFAULT="  amd_iommu=on pcie_acs_override=downstream"

更新grub

root@pve:~# update-grub

在/etc/modules文件里添加如下内容:
使用vim打开/etc/modules,添加一下内容:

 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

如果出现一下内容,就代表IOMMO功能开启成功。
如果没有出现,那么在/etc/modprobe.d/的任意一个.conf下增加这些内容:

options vfio_iommu_type1 allow_unsafe_interrupts=1

3.3 部署SRIOV

首先确定你的intel网卡支持SR-IOV,如果支持,那么继续

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

解释一下,max_vfs=6,6,6,6,6,6:
1.1 这条语句说明最大的虚拟网卡是6个,也就是虚拟6个

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

出现VF代表成功了,那么在你的Proxmox VE 控制面板上,网络一栏就会出现很多网卡

注意把原来网卡标记一下,否则会乱的

以下是我的网卡界面截图

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

windows下网卡提前必须是up状态【重点】

就像这样:

windows注意事项

首先在intel官方下载intel驱动【找到自己的型号】
intel网卡驱动下载传送门
输入如下指令:

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文件【支持最新的6.2.2】

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

参考网址:https://xpenology.com
文章名: 《Proxmox VE(PVE)开启IOMMO并开启网卡(82576)SRIOV功能【时隔半年,我回来了】》

文章链接:https://blog.8086k.cn/archives/71/

联系方式:[email protected]

除特别注明外,文章均为飞羽小随笔原创,转载时请注明本文出处及文章链接

你可能感兴趣的:(pve,pve)