Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

15.22. Managing Virtual Networks

You can use virsh to manage virtual networks. To list virtual networks:
virsh net-list
This command generates output similar to:
[root@domain ~]# virsh net-list
Name                 State      Autostart
default              active     yes      
vnet1	             active     yes      
vnet2	             active     yes
To view network information for a specific virtual network:
virsh net-dumpxml [vnet name]
This displays information about a specified virtual network in XML format:
[root@domain ~]# virsh net-dumpxml vnet1
  <forward dev='eth0'/>
  <bridge name='vnet0' stp='on' forwardDelay='0' />
  <ip address='' netmask=''>
      <range start='' end='' />
Other virsh commands used in managing virtual networks are:
  • virsh net-autostart [network name] — Autostart a network specified as [network name]
  • virsh net-create [XML file] — Generates and starts a new network using a preexisting XML file
  • virsh net-define [XML file] — Generates a new network from a preexisting XML file without starting it
  • virsh net-destroy [network name] — Destroy a network specified as [network name]
  • virsh net-name [network UUID] — Convert a specified [network UUID] to a network name
  • virsh net-uuid [network name — Convert a specified [network name] to a network UUID
  • virsh net-start [name of an inactive network] — Starts a previously undefined inactive network
  • virsh net-undefine [name of an inactive network] — Undefine an inactive network