Managing virtual networks

Use virsh commands to manage virtual networks.

Before you begin

KVM hosts provide a preconfigured virtual network named default. You can configure more virtual networks as described in Configuring virtual networks.

About this task

Virtual networks that are defined to libvirt can be in one of the states inactive or active.

The following figure shows the state-transition diagram of a virtual network:
Figure 1. Virtual network state-transition diagram
This graphic illustrates the virtual network states

Procedure

  • Creating, modifying, and deleting a persistent network definition:
    Task Command
    Create a persistent definition of a virtual network configuration. net-define
    Edit the libvirt-internal configuration of a defined virtual network. net-edit
    Delete the persistent libvirt definition of a virtual network. net-undefine
  • Managing the virtual network lifecycle:
    Task Command
    Enable or disable the automatic activation of a virtual network when the libvirt daemon is started. net-autostart
    Activate a defined, inactive virtual network. net-start
    Deactivate a virtual network. net-destroy
  • Monitoring networks:
    Task Command
    View a list of all defined virtual networks. net-list
    Display the current configuration of a virtual network. net-dumpxml
    Display information about a defined virtual network. net-info
    Retrieve the name of a virtual network from its UUID. net-name
    Retrieve the UUID of a virtual network from its name. net-uuid