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