UNRAID直通网卡问题的一种解决方法
创作立场声明:人人为我,我为人人,分享知识是一种快乐。
【写作说明】:疫情期间空闲在家里,正好研究一下如何利用闲置机器。于是看了多篇NAS方面文章,特别是阿文菌和司波图的介绍,基本上做到了保姆级教程,也让我从无到有搞起了第一台NAS。不过,为了实现网卡直通,费了很多力气,最后找到unraid官方论坛,终于解决自己遇到的问题,这里写出来,估计能帮到一些人。
基础知识
阿文菌的这篇文章,或者B站司波图的视频
问题
直通网卡的好处前面已经说过了,但是我就一直报错,错误就是IOMMU没有权限等。这个也是官网论坛虚拟机分支里面高居第一的问题点,https://forums.unraid.net/forum/70-vms/
本人略懂一点英文,从论坛又找到了官网文档:
Help! Failed to set iommu for container: Operation not permitted
If you are getting the above message when trying to assign a graphics device to a VM, it is most likely that your device is in an IOMMU group along with another active/in-use device on your system. Please see this article written by Alex Williamson on IOMMU groups if you wish to better understand this issue and how it impacts you. Under Settings -> VM Manager you will find an option to toggle for PCIe ACS Override, which will forcibly break out each device into it's own IOMMU group (following a reboot of the system). This setting is experimental, so use with caution.
Another possibility here is that your system doesn't support interrupt remapping, which is critical for VFIO and GPU pass through. There is a workaround for this, but you will not be protected against MSI-based interrupt injection attacks by guests (more info about MSI injection attacks through VT-d). If you completely trust your VM guests and the drivers inside them, enabling this workaround should resolve the issue. The alternative is to purchase hardware that offers interrupt remapping support. To enable the workaround, you will need to modify your syslinux.cfg file, adding the bolded bit below:
label unRAID OS
menu default
kernel /bzimage
append vfio_iommu_type1.allow_unsafe_interrupts=1 initrd=/bzroot
具体操作
简而言之,就是在你直通网卡失败的时候,可以试试这个方法:
1、首先点击首页这个按钮
确保这两个参数是如下的,如果不是则需要分别从CPU和主板BIOS方面去满足条件。INTEL系列CPU和芯片组可以在INTEL官网https://ark.intel.com/content/www/cn/zh/ark.html查询。注意,VT-D关乎直通网卡成功与否,必须确保CPU、主板、BIOS三项都开启VT-D功能才行,而大部分CPU只支持VT-X,最好提前查询一下再做。
2、满足上述条件之后,再将Settings/VMSettings里面这两个参数改成如图,注意右边按钮是ADVANCED VIEW
3、修改保存之后,在Main/Flash中应该可以看到类似下图的样子;
3、修改保存之后,在Main/Flash中应该可以看到类似下如如果不是也可以把里面的内容直接修改成这样:
网卡信息在Tools/System Devices查到这个样子:
4、修改保存之后,需要重启系统才能生效,然后就没有报错了。
总结
根据官方论坛和文档的说法,那些直通硬件(网卡、显卡等)报错的原因,多数是因为想要直通的硬件跟不想直通的硬件有捆绑,无法实现直通。而修改虚拟机的两个参数,目的就是解除这种捆绑关系。但是VFIO allow unsafe interrupts这个参数设为Yes可能会导致不安全的系统危害,所以只在有信任的虚拟机上这样设置。
![](https://res.smzdm.com/pc/pc_shequ/dist/img/the-end.png)
msnadsl
校验提示文案
最爱早睡的人
校验提示文案
VELIZ
校验提示文案
CAUMOU秋夜日暮
校验提示文案
灬慕容
校验提示文案
sqlaowu
校验提示文案
值友5865212085
append pcie_acs_override=downstream,multifunction iommu=pt vfio-pci.ids=你的网卡信息 vfio_iommu_type1.allow_unsafe_interrupts=1 initrd=/bzroot
这条代码很关键,思路就是首先让主板和网卡开通iommu功能,再屏蔽网卡,并成功分组。
我按照您的思路和代码,解决了网卡分组问题。配合VFIO-PCI-CFG插件,将华擎H310CM+Intel G5400+BCM 5719 4网口扩展网卡的主机成功直通网卡。
校验提示文案
商陆
校验提示文案
骑士和鱼儿
校验提示文案
苦行僧PD
校验提示文案
商陆
校验提示文案
苦行僧PD
校验提示文案
整多笼奶黄包
校验提示文案
悲秋在钓鱼丶
校验提示文案
悬崖2011
校验提示文案
以己为海
校验提示文案
mu0lang
校验提示文案
骑士和鱼儿
校验提示文案
小玩物
校验提示文案
偏北就是我
校验提示文案
值友9044271333
校验提示文案
一半心思
校验提示文案
法行天下
校验提示文案
凑热闹
校验提示文案
偏北就是我
校验提示文案
小玩物
校验提示文案
CAUMOU秋夜日暮
校验提示文案
值友5865212085
append pcie_acs_override=downstream,multifunction iommu=pt vfio-pci.ids=你的网卡信息 vfio_iommu_type1.allow_unsafe_interrupts=1 initrd=/bzroot
这条代码很关键,思路就是首先让主板和网卡开通iommu功能,再屏蔽网卡,并成功分组。
我按照您的思路和代码,解决了网卡分组问题。配合VFIO-PCI-CFG插件,将华擎H310CM+Intel G5400+BCM 5719 4网口扩展网卡的主机成功直通网卡。
校验提示文案
骑士和鱼儿
校验提示文案
骑士和鱼儿
校验提示文案
mu0lang
校验提示文案
VELIZ
校验提示文案
以己为海
校验提示文案
sqlaowu
校验提示文案
悬崖2011
校验提示文案
悲秋在钓鱼丶
校验提示文案
灬慕容
校验提示文案
整多笼奶黄包
校验提示文案
苦行僧PD
校验提示文案
商陆
校验提示文案