sudo apt install -y \
	qemu-kvm \
	guestfish \
	libvirt-clients \
	libvirt-daemon \
	libvirt-daemon-system \
	libvirt-daemon-driver-storage-zfs \
	bridge-utils \
	virtinst \
	virt-manager

sudo virsh net-list --all

# Start the net and autostart on reboot
sudo virsh net-start default
sudo virsh net-autostart default

# Offload the mechanism of virtio-net using vhost_net
sudo modprobe vhost_net
echo "vhost_net" | sudo  tee -a /etc/modules

# Add default user to virt group
sudo adduser default libvirt
sudo adduser default libvirt-qemu

# reload group membership
newgrp libvirt
newgrp libvirt-qemu

# Add bridge for kvm
sudo cat > /etc/network/interfaces.d/br0 < EOF
#Configure bridge and give it a static ip
auto br0
iface br0 inet static
        address 192.168.1.94
        netmask 255.255.255.0
        network 192.168.1.1
        broadcast 192.168.1.255
        gateway 192.168.1.1
        bridge_ports eth0
        bridge_stp off
        bridge_fd 0
        bridge_maxwait 0
        dns-nameservers 8.8.8.8
EOF
