[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-26。"],[[["\u003cp\u003eNested virtualization in Compute Engine allows running virtual machines (VMs) inside other VMs, enabling the creation of custom virtualization environments.\u003c/p\u003e\n"],["\u003cp\u003eCompute Engine uses a security-hardened, KVM-based hypervisor at level 0 (L0), which hosts level 1 (L1) VMs, each capable of running another hypervisor for level 2 (L2) VMs.\u003c/p\u003e\n"],["\u003cp\u003eNested virtualization can be useful for running VMs incompatible with Compute Engine or for testing software on various operating systems without managing numerous Compute Engine images.\u003c/p\u003e\n"],["\u003cp\u003eNested VMs may experience a performance decrease of 10% or more, especially in CPU or input/output-bound workloads, and certain VM types are not compatible.\u003c/p\u003e\n"],["\u003cp\u003eEnabling nested virtualization involves checking constraints, creating an L1 VM with the feature enabled, and then creating the nested L2 VM.\u003c/p\u003e\n"]]],[],null,["Linux\n\n*** ** * ** ***\n\nThis document describes Compute Engine support for nested virtualization.\nNested virtualization lets you run virtual machine (VM) instances inside of\nother VMs so you can create your own virtualization environments. To support\nnested virtualization, Compute Engine adds\n[Intel Virtualization Technology (VT-x)](https://en.wikipedia.org/wiki/X86_virtualization#Intel_virtualization_(VT-x))\ninstructions to VMs, so when you create a VM, the hypervisor that is already on\nthat VM can run additional VMs.\n\nCompute Engine VMs run on a physical host that has [Google's\nsecurity-hardened, KVM-based hypervisor](https://cloud.google.com/blog/products/gcp/7-ways-we-harden-our-kvm-hypervisor-at-google-cloud-security-in-plaintext).\nWith nested virtualization, the physical host and its hypervisor are the level 0\n(L0) environment. The L0 environment can host multiple level 1 (L1) VMs. On each\nL1 VM is another hypervisor, which is used to install the level 2 (L2) VMs.\nFigure 1 shows the relationship between the physical host, the L1 VMs, and the\nL2 VMs:\n[](/static/compute/images/nested-virtualization-diagram.svg) **Figure 1.** L0 physical host with L1 VMs and L2 VMs.\n\nUse cases\n\nScenarios where you might consider using nested virtualization include the\nfollowing:\n\n- You have VMs that you can't run on Compute Engine: For example, you\n might have a disaster recovery solution for an on-premises workload that is\n running on VMs that fail over to Compute Engine VMs. Running\n nested virtualization might save you time that you would use to port\n your VMs to Compute Engine.\n\n- You have a software-validation framework that you use to test and validate new\n versions of a software package on numerous versions of different OSes: Using\n nested virtualization lets you avoid converting and managing a library of\n Compute Engine images.\n\nPerformance considerations\n\nEven with hardware-assisted nested virtualization, nested VMs might experience a\n10% or greater decrease in performance for workloads that are CPU-bound and\npossibly greater than a 10% decrease for workloads that are input/output bound.\n\nRestrictions\n\nL1 VMs have the following restrictions:\n\n- The only hypervisor supported in an L1 VM is Linux KVM; Microsoft Hyper-V\n isn't supported.\n\n- You can't use the following VMs:\n\n - E2 VMs\n\n - [Memory-optimized VMs](/compute/docs/machine-resource#memory-optimized_machine_family_guide)\n\n - VMs powered by [AMD and Arm processors](/compute/docs/cpu-platforms)\n\n For information about the processors supported in each zone, see\n [Available regions and zones](/compute/docs/regions-zones#available).\n\nL2 VMs have the following restrictions:\n\n- For licensed operating systems, you must [bring your own licenses](/compute/docs/nodes/bringing-your-own-licenses).\n\nUsing nested virtualization\n\nTo use nested virtualization, complete the following steps:\n\n1. [Check whether the nested virtualization constraint is\n disabled](/compute/docs/instances/nested-virtualization/managing-constraint)\n\n2. [Create an L1 VM that has nested virtualization\n enabled](/compute/docs/instances/nested-virtualization/enabling)\n\n3. [Create a nested L2\n VM](/compute/docs/instances/nested-virtualization/creating-nested-vms)\n\nIf you run into any issues while creating a VM that has nested virtualization\nenabled or creating nested VMs, see [Troubleshoot nested virtualization](/compute/docs/troubleshooting/troubleshooting-nested-vms)."]]