Nested virtualization and the network issue.

Nested virtualization [1] is a nice feature where it’s able to run a virtual machine within another. KVM [2] has support to nested virtualization [3] since 2010 (if I’m not wrong) and you can use it to test virtualization features and/or aspects in a different Linux distribution, or even Windows system. I use this sometimes when I need test some Kimchi [4] patch I’m working in different distros to make sure the solution will work.

However, when you start up a VM using NAT configuration on top of the main hosts system (let’s call them VM-master and host-master) the network interface of the VM will get an IP in the range of and 192.168.254. This is the default configuration of libvirt+qemu on the most of the distros and when you start up a nested VM (let’s call VM-guest) it will start with the same configuration (because of the default configuration on VM-master) and you will not able to connect getting this error:

 libvirt: error : internal error: Network is already in use by interface eth0

The solution is quite simple. You only need edit the /etc/libvirt/qemu/networks/default.xml file on the VM-master and change the IP configuration that the VM-guest will work on:

$ sudo vi/etc/libvirt/qemu/networks/default.xml


$ sudo systemctl restart libvirtd.service

After this, start up your VM-guest and you will be able to connect now.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s