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 [network name]
— Autostart a network specified as [network name]virsh net-create [XML file]
— Generates and starts a new network using a preexisting XML filevirsh net-define [XML file]
— Generates a new network from a preexisting XML file without starting itvirsh net-destroy [network name]
— Destroy a network specified as [network name]virsh net-name [network UUID]
— Convert a specified [network UUID] to a network namevirsh net-uuid [network name
— Convert a specified [network name] to a network UUIDvirsh net-start [name of an inactive network]
— Starts a previously undefined inactive networkvirsh net-undefine [name of an inactive network]
— Undefine an inactive network