Custom Search
Showing posts with label KVM. Show all posts
Showing posts with label KVM. Show all posts

Thursday, October 30, 2014

How to Create KVM Virtual Machine and Attach to OpenvSwitch Bridge

1)
Install OpenvSwitch, Create an OpenvSwitch Bridge and attach eth0/wlan0
http://fosshelp.blogspot.com/2014/10/add-eth0-wlan0-openvswitch-bridge.html





2)
Script for create the interface "tap0" and attach it to OpenvSwitch Bridge "br-int"
#sudo vim /etc/ovs-ifup

#!/bin/sh
switch='br-int'
/sbin/ifconfig $1 0.0.0.0 up
ovs-vsctl add-port ${switch} $1

3)
Script for delete the interface "tap0" and detach it from OpenvSwitch Bridge "br-int"
#vim /etc/ovs-ifdown

#!/bin/sh
switch='br-int'
/sbin/ifconfig $1 0.0.0.0 down
ovs-vsctl del-port ${switch} $1

4)
Create a KVM VM with cirros image and attach to OpenvSwitch Bridge "br-int"
#sudo kvm -m 2048 -net nic,macaddr=00:00:00:00:cc:10 -net tap,script=/etc/ovs-ifup,downscript=/etc/ovs-ifdown cirros-0.3.2-x86_64-disk.img




5)
Login to the cirros VM and set the IP. (Ip of the VM should be in the network of "br-int")
#sudo ifconfig eth0 192.168.0.135 netmask 255.255.255.0






6)
From cirros VM : Check routing table
#route -n

7)
From cirros VM : Ping to "br-int", Should work
#ping 192.168.0.131

8)
From cirros VM : Ping to google, Should not work
#ping ip-of-google

9)
List all POSTROUTING iptables rule
#sudo iptables -t nat -L POSTROUTING -nv

10)
Add  MASQUERADE target rule for OpenvSwitch Bridge "br-int" to make ping to IP of google working
#sudo iptables -t nat -A POSTROUTING -o br-int -j MASQUERADE
 


10)
Ping to IP of Google 




11)
Ping to www.google.com

Login to cirros VM and open /etc/resolve.conf and add
nameserver 8.8.8.8





12)
From Host System : SSH to cirros VM, Should work
#ssh cirros@192.168.0.135




13)
Ref
http://networkstatic.net/openflow-openvswitch-lab/

Monday, June 23, 2014

Qemu KVM How To Open VM console










Puppet KVM internal error Process exited while reading console log output: char device redirected to /dev/pts/0 Could not access KVM kernel module: No such file or directory

 
Error
======= 
2014-06-23 11:40:29.020+0000: 1117: error : qemuProcessReadLogOutput:1062 : internal error Process exited while reading console log output: char device redirected to /dev/pts/0
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
No accelerator found!
 
Fix
=====
 
 










 
 
 

Puppet KVM internal error Process exited while reading console log output: Supported machines are

Puppet kvm Error
------------ 
2014-06-23 11:16:47.745+0000: 1116: error : qemuProcessReadLogOutput:1062 : 
internal error Process exited while reading console log output: Supported machines are:
pc         Standard PC (alias of pc-1.0)
pc-1.0     Standard PC (default)
pc-0.14    Standard PC
pc-0.13    Standard PC
pc-0.12    Standard PC
pc-0.11    Standard PC, qemu 0.11
pc-0.10    Standard PC, qemu 0.10
isapc      ISA-only PC
 
Fix
===== 
 
 


 

Wednesday, June 19, 2013

How to Import KVM Virtual Machine to Amazon EC2

How to Import KVM Virtual Machine to Amazon EC2

1)
Install ec2-api-tools_1.6
#wget http://launchpadlibrarian.net/111617788/ec2-api-tools_1.6.1.1-0ubuntu1_all.deb
#sudo dpkg -i ec2-api-tools_1.6.1.1-0ubuntu1_all.deb

2)
Check the Version of ec2-api-tools
#ec2-version
 3)
Export Aws Access and Secret keys
#export AWS_ACCESS_KEY=XXXXXXXXXXXXXXXXXXXXX
#export AWS_SECRET_KEY=XXXXXXXXXXXXXXXXXXXXX

4)
Create EC2 Instance using RAW Disk
#ec2-import-instance win2k-r2-disk1.xm -f RAW -t m1.small -a x86_64 -b import-export -o $AWS_ACCESS_KEY -w $AWS_SECRET_KEY --region us-west-1 -g my_sec_group

5)
Check the Progress of the task
#ec2-describe-conversion-tasks import-i-ffm2nty0 -O $AWS_ACCESS_KEY -W $AWS_SECRET_KEY --region us-west-1

6)
Resume task
#ec2-resume-import win2k-r2-disk1.xm -t import-i-ffm2nty0 -o $AWS_ACCESS_KEY -w $AWS_SECRET_KEY --region us-west-1

7)
Remove the image from S3, when the task completed
#ec2-delete-disk-image -t import-i-ffm2nty0 -o $AWS_ACCESS_KEY -w $AWS_SECRET_KEY --region us-west-1

Friday, February 22, 2013

KVM How to Install Configure and Create Virtual Machine on Ubuntu

1)
Check whether CPU has hardware virtualization support.


KVM only works if your CPU has hardware virtualization support –
either Intel VT-x or AMD-V. To determine whether your CPU includes these features,
run the following command:

#sudo grep -c "svm\|vmx" /proc/cpuinfo

A 0 indicates that your CPU doesn’t support hardware virtualization,
while a 1 or more indicates that it does.


2)
Install KVM and supporting packages.


Virt-Manager is a graphical application for managing your virtual machines —
you can use the kvm command directly, but libvirt and Virt-Manager simplify the process.

#sudo apt-get install qemu-kvm libvirt-bin bridge-utils virt-manager


3)
Create User.


Only the root user and users in the libvirtd group have permission to use KVM virtual machines.
Run the following command to add your user account to the libvirtd group:

#sudo adduser saju 
#sudo adduser saju libvirtd

After running this command, log out and log back in as saju

4)
Check whether everything is working correctly.


Run following command after logging back in as saju and you should see an empty list of virtual machines.
This indicates that everything is working correctly.

#virsh -c qemu:///system list

5)
Open Virtual Machine Manager application and Create Virtual Machine


#virt-manager

http://virt-tools.org/
http://virt-manager.org/