Product SiteDocumentation Site

2.65. net-start

Starts an inactive, previously defined, virtual network.
Usage
net-start --network network-identifier
Options
Name Required? Description
--network network-identifier
required
The name or UUID of the virtual network to start.
The word "--network" itself is optional.
Table 2.11. Options

Availability
Available from libvirt 0.2.0 onwards
Platform or Hypervisor specific notes
None yet
Examples
virsh # net-start examplenetwork
Starts the virtual network named "examplenetwork".
virsh # net-start --network examplenetwork
Same as the above example.
virsh # net-start b7005dec-be1a-fe9a-338a-0cb1301dfcfd
Starts the virtual network that has a UUID of "b7005dec-be1a-fe9a-338a-0cb1301dfcfd".
virsh # net-start --network b7005dec-be1a-fe9a-338a-0cb1301dfcfd
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 using the XML file:
# 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
Defined. Now we confirm:
virsh # net-list --all
Name                 State      Autostart
-----------------------------------------
default              active     yes
examplenetwork       inactive   no    <-- new persistent networks start out inactive
Newly defined virtual networks aren't automatically started, so we manually start it now:
virsh # net-start examplenetwork      <-- this is net-start in action
Network examplenetwork started
virsh # net-list
Name                 State      Autostart
-----------------------------------------
default              active     yes
examplenetwork       active     no       <-- the persistent network is now running (active)
We check the details of the started network from virsh, using net-dumpxml. This shows us the name of the bridge network interface.
virsh # net-dumpxml examplenetwork
<network>
  <name>examplenetwork</name>
  <uuid>b7005dec-be1a-fe9a-338a-0cb1301dfcfd</uuid>
  <forward mode='route'/>
  <bridge name='virbr100' stp='on' delay='0' />      <-- the "virbr100" here
  <ip address='10.10.120.1' netmask='255.255.255.0'>
  </ip>
</network>
If the virtualisation server is running Linux, we can check how the bridge interface appears to the host OS:
# ifconfig virbr100
virbr100  Link encap:Ethernet  HWaddr A6:45:97:AE:8E:08  
          inet addr:10.10.120.1  Bcast:10.10.120.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:2653 (2.5 KiB)
See also
  • net-define - Adds a new persistent virtual network to libvirt, without starting it, using settings from an XML file.
  • net-dumpxml - Outputs the XML configuration for a virtual network, to stdout
  • net-list - Displays a list of the virtual networks libvirt is aware of.