KVM (Kernel Based Virtual Machine) – http://www.linux-kvm.org/ , is one of the best choice to do virtualization under linux, and especially without extra licensing cost.
Install KVM
To install KVM on redhat enterprise linux:
– Install the machine with 64 bit version of EL5
– Register the machine with redhat (rhn_register)
– enable virtualization entitlement for the system in RHN
– Install KVM package:
# yum install kvm
# yum install virt-manager libvirt libvirt-python python-virtinst
Migration VMware virtual machines to KVM:
– Login to the vmware server
– make single vmdk image with vmware-diskmanager
eg:
# vmware-vdiskmanager -r path_to_vmware_virtualmachine.vmdk -t 0 destination_file_vmware.vmdk
Creating disk ‘destination_file_vmware.vmdk’
Convert: 100% done.
Virtual disk conversion successful.
– Copy the image to KVM server
– Convert the image to KVM supported format with qemu-img
# qemu-img convert destination_file_vmware.vmdk -O qcow2 kvm_supported.img
Create bridge interface to to share the network card.
* This section assumes that you have two nic in your server and would need to have bonding along with bridging and you have static ip required for virtual machines. incase you using dhcp and single network interface create the bridge interface accordingly.
– Create bridge interface:
$ cat /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
ONBOOT=yes
TYPE=Bridge
IPADDR=11.11.11.11
NETMASK=255.0.0.0
GATEWAY=1.1.1.1
– Configure the bond interface:
$ cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
BRIDGE=br0
ONBOOT=yes
– Configure eth0 and eth1
$ cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
MASTER=bond0
SLAVE=yes
ONBOOT=yes
– Change bonding to active-backup , i have faced some issues with xor – might be silly to fix
# cat /etc/modprobe.conf
options bond0 miimon=100 mode=active-backup
– Restart network interface and check the bridge status
# brctl show
, it will show bond0 as an enabled interface.
Create KVM virtual machine:
– it can be done from the command line or with virt-manager
– open virt-manager application
– click create new, and select qemu hypervisor
– during disk selection, choose the converted vmware image path
– done, just start it.
Register the virtual machine with Redhat, save some license ;)
– enabled network tools entitlement in RHN
– install the package rhn-virtualization-host on the core machine
– # yum install rhn-virtualization-host
– enable virtualization under the properties of host in RHN
– execute the following commands on host machine
# rhn_check
# rhn-profile-sync
– login to virtual machine and use rhn_register, now it will be registered as a virtual machine under the core license.
./arun
5 replies on “Virtualization with KVM under Redhat Linux, Migrate VMware virtual images to KVM”
[…] This post was mentioned on Twitter by Fynali Iladijas, Arun Natarajan S. Arun Natarajan S said: Virtualization with KVM under Redhat Linux, Migrate VMware virtual images to KVM: KVM (Kernel Based Virtual Machin… http://bit.ly/9RE7OP […]
Hi Arun,
Thanks for nice explanation. Does it also apply to VMWare guest images of Windows XP (x86) on Windows-7 (x64) host installation? Whats the purpose of the bonding? Under single NIC can one use NAT instead of bridging?
Thanks,
Yogesh
Hi Yogesh,
Yes you can convert the vmware images(VMDK) from a windows host as well, Bonding is used if you have multiple network interfaces doing failover/loadbalancing etc. It will simply work with bridging or nating on a single interface. Instead of creating bridge with bond interface, do it with the physical interface (like eth0 or eth1).
$ cat /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
ONBOOT=yes
TYPE=Bridge
IPADDR=11.11.11.11
NETMASK=255.0.0.0
GATEWAY=1.1.1.1
– Configure the physical interface:
$ cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BRIDGE=br0
ONBOOT=yes
./arun
Hi Arun,
I have a doubt regarding virtualisation.can i use VMware and KVM in a single host? will it work without any problems?
Thanks,
Surya
Not sure, might work. try with vmware player/server and KVM on a 64 bit OS with full virtualization. But might have reliability issues, not recommended for production use. Can you please let me know the hardware specification?
In my opinion it is not a good idea to run both in the same machine. You could convert the vmware images to raw format and use it with KVM, or the other way around.
./arun