Difference between revisions of "KVM"

From Linuxintro
imported>ThorstenStaerk
imported>ThorstenStaerk
Line 23: Line 23:
 
Set Network so it is bridged. To check if bridged network is enabled
 
Set Network so it is bridged. To check if bridged network is enabled
 
  brctl show
 
  brctl show
If you only see a bridge e.a. vnet0 with a physical interface e.a. eth0 in it, skip this step. Add the physical interface eth0 to the bridge virbr0.
+
If you only see a bridge e.a. vnet0 with a physical interface e.a. eth0 in it, skip this step. Add the physical interface eth0 to the bridge br0.
  brctl addif virbr0 eth0
+
  brctl addif br0
 +
brctl addif br0 eth0
 
  /etc/init.d/libvirtd restart
 
  /etc/init.d/libvirtd restart
 +
Stop the interface that will be used for bridging:
 +
ifdown eth0
 
Now we have to set the ip address of eth0 to the bridge
 
Now we have to set the ip address of eth0 to the bridge
  cp /etc/sysconfig/network/ifcfg-eth0 /etc/sysconfig/network/ifcfg-virbr0
+
  cp /etc/sysconfig/network/ifcfg-eth0 /etc/sysconfig/network/ifcfg-br0
  vi /etc/sysconfig/network/ifcfg-virbr0
+
  vi /etc/sysconfig/network/ifcfg-br0
  
 
Now change it that the content looks like this
 
Now change it that the content looks like this
Line 40: Line 43:
 
  ONBOOT=yes
 
  ONBOOT=yes
  
Add the following line to /etc/sysconfig/network/ifcfg-eth0 right after DEVICE=eth0 and delete the rest
+
Now change the content of /etc/sysconfig/network/ifcfg-eth0 to:
  
 
  DEVICE=eth0
 
  DEVICE=eth0
Line 48: Line 51:
 
  BRIDGE=br0
 
  BRIDGE=br0
 
  NM_CONTROLLED=no
 
  NM_CONTROLLED=no
 +
 +
Now you delete the entry from the routing table that makes the packages go to eth0:
 +
route del -net 192.168.0.0 netmask 255.255.255.0 eth0
  
 
Reference: http://kbase.redhat.com/faq/docs/DOC-19071
 
Reference: http://kbase.redhat.com/faq/docs/DOC-19071

Revision as of 22:11, 15 March 2010

SUSE 11.2

  • Make sure you have a modern computer and "virtualization technology" switched on in your BIOS
  • open a console and enter
# yast -i kvm virt-manager
# /etc/init.d/libvirtd start
# chkconfig libvirtd on
# virt-manager

Now you try to create a new virtual machine. When you use Paravirtualization, you get the error message "The hypervisor is not running.". When you try to use "Full virtualization", you get an error

The operating system does not support full virtualization
The CPUs support full virtualization, but it is disabled in the BIOS

To resolve this,

  • create a new connection, type "QEMU/KVM"
  • reboot your computer
  • start virt-manager

create a new virtual machine. You get an error

internal error No <source> 'bridge' attribute specified with <interface type='bridge'/>

To resolve this

  • you disable networking

Now it works - you can create a virtual machine without networking.

Network

Set Network so it is bridged. To check if bridged network is enabled

brctl show

If you only see a bridge e.a. vnet0 with a physical interface e.a. eth0 in it, skip this step. Add the physical interface eth0 to the bridge br0.

brctl addif br0
brctl addif br0 eth0
/etc/init.d/libvirtd restart

Stop the interface that will be used for bridging:

ifdown eth0

Now we have to set the ip address of eth0 to the bridge

cp /etc/sysconfig/network/ifcfg-eth0 /etc/sysconfig/network/ifcfg-br0
vi /etc/sysconfig/network/ifcfg-br0

Now change it that the content looks like this

DEVICE=br0
TYPE=Bridge
BOOTPROTO=static
IPADDR=<Static IP address>
NETMASK=<Netmask>
GATEWAY=<Gateway>
ONBOOT=yes

Now change the content of /etc/sysconfig/network/ifcfg-eth0 to:

DEVICE=eth0
# change the hardware address to match the hardware address your NIC uses
HWADDR=00:16:76:D6:C9:45
ONBOOT=yes
BRIDGE=br0
NM_CONTROLLED=no

Now you delete the entry from the routing table that makes the packages go to eth0:

route del -net 192.168.0.0 netmask 255.255.255.0 eth0

Reference: http://kbase.redhat.com/faq/docs/DOC-19071