Programster's Blog

Tutorials focusing on Linux, programming, and open-source

KVM - Fix Missing Default Network

Run the steps below if you ever get this message:

ERROR    Requested operation is not valid: network 'default' is not active


Stage 1

First check if you have the network defined by running:

sudo virsh net-list --all

If you got the following output then proceed to "Stage 1 - Create the Default Network". If you don't and the network exists, proceed to "Stage 2 - Start and autostart the network".

 Name                 State      Autostart     Persistent

Stage 1 - Create the Default Network

Create the default network by copy-pasting the following lines into a file called default.xml.

  <forward mode='nat'/>
  <bridge name='virbr0' stp='on' delay='0'/>
  <mac address='52:54:00:0a:cd:21'/>
  <ip address='' netmask=''>
      <range start='' end=''/>

Now to add that network permanently to our KVM host, run the following:

sudo virsh net-define --file default.xml

Stage 2 - Start and autostart the network

To manually start the network run:

sudo virsh net-start default

To have the network automatically start up in future run:

sudo virsh net-autostart --network default


Failed To Initializae Firewall Backend

Kris Maussen has kindly pointed out in the comments that if you get the following error messages:

error: Failed to start network default
error: internal error: Failed to initialize a valid firewall backend

You will need to install firewalld.

sudo apt update && sudo apt install firewalld -y

Now run the following commands in order to enable the service and make networking work again:

sudo systemctl enable --now firewalld
sudo systemctl restart libvirtd

DnsMasq Issue

If you get the following error:

error: Failed to start network default
error: Cannot check dnsmasq binary /usr/sbin/dnsmasq: No such file or directory

Just install dnsmasq.

sudo apt-get install dnsmasq -y
Last updated: 8th May 2020
First published: 16th August 2018