r4 - 04 Mar 2007 - 23:42:08 - Main.ppadalaYou are here: TWiki >  Main Web > RtclHowtos > KvmSetup

Setting up KVM

This howto details the steps required for setting up KVM on HP blades running OpenSuse? 10.2

  1. Enable KVM in bios. When the blade booting, press F9 for bios options, and enable KVM in Advanced ---> Processor Options
  2. Add http://software.opensuse.org/download/home:/kraxel/openSUSE_10.2 to yast software repositories
  3. Install kvm, kvm-kmp-default packages
  4. Insert the kvm modules
       
    # modprobe kvm
    # modprobe kvm-amd   
       
  5. Install the OS of your choice. I will outline the steps required for installing Fedora Core 6.
    • Download the boot disc of FC6
    • Create a hard disk image to host the VM
      # qemu-img create -f qcow fc6.img 10G
              
    • Install OS. Use linux askmethod to access the install media options.
      # qemu-kvm -hda fc6.img -cdrom /path/to/boot-media.iso -boot d  -m 1024
              
  6. Run the image with
    # qemu-kvm -hda ./fc6.img -boot c -m 1024
       

Setting up TUN/TAP device to avoid using qemu user-mode network stack setup.

  • Setup a TUN/TAP device on the host machine. Install uml-utilities, if required
    # modprobe tun
    # tunctl
    # ifconfig tap0 192.168.100.1
             
  • This creates a TAP device with ip address 192.168.100.1
  • Setup iptables on the host to forward the packets from VM
    # echo "1" > /proc/sys/net/ipv4/ip_forward
    # iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
            

Setup bridging

Briding is the most advanced way of setting up networking for QEMU based VMs. If you want to assign an IP address visible in the host network to the VM, briding is required.
  • Add a bridge and add eth1 to it. You need to have console access to do this, as the network connection will be severed temporarily before the bridge comes up.
    brctl addbr br0 
    ifconfig eth1 0.0.0.0 promisc up
    brctl addif br0 eth1
        
  • Setup a qemu-ifup script to attach the tap0 device to the bridge
    switch = $(ip route list | awk '/^default / {print $NF}')
    ifconfig $1 0.0.0.0 promisc up
    brctl addif $switch $1
         
  • Add/modify the following config variable in /etc/sysconfig/SuSEfirewall2 to allow the VMs to access the network
    FW_FORWARD_ALWAYS_INOUT_DEV = "br0"
         

Resources

This HOWTO is written after consulting many documents on the web. -- Main.ppadala - 03 Mar 2007
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r4 < r3 < r2 < r1 | More topic actions

tip TWiki Tip of the Day
Re-parenting a topic
The breadcrumb displayed with a particular TWiki topic is constructed with a topic's Parent . On the ... Read on Read more

 
Home
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback