Search

12.2. Setup

download PDF
Follow these steps to enable, configure, and start using nested virtualization:
  1. Enable: The feature is disabled by default. To enable it, use the following procedure on the L0 host physical machine.
    For Intel:
    1. Check whether nested virtualization is available on your host system.
      $ cat /sys/module/kvm_intel/parameters/nested
      If this command returns Y or 1, the feature is enabled.
      If the command returns 0 or N, use steps ii and iii.
    2. Unload the kvm_intel module:
      # modprobe -r kvm_intel
    3. Activate the nesting feature:
      # modprobe kvm_intel nested=1
    4. The nesting feature is now enabled only until the next reboot of the L0 host. To enable it permanently, add the following line to the /etc/modprobe.d/kvm.conf file:
      options kvm_intel nested=1
    For AMD:
    1. Check whether nested virtualization is available on your system:
      $ cat /sys/module/kvm_amd/parameters/nested
      If this command returns Y or 1, the feature is enabled.
      If the command returns 0 or N, use steps ii and iii.
    2. Unload the kvm_amd module
      # modprobe -r kvm_amd
    3. Activate the nesting feature
      # modprobe kvm_amd nested=1
    4. The nesting feature is now enabled only until the next reboot of the L0 host. To enable it permanently, add the following line to the /etc/modprobe.d/kvm.conf file:
      options kvm_amd nested=1
  2. Configure your L1 virtual machine for nested virtualization using one of the following methods:
    virt-manager
    1. Open the GUI of the intended guest and click the Show Virtual Hardware Details icon.
    2. Select the Processor menu, and in the Configuration section, type host-passthrough in the Model field (do not use the drop-down selection), and click Apply.
    Domain XML
    Add the following line to the domain XML file of the guest:
    <cpu mode='host-passthrough'/>
    If the guest's XML configuration file already contains a <cpu> element, rewrite it.
  3. To start using nested virtualization, install an L2 guest within the L1 guest. To do this, follow the same procedure as when installing the L1 guest - see Chapter 3, Creating a Virtual Machine for more information.
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.