Hyper-v网卡直通

发布于 2024年07月22日

先设备管理器上禁用网卡后再进行以下步骤:

//禁用网卡
Dismount-VmHostAssignableDevice -locationpath "PCIROOT(0)#PCI(1C00)#PCI(0000)" -force
Dismount-VmHostAssignableDevice -locationpath "PCIROOT(0)#PCI(1C05)#PCI(0000)" -force
Dismount-VmHostAssignableDevice -locationpath "PCIROOT(0)#PCI(1C06)#PCI(0000)" -force
Dismount-VmHostAssignableDevice -locationpath "PCIROOT(0)#PCI(1C07)#PCI(0000)" -force
Dismount-VmHostAssignableDevice -locationpath "PCIROOT(0)#PCI(1D00)#PCI(0000)" -force
//分配网卡 直通给虚拟机 
Add-VMAssignableDevice -LocationPath "PCIROOT(0)#PCI(1C00)#PCI(0000)" -VMName ikuai
Add-VMAssignableDevice -LocationPath "PCIROOT(0)#PCI(1C05)#PCI(0000)" -VMName ikuai
Add-VMAssignableDevice -LocationPath "PCIROOT(0)#PCI(1C06)#PCI(0000)" -VMName ikuai
Add-VMAssignableDevice -LocationPath "PCIROOT(0)#PCI(1C07)#PCI(0000)" -VMName ikuai
Add-VMAssignableDevice -LocationPath "PCIROOT(0)#PCI(1D00)#PCI(0000)" -VMName x86//分配网卡 直通给虚拟机 
Add-VMAssignableDevice -LocationPath "PCIROOT(0)#PCI(1C00)#PCI(0000)" -VMName ikuai
Add-VMAssignableDevice -LocationPath "PCIROOT(0)#PCI(1C05)#PCI(0000)" -VMName ikuai
Add-VMAssignableDevice -LocationPath "PCIROOT(0)#PCI(1C06)#PCI(0000)" -VMName ikuai
Add-VMAssignableDevice -LocationPath "PCIROOT(0)#PCI(1C07)#PCI(0000)" -VMName ikuai
Add-VMAssignableDevice -LocationPath "PCIROOT(0)#PCI(1D00)#PCI(0000)" -VMName x86
//将禁用的网卡并将其返回到主机
Mount-VMHostAssignableDevice -LocationPath "PCIROOT(0)#PCI(1D00)#PCI(0000)"//将禁用的网卡并将其返回到主机
Mount-VMHostAssignableDevice -LocationPath "PCIROOT(0)#PCI(1D00)#PCI(0000)"
//网卡地址
PCIROOT(0)#PCI(1C00)#PCI(0000)  //ETH0
PCIROOT(0)#PCI(1C05)#PCI(0000)  //ETH1
PCIROOT(0)#PCI(1C06)#PCI(0000)  //ETH2
PCIROOT(0)#PCI(1C07)#PCI(0000)  //ETH3
PCIROOT(0)#PCI(1D00)#PCI(0000)  //ETH4
PCIROOT(0)#PCI(1D01)#PCI(0000)  //ETH5



评论