Skip to content

Recentste berichten

  • After 13 and a bit it’s time for 13!
  • Na 13 en een beetje, komt 13?
  • Dining-out!
  • Lekker eten
  • Special night

Most Used Categories

  • Algemeen (190)
  • Algemeen @en (106)
  • Werk (83)
  • Lekker (eten en drinken) (55)
    • Recepten (8)
  • Motor (36)
  • Trouwen (27)
  • Fiets (25)
Skip to content

tom.scholten.nu

Tom's personal log

Subscribe
  • About me
  • Archief
    • CMS Framework
    • Postfix LDAP Howto
      • Postfix LDAP Howto
      • Postfix LDAP Howto v2.0 part two
    • Scroller.txt
  • Archive
  • aXBo – Testing
  • Cookie Policy
  • iPad
  • iPad
  • iPhone
    • iPhone (1.0)
      • Modem/proxy usage
    • iPhone (2.0)
  • iPhone
  • LoBySS
  • LoBySS
  • Music
  • Muziek
    • Never ending story (Limahl)
    • SnoWMusic
    • The Load out / Stay (just a little bit longer)
  • OSX Tools and Stuff
  • OSX Tools and Stuff
  • Over mij
  • Postfix LDAP Howto v2.1
  • Postfix LDAP Howto v2.1
  • Postfix MySQL howto v1.0
  • Recipes
  • Speedtouch SIP spoof (716)
  • WPG2
  • Wiki
  • Home
  • 2011
  • februari
  • 21
  • Over to KVM

Over to KVM

Tom21 februari 201121 februari 2011

3270This weekend, after an earlier failed attempt, I’ve managed to change one of the servers to KVM as virtual machines platform. The first server is done and many will follow. Besides stability my main focus was manageability, the old platform ran (or runs, as not all are transferred yet) on VMware Server. A nice free product but only manageable from Windows as a platform and even on there it became worse every month. KVM ensures management using VNC, command-line or even webinterfaces and with that is more platform independent.
Besides that KVM offers the ability to better virtualisation per virtual machine and is also more lightweight in use. The only issue I’ve encountered so far is a test-windows7 install which proved not to work on KVM. It did on qemu but locked out one processor on 100% use and even that wouldn’t give a workable/performing virtual machine. Testing an XP one did work, w2k8 still to be determined. At least the FreeBSD’s and Linux hosts work more than fine – but those are obviously the production ones. Windows was fine for testing, but we’ll leave it at that 🙂

Below more information on my transition, despite being documented all over the internet I’ve had to visit multiple sites to properly deploy and migrate. Even though there are various small things not working (described below) but at least KVM runs and the virtual machines are running very fine and without any issues.

Setup

  • Hetzner EQ host (8 GB RAM, 8 Core)
  • Debian
  • KVM (libvirt, qemu)

Linux host
* Install the required packages
aptitude install kvm libvirt-bin virt-manager qemu uml-utilities vncserver
* Configure the networks (I’m not using the ‘default’ shared network) in /etc/network/interfaces
* Note that whatever you currently have on ‘eth0’ should be moved to ‘br0’ – I’ve also included some of the other Hetzner specific example lines!
# device: eth0 (physical Hetzner interface)
auto eth0
iface eth0 inet manual

# Bridged eth0
auto br0
iface br0 inet static
address 1.2.3.4
netmask 255.255.255.0
gateway 1.2.3.127

# iptables
pre-up iptables-restore < /etc/iptables.rules

# default route to access subnet (hetzner)
up route add -net 1.2.3.0 netmask 255.255.255.0 gw 1.2.3.4 br0

# Virtual subnet hosts routing
up ip addr add 5.6.7.8/255.255.255.240 dev br0

bridge_ports eth0
bridge_stp off
bridge_fd 0
bridge_maxwait 0

