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
<network>
<name>vnet1</name>
<uuid>98361b46-1581-acb7-1643-85a412626e70</uuid>
<forward dev='eth0'/>
<bridge name='vnet0' stp='on' forwardDelay='0' />
<ip address='192.168.100.1' netmask='255.255.255.0'>
<dhcp>
<range start='192.168.100.128' end='192.168.100.254' />
</dhcp>
</ip>
</network>
Other virsh commands used in managing virtual networks are:
virsh net-autostart — Autostart a network specified as [network name]
[network name]
virsh net-create — Generates and starts a new network using a preexisting XML file
[XML file]
virsh net-define — Generates a new network from a preexisting XML file without starting it
[XML file]
virsh net-destroy — Destroy a network specified as [network name]
[network name]
virsh net-name — Convert a specified [network UUID] to a network name
[network UUID]
virsh net-uuid — Convert a specified [network name] to a network UUID
[network name
virsh net-start — Starts a previously undefined inactive network
[name of an inactive network]
virsh net-undefine — Undefine an inactive network
[name of an inactive network]