82576在KVM虚拟机下使用网卡的SRIOV功能直通进虚拟机,减少使用Proxmox VE虚拟网卡的NAT功能,提高网卡性能,降低CPU占用。
一、pve介绍
简单来说:Proxmox VE是一个集成OPENVZ 支持KVM应用的环境。
二、单根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
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
解释一下,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
注意把原来网卡标记一下,否则会乱的
以下是我的网卡界面截图
四、【问题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
推荐本站淘宝优惠价购买喜欢的宝贝:
本文链接:https://hqyman.cn/post/8539.html 非本站原创文章欢迎转载,原创文章需保留本站地址!
打赏微信支付宝扫一扫,打赏作者吧~
休息一下~~