# device: tap0 (virtual / virtual host-only interface)
auto tap0
iface tap0 inet static
address 192.168.10.1
netmask 255.255.255.0
tunctl_user uml-net

# Bridged tap0
auto br1
iface br1 inet static
address 192.168.10.1
netmask 255.255.255.0

bridge_ports tap0
bridge_stp off
bridge_fd 2.5

* Restart your network (/etc/init.d/networking restart)
* Also make sure that your IP-forwarding is into place (/etc/sysctl.conf /etc/sysctl.d/* – google for sysctl and forwarding)
* Ensure your KVM modules are loaded (lsmod)

For the real part you have to decide which way to go. As Richard (Mosibi’s blog) pointed out you can use vmware2libvirt for this but somehow this wouldn’t go right on Debian. Also I wasn’t too keen on just transferring everything over. I ended up configuring everything using VNC (server) and virt-manager.

Per virtual machine migration steps
* Source: /vms/old.machine.dir
* Target: /kvms/machine.dir
* Install ISO’s: /vms/iso
* First I migrated my old virtual disks, mind that I had VMware ‘split’ into 2 GB chunks, if this isn’t your setup skip the vmware-vdiskmanager command
cd /vms/old.machine.dir
vmware-vdiskmanager -r old.machine.vmdk -t 0 /kvms/machine.dir/old.machine.vmdk
cd /kvms/machine.dir
kvm-img convert old.machine.vmdk -O qcow2 machine.qcow2

* With the new disk in place I created a new virtual machine using virt-manager (start VNCserver, export your display, start virt-manager, connect to the VNC server)
* When asked I configured the server as you would normally do

  • Architecture x86_64 / hvm / kvm
  • Select to correct OS type (obviously)
  • Use the source ISO as boot device (see hint on FreeBSD machines below)
  • Configure a single network interface (the bridge one, using the ‘default’ network adapter broke libvirt on my machine)
  • Complete the other questions

* As soon as the machine started I immediately aborted for the non-FreeBSD systems. For the FreeBSD systems I dove into the install ISO and used ‘Fixit’ to mount my disks (from VMware /dev/da to KVM /dev/ad (as VMware uses SCSI and KVM uses IDE) in /etc/fstab. Also on FreeBSD you might want to change (while in fixit) the /etc/rc.conf and /etc/pf.conf (for instance) on the network device name. I went with the ne2k_pci driver so changed all my ’em’ devices to ‘ed’ ones!
* After stopping the virtual machine KVM will switch automatically from CD-boot to HD-boot which is good, but now that it is stopped we can change a few values.
* From the commandline run ‘virsh edit machine.dir’ and add both bridges (to your liking). You can also change the mac-addresses of them or edit your virtual machine (bios) UUID which might come in handy when installing various OS 🙂
* Example for Linux machine (for FreeBSD replace model type with ne2k_pci, for Windows use rtl8139 or virtio after installing virtio drivers)
<interface type='bridge'>
<mac address='00:01:23:45:67:8a'/>
<source bridge='br0'/>
<model type='virtio'/>
</interface>
<interface type='bridge'>
<mac address='00:01:23:45:67:8a'/>
<source bridge='br1'/>
<model type='virtio'/>
</interface>

* Now you can run your server, either using the buttons in virt-manager or by using ‘virsh start machine.dir’

Post navigation

Previous: Over naar KVM
Next: Uitdagingen en ontspanning

Related Posts

After 13 and a bit it’s time for 13!

31 december 201231 december 2012 Tom

Dining-out!

21 december 201231 december 2012 Tom

Special night

20 december 201231 december 2012 Tom
Copyright All Rights Reserved | Theme: BlockWP by Candid Themes.

Warning: Undefined array key "ltasurl" in /var/www/html/weblog/wp-content/plugins/flash-video-player/flash-video-player.php on line 96

Warning: Trying to access array offset on null in /var/www/html/weblog/wp-content/plugins/flash-video-player/flash-video-player.php on line 96