Enable Windows Server 2016 & Windows 10 Nested Virtualization (啟用巢狀虛擬化)

Windows Server 2016 才開始支援 Nested Virtualization,也就是支援在虛擬機器(Guest OS)中還可以再跑虛擬機器

注意事項:
1.此VM必需關掉動態記憶體(Dynamic Memory)
2.此VM必需設定至少2顆虛擬CPU(vCPU)
3.此VM的網路介面卡,必需將「啟用MAC位址變更(MAC address Spoofing)」打勾啟用
4.此VM的ExposeVirtualizationExtensions參數設應true
5.要在VM中再跑VM,記得將記憶體調大一點

可先使用Get-VMProcessor -VMName "VM1" | FL *,查詢特定VM是否有啟用Nested Virtualization功能(ExposeVirtualizationExtensions)

實際操作方式:
(1)先關閉要啟用Nested Virtualization的VM
(2)Set-VMProcessor -VMName "VM1" -ExposeVirtualizationExtensions $true
(3)Set-VMNetworkAdapter -VMName "VM1"-MacAddressSpoofing on
或是
使用人家已經寫好的ps,Enable-NestedVm.ps1會幫你把VM關掉、ExposeVirtualizationExtensions設為true、啟用MacAddressSpoofing,並且如果記憶體設定少於4GB時,會幫您把記憶體設為4GB
(1)Invoke-WebRequest https://raw.githubusercontent.com/Microsoft/Virtualization-Documentation/master/hyperv-tools/Nested/Enable-NestedVm.ps1 -OutFile ~/Enable-NestedVm.ps1
(2)~/Enable-NestedVm.ps1 -VmName "VM1"

PS: 如果虛擬機器的名稱中有特殊字元如:[],需要以[]將特殊字元包起來,如虛擬機器名字為[10]Moodle(2016),則參數要改成-VMName "[[]10[]]Moodle(2016)"
Reference: https://social.technet.microsoft.com/Forums/sharepoint/en-US/c020831d-35ac-433e-a99c-ec946d55b46d/vm-with-special-character?forum=winserverhyperv

發佈留言