Linux

KVM (Kernel-Based Virtual Machine)

Virtual Machine Manager

Installation

sh# apt install virt-manager kvm qemu-kvm libvirt-daemon ssh-askpass-gnome ovmf
  • virt-manager (virtual machine manager)
  • kvm (kernel-based virtual machine)
  • qemu-kvm
  • ssh-askpass-gnome
  • libvirt-daemon
  • ovmf (UEFI firmware)

Adding a LVM Volume Group as Storage Pool

In the Virtual Machine Manager 'Main Window' select 'Edit' -> 'Connection Details'

Virtual Machine Manager - Main Window

In the 'Connection Details Window' select the tab 'Storage' and press the 'Plus-Sign' located at the bottom left corner to add a new storage pool

Virtual Machine Manager - Connection Details

Enter 'kvmpool' in the name field and choose 'logical: LVM Volume Group' as type. Then klick the 'Forward' button.

Enter "/dev/kvmpool' as 'Target Path' and '/dev/sda3' as source path.

Adding Network Interfaces

The 'Virtual Machine Manager' parses the '/etc/network/interfaces' File to display all available network interfaces.

  • sh# man 5 interfaces

Because macvlan interfaces are not supported by the '/etc/network/interfaces' configuration, we have to add them differently before we can use them. In the following we will use via systemd-networkd to add and configure new network devices.

sh# cd /etc/systemd/network/
sh# vi 10-virbr100.netdev
[NetDev]
Name=virbr100
Kind=macvlan

[MACVLAN]
Mode=bridge

systemd-networkd File Types

    • .netdev = device definition
    • .network = device configuration

! Make sure systemd-networkd is enabled !

  • systemctl enable systemd-networkd
  • systemctl enable systemd-resolved
sh# cd /etc/systemd/network/
sh# vi 10-virbr100.network
[Match]
Name=virbr100

[Network]
Address=192.168.100.78/24
Gateway=192.168.100.1
DNS=192.168.100.1

The File 10-virbr100.network contains the virbr100 macvlan interface configuration.

sh# cd /etc/systemd/network/
sh# vi 10-enp0s25.100.network
[Match]
Name=enp0s25.100

[Network]
MACVLAN=virbr100

A MACVLAN interface is always a subinterface, thus we have to associate it with a Master, which we do in the 10-enp0s25.100.network file.

  • virbr100 is a subinterface of the vlan interface enp0s25.100.

Now that we created all devices, we have to edit /etc/network/interfaces, so that we can use these (new devices) with the Virtual Machine Manager.

Virtual Machine Manager - Network Interface Configuration

sh# vi /etc/network/interfaces
...
# vlan interface
iface enp0s25.100 inet static

# macvlan bridge mode: virbr100 
iface virbr100 inet static

Importing Disks into new Virtual Machine with UEFI

  • UEFI (OVMF)

When starting the new virtual Machine the boot process stops with a efi-shell. To boot the linux

manual start

fs0:
EFI\grub\grubx64.efi

startup.nsh

EFI\grub\grubx64.efi
  • default path: 'efi\boot\bootx64.efi'