box.matto.nl

home/

KVM and VDE

Last edited

KVM runs virtual machines on your Linux box

KVM (Kernel-based Virtual Machine) is a full virtualization solution. It consists of some kernel-modules and a modified qemu. It is very easy to get a virtual machine up and running with kvm.

VDE creates a simple virtual network for your virtual machines

VDE (Virtual Distributed Ethernet) is used to connect one or several virtual machines or Linux boxes (or both). It is very easy to get your virtual machines online with vde.

I use kvm vde to set up several virtual machines on my laptop and let them connect both to the outside world as well as to each other.

Using kvm

To run kvm you do have to have a processor capable of virtualisation. If such a processor is on your system, /proc/cpuinfo shows this capability with "vmx" in the flags-line. Check this with the following command:

grep vmx /proc/cpuinfo

If this command shows a lot of flags, then you have the right processor. Otherwise, check if the virtualisation-capability is perhaps disables by the Bios (reboot and enter your bios-menu) or upgrade to a system with virtualisation-capabilities.

On Debian and Ubuntu boxes, kvm can be installed with apt-get install kvm.

Create an imagefile

Virtual machines use an imagefile to mimick a harddisk. This imagefile contains the filesystem on the virtual harddisk. Before you can start a virtual machine and start the installation of an operating system on it, first you have to create an imagefile.

Creating an imagefile is done with the following command:

qemu-img create -f qcow2 slack12.img 3GB

Which creates a 3 Gb image with the name "slack12.img" of the qcow2 format. The created file is very small and will grow when used. You can use any name you like, "slack12.img" is just an example.

Start the virtual machine with a different mac-address

sudo vdeq kvm -net vde -net nic,macaddr=52:54:00:12:34:11 -hda slack121.img -boot c