top of page

My qemu-kvm setup on Ubuntu 20.04.3 LTS

Updated: Jun 24, 2022

I'm writing all this down for the next server I buy so I have a bit of a recipe to use and don't have to figure out some of this stuff from scratch all over again.


First of all, I'm not a fan of this NetworkManager bullshit. Maybe it's just because I'm an old-school BSD guy and I liked /etc/rc.local, but I find the older interfaces file in Ubuntu much easier to create and much less mysterious to troubleshoot.


Install /etc/network/interfaces functionality with the ifupdown package.


# apt install ifupdown

If you've got multiple ethernet interfaces of the same speed to plug into the switch (almost always do), using 802.3ad bonding is an easy way to combine them all into a single interface. You can even span them across multiple switches for redundancy.


# apt install ifenslave
# modprobe bonding

Edit /etc/network/interfaces to suit your particular config. For example, replace eno1, eno2, etc. with the physical interfaces in your server (might be enps0f0 and enps0f1, for example). Also, this should be obvious, but set the IP addresses per your local network. You may need to do some switch-side work to support this, such as configure a port-channel for the group of ports you'll be plugging the server into.


# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d


auto lo
iface lo inet loopback

auto eno1
iface eno1 inet manual
        bond-master bond0
        bond-primary eno1

auto eno2
iface eno2 inet manual
        bond-master bond0

auto eno3
iface eno3 inet manual
        bond-master bond0

auto eno4
iface eno4 inet manual
        bond-master bond0

auto bond0

iface bond0 inet manual
                slaves eno1 eno2 eno3 eno4
                bond_mode 4
                bond-miimon 100
                bond_downdelay 0
                bond_updelay 0

auto br0
iface br0 inet static
        address 192.168.86.14
        netmask 255.255.255.0
        gateway 192.168.86.1
        bridge_ports bond0

iface br0 inet6 static
        address 2001:470:416b::14/64
        gateway 2001:470:416b::1


Turn off NetworkManager


Now that we are all set up, let's toss that old Netplan/NetworkManager service in the garbage


# systemctl stop NetworkManager.service
# systemctl disable NetworkManager.service

...and just because I miss ifconfig


# apt install net-tools

We're going to set up a bridge for our virtual machines because they are servers and I want to reach them from other devices...and bridges seem to work more consistently and reliably than macvtap/SR-IOV (could be a personal problem, but just my experience)


# apt install bridge-utils

Set our nameservers:


edit /etc/systemd/stub-resolved.conf (honestly, I am not sure this is working properly yet. I'll have to revisit this later).

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See resolved.conf(5) for details

[Resolve]
DNS=192.168.86.2
FallbackDNS=192.168.86.4
Domains=siegelgrouplabs.net
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#DNSOverTLS=no
#Cache=no-negative
#DNSStubListener=yes
#ReadEtcHosts=yes

Install LLDP


Why? No particular reason, it's just nice to have in case you suck at labeling what's plugged into which ports on your switch.


# apt install lldpd
# systemctl enable lldpd
# systemctl start lldpd

Reboot to make sure everything is cool up to this point


If it's not, it's probably because you made a typo, or in my case, 6 or 7 typos. Debug, fix and reboot. Keep fixing and rebooting until everything is perfect because once this server is prepped and installed in the rack you don't want to have to go sit in front of it later to fix a problem you missed due to your own impatience.


Install KVM


I think qemu-kvm might already installed at this point, but I do like a GUI interface for setting up new VM's. I know there are others, but this one works fine.


# apt install virt-manager

Everything is ready now, so launch virt-manager and start creating VM's. You now have a nice, vanilla base install for doing whatever it is you have planned for this puppy.


94 views0 comments

Recent Posts

See All
bottom of page