安装 hypyer-v
# powershell
Add-WindowsFeature Hyper-V,Hyper-V-Tools,Hyper-V-PowerShell -IncludeManagementTools
Restart-Computer -Force
创建虚拟机及虚拟交换机过程略
PCIE 直通虚拟机
参考 https://www.licc.tech/article?id=35
先禁用相关 PCIE 设备
复制 PCIE 路径信息, 如下图则是PCIROOT(0)#PCI(1C04)#PCI(0000)
然后 powershell 运行(需替换 PCIE 设备路径及虚拟机名称)
# 设置虚拟机关机时自动关机
Set-VM -Name openwrt -AutomaticStopAction TurnOff
# 从主机断开 PCI 设备
Dismount-VMHostAssignableDevice -LocationPath "PCIROOT(0)#PCI(1C04)#PCI(0000)" -Force
# 将 PCI 设备分配给虚拟机 openwrt
Add-VMAssignableDevice -LocationPath "PCIROOT(0)#PCI(1C04)#PCI(0000)" -VMName "openwrt"
# 查看是否挂载成功
Get-VMAssignableDevice -VMName openwrt
如果要挂载回 host
Remove-VMAssignableDevice -LocationPath "PCIROOT(0)#PCI(1C04)#PCI(0000)" -VMName "openwrt"
Mount-VMHostAssignableDevice -LocationPath "PCIROOT(0)#PCI(1C04)#PCI(0000)"
正文完