Product SiteDocumentation Site

2.56. net-autostart

Enables or disables the automatic startup of a persistent virtual network, by the libvirt daemon.
Usage
net-autostart --network network-identifier --disable
Options
Table 2.2. Options
Name Required? Description
--network network-identifier
required
The name or UUID for the virtual network being configured.
The word "--network" itself is optional.
--disable 
optional
Disables the automatic starting of the virtual network.

Availability
Available from libvirt 0.2.1 onwards
Platform or Hypervisor specific notes
None yet
Examples
virsh # net-autostart default --disable
Stops the virtual network named "default" from automatically starting when the libvirt daemon starts.
virsh # net-autostart --network default --disable
Same as the above example.
virsh # net-autostart bfbc4c69-7d6a-cc9a-904c-09910ce179c0 --disable
Stops the virtual network with UUID "bfbc4c69-7d6a-cc9a-904c-09910ce179c0" from automatically starting when the libvirt daemon starts.
virsh # net-autostart --network bfbc4c69-7d6a-cc9a-904c-09910ce179c0 --disable
Same as the above example.
virsh # net-autostart default
Enables the automatic starting of the virtual network named "default", by the libvirt daemon when it starts.
virsh # net-autostart --network default
Same as the above example.
Example in context
Starting with an XML file we've already created, using the required XML format:
<network>
  <name>examplenetwork</name>
  <bridge name="virbr100" />
  <forward mode="route" />
  <ip address="10.10.120.1" netmask="255.255.255.0" />
</network>
# ls -al /root/examplenetwork.xml
-rw-r--r--. 1 root root 162 Nov  7 16:43 /root/examplenetwork.xml
We start virsh interactively, then define a persistent virtual network:
# virsh
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit
virsh # net-list
Name                 State      Autostart
-----------------------------------------
default              active     yes
virsh # net-define /root/examplenetwork.xml
Network examplenetwork defined from /root/examplenetwork.xml
Newly defined virtual networks aren't set to automatically be started, as can be seen here:
virsh # net-list --all
Name                 State      Autostart
-----------------------------------------
default              active     yes
examplenetwork       inactive   no    <-- this is the important piece
We enable automatic starting for it:
virsh # net-autostart examplenetwork
Network examplenetwork marked as autostarted
Checking, to make sure:
virsh # net-list --all
Name                 State      Autostart
-----------------------------------------
default              active     yes
examplenetwork       inactive   yes    <-- this is the important piece
From now on, whenever the libvirt daemon is started, it will automatically start this virtual network too (unless it's already running). If at some point we want to turn off automatic starting of the virtual network, we use the --disable option to the command:
# net-autostart --disable examplenetwork
Network examplenetwork unmarked as autostarted
virsh # net-list --all
Name                 State      Autostart
-----------------------------------------
default              active     yes
examplenetwork       inactive   no    <-- this is the important piece
See also
  • net-dumpxml - Outputs the XML configuration for a virtual network, to stdout.
  • net-list - Lists the virtual networks libvirt is aware of.