User Tools

Site Tools


Sidebar

unix:virtualization:kvm:server

This is an old revision of the document!


KVM on server with libvirt

This is a work in progress, 20201015

Install and Configure

First, verify you have the required hardware virtualization support in your CPU:

#Verify the hvm support
egrep --color 'vmx|svm' /proc/cpuinfo

You should see either vmx or svm in the output.

Now, install the basic packages needed, and nothing else

apt install -y --no-install-recommends qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils libguestfs-tools genisoimage virtinst libosinfo-bin virt-top
reboot # brings libraries online

Verify system is working ok

Commands are of the form: virsh --connect qemu:///system command where command is any of the commands accepted by virsh.

sudo su # become root user
virsh --connect qemu:///system list --all

The --connect qemu:///system is the connection used, which is not the default. To set that to the default, run the following one time. This will become the “norm” on the next login:

echo "# set default uri for libvirt" >> ~/.profile
echo "export LIBVIRT_DEFAULT_URI='qemu:///system'" >> ~/.profile

Defining Network

interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
 
source /etc/network/interfaces.d/*
 
# The loopback network interface
auto lo
iface lo inet loopback
 
iface eth0 inet manual
iface eth0 inet6 manual
 
iface eth1 inet manual
iface eth1 inet6 manual
 
auto bond0
iface bond0 inet manual
   bond-mode 4
   bond-miimon 100
   bond_xit_hash_policy layer2+3
   bond_lacp_rate slow
   slaves eth0 eth1
 
 
iface bond0.10 inet manual
   vlan-raw-device bond0.10
 
iface bond0.20 inet manual
   vlan-raw-device bond0.20
 
iface bond0.30 inet manual
   vlan-raw-device bond0.30
 
auto br_wan
iface br_wan inet static
        address 192.168.1.13
        netmask 255.255.255.255
   bridge_ports bond0.10
   bridge_stp off
   bridge_fd 0
   bridge_maxwait 0
 
auto br_dmz
iface br_dmz inet static
        address 192.168.1.12
        netmask 255.255.255.255
        bridge_ports bond0.20
        bridge_stp off
        bridge_fd 0
        bridge_maxwait 0
 
auto br_lan
iface br_lan inet dhcp
        bridge_ports bond0.30
        bridge_stp off
        bridge_fd 0
        bridge_maxwait 0
unix/virtualization/kvm/server.1602908385.txt.gz · Last modified: 2020/10/16 23:19 by rodolico