Edition 0
virsh, the libvirt command shell.
		Mono-spaced Bold
		To see the contents of the filemy_next_bestselling_novelin your current working directory, enter thecat my_next_bestselling_novelcommand at the shell prompt and press Enter to execute the command.
Press Enter to execute the command.Press Ctrl+Alt+F1 to switch to the first virtual terminal. Press Ctrl+Alt+F7 to return to your X-Windows session.
mono-spaced bold. For example:
		File-related classes includefilesystemfor file systems,filefor files, anddirfor directories. Each class has its own associated set of permissions.
Choose → → from the main menu bar to launch Mouse Preferences. In the Buttons tab, click the Left-handed mouse check box and click to switch the primary mouse button from the left to the right (making the mouse suitable for use in the left hand).To insert a special character into a gedit file, choose → → from the main menu bar. Next, choose → from the Character Map menu bar, type the name of the character in the Search field and click . The character you sought will be highlighted in the Character Table. Double-click this highlighted character to place it in the Text to copy field and then click the button. Now switch back to your document and choose → from the gedit menu bar.
Mono-spaced Bold ItalicProportional Bold Italic
		To connect to a remote machine using ssh, typesshat a shell prompt. If the remote machine isusername@domain.nameexample.comand your username on that machine is john, typessh john@example.com.Themount -o remountcommand remounts the named file system. For example, to remount thefile-system/homefile system, the command ismount -o remount /home.To see the version of a currently installed package, use therpm -qcommand. It will return a result as follows:package.package-version-release
Publican is a DocBook publishing system.
mono-spaced roman and presented thus:
		books Desktop documentation drafts mss photos stuff svn books_tests Desktop1 downloads images notes scripts svgs
mono-spaced roman but add syntax highlighting as follows:
		package org.jboss.book.jca.ex1; import javax.naming.InitialContext; public class ExClient { public static void main(String args[]) throws Exception { InitialContext iniCtx = new InitialContext(); Object ref = iniCtx.lookup("EchoBean"); EchoHome home = (EchoHome) ref; Echo echo = home.create(); System.out.println("Created Echo"); System.out.println("Echo.echo('Hello') = " + echo.echo("Hello")); } }
virsh.
	| Command | Availability | Description | 
|---|---|---|
| 
							From libvirt 0.2.3
						 | 
							Attach device from an XML file
						 | |
| 
							From libvirt 0.3.0
						 | 
							Attach disk device
						 | |
| 
							From libvirt 0.3.0
						 | 
							Attach network interface
						 | |
| 
							From libvirt 0.2.1
						 | 
							Enable and disable the automatic starting of a guest domain when the libvirt daemon starts
						 | |
| 
							From libvirt 0.2.0
						 | 
							Connect the virtual serial console for the guest
						 | |
| 
							From libvirt 0.7.7
						 | 
							Compute baseline CPU
						 | |
| 
							From libvirt 0.7.5
						 | 
							Compare host CPU with a CPU described by an XML file
						 | |
| 
							From libvirt 0.1.0
						 | 
							Create a guest domain from an XML file
						 | |
| 
							From libvirt 0.1.6
						 | 
							Define, but don't start, a guest domain from an XML file
						 | |
| 
							From libvirt 0.0.1
						 | 
							Immediately terminates a running guest domain, releasing any resources in use by it
						 | |
| 
							From libvirt 0.2.3
						 | 
							Detach a device from an XML file
						 | |
| 
							From libvirt 0.3.0
						 | 
							Detach a disk device
						 | |
| 
							From libvirt 0.3.0
						 | 
							Detach a network interface
						 | |
| 
							From libvirt 0.1.0
						 
							Prior to version 0.1.0, this command was known as idof
						 | 
							Convert a domain name or UUID to domain id
						 | |
| 
							From libvirt 0.7.7
						 | 
							Aborts the currently running guest domain job
						 | |
| 
							From libvirt 0.7.7
						 | 
							Returns information about jobs running on a domain
						 | |
| 
							From libvirt 0.1.0
						 
							Prior to version 0.1.0, this command was known as nameof
						 | 
							Convert a guest domain id or UUID to guest domain name
						 | |
| 
							From libvirt 0.1.1
						 | 
							Convert a guest domain name or id to guest domain UUID
						 | |
| 
							From libvirt 0.6.4
						 | 
							Convert native guest configuration format to domain XML format
						 | |
| 
							From libvirt 0.6.4
						 | 
							Convert guest domain XML config to a native guest configuration format
						 | |
| 
							From libvirt 0.1.9
						 | 
							Core dump a guest domain
						 | |
| 
							From libvirt 0.0.1
						 | 
							Output the guest domain information as an XML dump to stdout
						 | |
| 
							From libvirt 0.4.6
						 | 
							Edit the XML configuration for a guest domain
						 | |
| 
							From libvirt 0.8.0
						 | 
							Save and destroy a running guest domain, so it can be restarted from the same state at a later time. When the virsh start command is next run for the guest domain, it will automatically be started from this saved state
						 | |
| 
							From libvirt 0.8.3
						 | 
							Remove an existing managed save state file from a guest domain
						 | |
| 
							From libvirt 0.8.5
						 | 
							Show maximum number of virtual CPUs for guest domains on this connection
						 | |
| 
							From libvirt 0.8.5
						 | 
							Gets or sets the current memory parameters for a guest domain
						 | |
| 
							From libvirt 0.3.2
						 | 
							Migrates a guest domain to another host
						 | |
| 
							From libvirt 0.8.0
						 | 
							Set maximum tolerable downtime of a guest domain which is being live-migrated to another host
						 | |
| 
							From libvirt 0.1.0
						 | 
							Run a reboot command in a guest domain
						 | |
| 
							From libvirt 0.0.2
						 | 
							Restore a guest domain
						 | |
| 
							From libvirt 0.0.1
						 | 
							Resume a guest domain
						 | |
| 
							From libvirt 0.0.2
						 | 
							Save the running state of a guest domain to a file
						 | |
| 
							From libvirt 0.2.3
						 | 
							Show or set scheduler parameters
						 | |
| 
							From libvirt 0.1.4
						 | 
							Change the maximum memory allocation limit in the guest domain
						 | |
| 
							From libvirt 0.1.4
						 | 
							Change the current memory allocation in the guest domain
						 | |
| 
							From libvirt 0.1.4
						 | 
							Change the number of virtual CPUs in the guest domain
						 | |
| 
							From libvirt 0.0.1
						 | 
							Run shutdown in a guest domain
						 | |
| 
							From libvirt 0.1.6
						 | 
							Start a guest domain, either from the last managedsave state, or via a fresh boot if no managedsave state is present
						 | |
| 
							From libvirt 0.0.1
						 | 
							Suspend a running guest domain
						 | |
| 
							From libvirt 0.3.2
						 | 
							Output the device for the TTY console
						 | |
| 
							From libvirt 0.1.6
						 | 
							Remove the configuration for an inactive guest domain
						 | |
| 
							From libvirt 0.8.0
						 | 
							Update device from an XML file
						 | |
| 
							From libvirt 0.8.5
						 | 
							Returns the number of virtual CPUs used by a guest domain
						 | |
| 
							From libvirt 0.1.4
						 | 
							Returns basic information about a guest domains virtual CPUs
						 | |
| 
							From libvirt 0.1.4
						 | 
							Pin guest domain virtual CPUs to physical host CPUs
						 | |
| 
							From libvirt 0.0.1
						 | 
							Display the system version information
						 | |
| 
							From libvirt 0.2.0
						 | 
							Output the IP address and port number for the VNC display
						 | 
| Command | Availability | Description | 
|---|---|---|
| 
							From libvirt 0.8.1
						 | 
							Get block device size info for a guest domain
						 | |
| 
							From libvirt 0.3.2
						 | 
							Get device block stats for a running guest domain
						 | |
| 
							From libvirt 0.3.2
						 | 
							Get network interface stats for a running guest domain
						 | |
| 
							From libvirt 0.1.0
						 | 
							Returns basic information about a guest domain
						 | |
| 
							From libvirt 0.7.5
						 | 
							Get memory statistics for a runnng guest domain
						 | |
| 
							From libvirt 0.1.0
						 
							Prior to version 0.1.0, this command was known as dstate
						 | 
							Returns state about a guest domain
						 | |
| 
							From libvirt 0.0.1
						 | 
							Returns a list of guest domains
						 | 
| Command | Availability | Description | 
|---|---|---|
| 
							From libvirt 0.2.1
						 | 
							Returns capabilities of hypervisor/driver
						 | |
| 
							From libvirt 0.0.1
						 | 
							Connect to local hypervisor
						 | |
| 
							From libvirt 0.3.3
						 | 
							Display available free memory for a NUMA cell
						 | |
| 
							From libvirt 0.3.0
						 | 
							Display the name of the hypervisor host
						 | |
| 
							From libvirt 0.1.0
						 | 
							Returns basic information about the node
						 | |
| 
							From libvirt 0.8.6
						 | 
							Qemu monitor command
						 | |
| 
							From libvirt 0.3.0
						 | 
							Display the hypervisor canonical URI
						 | 
| Command | Availability | Description | 
|---|---|---|
| 
							From libvirt 0.7.0
						 | 
							Define a physical host network interface
						 | |
| 
							From libvirt 0.7.0
						 | 
							Shut down and disable a physical host network interface
						 | |
| 
							From libvirt 0.7.0
						 | 
							Output information for a physical host network interface, as an XML dump to stdout
						 | |
| 
							From libvirt 0.7.0
						 | 
							Edit the XML configuration for a physical host network interface
						 | |
| 
							From libvirt 0.7.0
						 | 
							Returns a list of physical host network interfaces
						 | |
| 
							From libvirt 0.7.0
						 | 
							Returns the MAC address for a physical host network interface
						 | |
| 
							From libvirt 0.7.0
						 | 
							Returns the physical host interface name for a MAC address
						 | |
| 
							From libvirt 0.7.0
						 | 
							Enables and starts a physical host network interface
						 | |
| 
							From libvirt 0.7.0
						 | 
							Removes the configuration information for a physical host network interface
						 | 
| Command | Availability | Description | 
|---|---|---|
| 
							From libvirt 0.8.0
						 | 
							Define a new network filter or update an existing one
						 | |
| 
							From libvirt 0.8.0
						 | 
							Output the network filter information as an XML dump to stdout
						 | |
| 
							From libvirt 0.8.0
						 | 
							Edit the XML configuration for a network filter
						 | |
| 
							From libvirt 0.8.0
						 | 
							Returns the list of network filters
						 | |
| 
							From libvirt 0.8.0
						 | 
							Undefine a network filter
						 | 
| Command | Availability | Description | 
|---|---|---|
| 
							From libvirt 0.2.1
						 | 
							Enable or disable the automatic starting of a virtual network, when the libvirt daemon starts
						 | |
| 
							From libvirt 0.2.0
						 | 
							Creates a new transient virtual network from an XML file
						 | |
| 
							From libvirt 0.2.0
						 | 
							Adds a new permanent virtual network from an XML file, without starting it
						 | |
| 
							From libvirt 0.2.0
						 | 
							Shuts down a running virtual network
						 | |
| 
							From libvirt 0.2.0
						 | 
							Displays the XML configuration for a virtual network (to stdout)
						 | |
| 
							From libvirt 0.4.6
						 | 
							Allows the user to edit the XML configuration of a virtual network, using their preferred editor
						 | |
| 
							From libvirt 0.8.6
						 | 
							Displays basic information for a virtual network
						 | |
| 
							From libvirt 0.2.0
						 | 
							Lists the virtual networks libvirt is aware of
						 | |
| 
							From libvirt 0.2.0
						 | 
							When given a network UUID, returns its corresponding network name
						 | |
| 
							From libvirt 0.2.0
						 | 
							Starts a (previously defined) inactive virtual network
						 | |
| 
							From libvirt 0.2.0
						 | 
							Removes an inactive virtual network from the libvirt configuration
						 | |
| 
							From libvirt 0.2.0
						 | 
							When given a network name, returns its corresponding UUID
						 | 
| Command | Availability | Description | 
|---|---|---|
| 
							From libvirt 0.6.5
						 | 
							Create a device on the physical host, which can then be assigned to a guest domain
						 | |
| 
							From libvirt 0.6.5
						 | 
							Destroys a device on a physical host
						 | |
| 
							From libvirt 0.6.1
						 | 
							Dettach a node device from its device driver before assigning to a guest domain
						 | |
| 
							From libvirt 0.5.0
						 | 
							Output the details for a node device as an XML dump to stdout
						 | |
| 
							From libvirt 0.5.0
						 | 
							Enumerate devices on the host
						 | |
| 
							From libvirt 0.6.1
						 | 
							Reattach a node device to its device driver, once released by the guest domain
						 | |
| 
							From libvirt 0.6.1
						 | 
							Reset a node device before or after assigning to a domain
						 | 
| Command | Availability | Description | 
|---|---|---|
| 
							From libvirt 0.7.1
						 | 
							Define or modify a secret
						 | |
| 
							From libvirt 0.7.1
						 | 
							Output attributes of a secret as an XML dump to stdout
						 | |
| 
							From libvirt 0.7.1
						 | 
							Output a secret value to stdout
						 | |
| 
							From libvirt 0.7.1
						 | 
							Returns a list of secrets
						 | |
| 
							From libvirt 0.7.1
						 | 
							Set a secret value
						 | |
| 
							From libvirt 0.7.1
						 | 
							Undefine a secret
						 | 
| Command | Availability | Description | 
|---|---|---|
| 
							From libvirt 0.8.0
						 | 
							Creates a snapshot of a domain
						 | |
| 
							From libvirt 0.8.0
						 | 
							Gets the current snapshot for a domain
						 | |
| 
							From libvirt 0.8.0
						 | 
							Removes a snapshot, and all of it's children, from a domain
						 | |
| 
							From libvirt 0.8.0
						 | 
							Displays the XML fragment for a domain snapshot
						 | |
| 
							From libvirt 0.8.0
						 | 
							Lists the snapshots for a domain
						 | |
| 
							From libvirt 0.8.0
						 | 
							Reverts a domain to a given snapshot
						 | 
| Command | Availability | Description | 
|---|---|---|
| 
							From libvirt 0.4.6
						 | 
							Discover potential storage pool sources
						 | |
| 
							From libvirt 0.4.6
						 | 
							Discover potential storage pool sources
						 | |
| 
							From libvirt 0.4.1
						 | 
							Enable or disable the automatic starting of a storage pool, when the libvirt daemon starts
						 | |
| 
							From libvirt 0.4.1
						 | 
							Build a storage pool
						 | |
| 
							From libvirt 0.4.1
						 | 
							Create and start a transient storage pool, that will not persist across system restarts, using settings from an XML file
						 | |
| 
							From libvirt 0.4.1
						 | 
							Create and start a transient storage pool, that will not persist across system restarts, using settings passed as options
						 | |
| 
							From libvirt 0.4.1
						 | 
							Add a new persistent storage pool to the configuration, without starting it, using settings from an XML file
						 | |
| 
							From libvirt 0.4.1
						 | 
							Add a new persistent storage pool to the configuration, without starting it, using settings passed as options
						 | |
| 
							From libvirt 0.4.1
						 | 
							Delete a storage pool
						 | |
| 
							From libvirt 0.4.1
						 | 
							Shuts down a storage pool (from the libvirt point of view), releasing any resources in use by it
						 | |
| 
							From libvirt 0.4.1
						 | 
							Displays the XML configuration for a storage pool (to stdout)
						 | |
| 
							From libvirt 0.4.6
						 | 
							Allows the user to edit the XML configuration of a storage pool, using their preferred editor
						 | |
| 
							From libvirt 0.4.1
						 | 
							Returns basic information about a storage pool
						 | |
| 
							From libvirt 0.4.1
						 | 
							Displays a list of the storage pools libvirt is aware of
						 | |
| 
							From libvirt 0.4.1
						 | 
							When given a pool UUID, returns the name of the corresponding storage pool
						 | |
| 
							From libvirt 0.4.1
						 | 
							Re-examines the storage in a storage pool, updating the internal list of volumes present and their details
						 | |
| 
							From libvirt 0.4.1
						 | 
							Starts a (previously defined) inactive storage pool
						 | |
| 
							From libvirt 0.4.1
						 | 
							Removes an inactive storage pool from the libvirt configuration
						 | |
| 
							From libvirt 0.4.1
						 | 
							When given a storage pool name, returns the corresponding storage pool UUID
						 | 
| Command | Availability | Description | 
|---|---|---|
| 
							From libvirt 0.6.4
						 | 
							Copies an existing storage volume, including data, to a new storage volume
						 | |
| 
							From libvirt 0.4.1
						 | 
							Creates a new storage volume, on a given storage pool, using settings from an XML file
						 | |
| 
							From libvirt 0.4.1
						 | 
							Creates a new storage volume, on a given storage pool, using settings passed as options
						 | |
| 
							From libvirt 0.6.4
						 | 
							Create a new storage volume from an existing storage volume
						 | |
| 
							From libvirt 0.4.1
						 | 
							Removes a storage volume from a storage pool
						 | |
| 
							From libvirt 0.4.1
						 | 
							Displays the XML configuration for a storage volume, to stdout
						 | |
| 
							From libvirt 0.4.1
						 | 
							Returns basic information about a storage volume
						 | |
| 
							From libvirt 0.4.1
						 | 
							When given a storage volume name or path, returns the corresponding key for that volume
						 | |
| 
							From libvirt 0.4.1
						 | 
							Displays a list of the storage volumes libvirt is aware of, in a given storage pool
						 | |
| 
							From libvirt 0.4.1
						 | 
							When given a storage volume path or key, returns the corresponding name for that volume
						 | |
| 
							From libvirt 0.4.1
						 | 
							When given a storage volume name or key, returns the corresponding path for that volume
						 | |
| 
							From libvirt 0.8.2
						 | 
							Returns the storage pool name or UUID for a given storage volume
						 | |
| 
							From libvirt 0.8.0
						 | 
							Ensure data previously on a volume is not accessible to future reads
						 | 
| Command | Availability | Description | 
|---|---|---|
| 
							From libvirt 0.7.0
						 | 
							Change the current directory
						 | |
| 
							From libvirt 0.8.5
						 | 
							Echo back arguments, possibly with quoting
						 | |
| 
							From libvirt 0.8.0
						 | 
							Quit this interactive terminal. Alternative name for the quit command, doing exactly the same thing.
						 | |
| 
							From libvirt 0.0.1
						 | 
							Prints global help, command specific help, or help for a group of related commands
						 | |
| 
							From libvirt 0.7.0
						 | 
							Displays the current directory
						 | |
| 
							From libvirt 0.0.1
						 | 
							Quit this interactive terminal. Alternative name for the exit command, doing exactly the same thing.
						 | 
attach-device
				attach-disk
				attach-interface
				autostart
				capabilities
				cd
				connect
				console
				cpu-baseline
				cpu-compare
				create
				define
				destroy
				detach-device
				detach-disk
				detach-interface
				domblkinfo
				domblkstat
				domid
				domifstat
				dominfo
				domjobabort
				domjobinfo
				dommemstat
				domname
				domstate
				domuuid
				domxml-from-native
				domxml-to-native
				dump
				dumpxml
				echo
				edit
				exit
				find-storage-pool-sources-as
				find-storage-pool-sources
				freecell
				help
				hostname
				iface-define
				iface-destroy
				iface-dumpxml
				iface-edit
				iface-list
				iface-mac
				iface-name
				iface-start
				iface-undefine
				list
				managedsave-remove
				managedsave
				maxvcpus
				memtune --domain domain-identifier --hard-limit kb --soft-limit kb --swap-hard-limit kb --min-guarantee kb
				| Name | Required? | Description | 
|---|---|---|
| --domaindomain-identifier | 
										required
									 | 
										The name, id, or UUID of the guest domain
									 
										The word "--domain" itself is optional.
									 | 
| --hard-limitkb | 
										optional
									 | 
										Maximum memory the guest domain can use, in kilobytes. QEMU and LXC only.
									 | 
| --soft-limitkb | 
										optional
									 | 
										Minimum memory guaranteed for the guest domain during contention, in kilobytes. QEMU and LXC only.
									 | 
| --swap-hard-limitkb | 
										optional
									 | 
										Maximum swap memory the guest domain can use, in kilobytes. QEMU and LXC only.
									 | 
| --min-guaranteekb | 
										optional
									 | 
										Minimum amount of memory required to start a guest domain, in kilobytes. VMware ESX and vSphere only.
									 | 
virsh # memtune domain-id
virsh # memtune domain-id --hard-limit kilobytes
virsh # memtune domain-id --soft-limit kilobytes
virsh # memtune domain-id --swap-hard-limit kilobytes
<memtune> <hard_limit>131072</hard_limit> <soft_limit>65536</soft_limit> <swap_hard_limit>262144</swap_hard_limit> </memtune>
virsh # memtune lxcbb1 hard_limit : 131072 soft_limit : 65536 swap_hard_limit: 262144
virsh # memtune lxcbb1 --hard-limit 262144
virsh # memtune lxcbb1 hard_limit : 262144 soft_limit : 65536 swap_hard_limit: 262144
migrate-setmaxdowntime
				migrate
				net-autostart --network network-identifier --disable | Name | Required? | Description | 
|---|---|---|
| --networknetwork-identifier | 
										required
									 | 
										The name or UUID for the virtual network being configured.
									 
										The word "--network" itself is optional.
									 | 
| --disable | 
										optional
									 | 
										Disables the automatic starting of the virtual network.
									 | 
virsh # net-autostart default --disable
virsh # net-autostart --network default --disable
virsh # net-autostart bfbc4c69-7d6a-cc9a-904c-09910ce179c0 --disable
virsh # net-autostart --network bfbc4c69-7d6a-cc9a-904c-09910ce179c0 --disable
virsh # net-autostart default
virsh # net-autostart --network default
<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
# virsh
Welcome to virsh, the virtualization interactive terminal.
Type:  'help' for help with commands
       'quit' to quitvirsh # net-list Name State Autostart ----------------------------------------- default active yes
virsh # net-define /root/examplenetwork.xml Network examplenetwork defined from /root/examplenetwork.xml
virsh # net-list --all Name State Autostart ----------------------------------------- default active yes examplenetwork inactive no <-- this is the important piece
virsh # net-autostart examplenetwork Network examplenetwork marked as autostarted
virsh # net-list --all Name State Autostart ----------------------------------------- default active yes examplenetwork inactive yes <-- this is the important piece
# net-autostart --disable examplenetwork Network examplenetwork unmarked as autostarted
virsh # net-list --all Name State Autostart ----------------------------------------- default active yes examplenetwork inactive no <-- this is the important piece
net-create --file file-name
				| Name | Required? | Description | 
|---|---|---|
| --filefile-name | 
										required
									 | 
										The full path (and file name) to an XML file containing the network settings required.
									 
										The word "--file" itself is optional.
									 | 
virsh # net-create /root/examplenetwork.xml
virsh # net-create --file /root/examplenetwork.xml
<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
# virsh
Welcome to virsh, the virtualization interactive terminal.
Type:  'help' for help with commands
       'quit' to quitvirsh # net-list Name State Autostart ----------------------------------------- default active yes
virsh # net-create /root/examplenetwork.xml Network examplenetwork created from /root/examplenetwork.xml
virsh # net-list Name State Autostart ----------------------------------------- default active yes examplenetwork active no
virsh # net-dumpxml examplenetwork <network> <name>examplenetwork</name> <uuid>97ce3914-231e-4026-0a78-822e1e2e7226</uuid> <forward mode='route'/> <bridge name='virbr100' stp='on' delay='0' /> <ip address='10.10.120.1' netmask='255.255.255.0'> </ip> </network>
# ifconfig virbr100 virbr100 Link encap:Ethernet HWaddr 02:95:C3:06:A5:BF 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)
net-define --file file-name
				| Name | Required? | Description | 
|---|---|---|
| --filefile-name | 
										required
									 | 
										The full path (and file name) to an XML file containing the network settings required.
									 
										The word "--file" itself is optional.
									 | 
virsh # net-define /root/examplenetwork.xml
virsh # net-define --file /root/examplenetwork.xml
<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
# virsh
Welcome to virsh, the virtualization interactive terminal.
Type:  'help' for help with commands
       'quit' to quitvirsh # net-list Name State Autostart ----------------------------------------- default active yes
virsh # net-define /root/examplenetwork.xml Network examplenetwork defined from /root/examplenetwork.xml
virsh # net-list --all Name State Autostart ----------------------------------------- default active yes examplenetwork inactive no
virsh # net-start examplenetwork
Network examplenetwork startedvirsh # net-list Name State Autostart ----------------------------------------- default active yes examplenetwork active no
virsh # net-dumpxml examplenetwork <network> <name>examplenetwork</name> <uuid>97ce3914-231e-4026-0a78-822e1e2e7226</uuid> <forward mode='route'/> <bridge name='virbr100' stp='on' delay='0' /> <ip address='10.10.120.1' netmask='255.255.255.0'> </ip> </network>
# 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)
net-destroy --network network-identifier
				| Name | Required? | Description | 
|---|---|---|
| --networknetwork-identifier | 
										required
									 | 
										The name or UUID of the network to be shut down.
									 
										The word "--network" itself is optional.
									 | 
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' /> <ip address='10.10.120.1' netmask='255.255.255.0'> </ip> </network>
# ifconfig virbr100 virbr100 Link encap:Ethernet HWaddr D2:43:D9:47:FA:AA 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:7 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:1553 (1.5 KiB)
# ifconfig virbr100
virbr100: error fetching interface information: Device not foundvirsh # net-destroy mynetwork
virsh # net-destroy --network mynetwork
virsh # net-destroy bfbc4c69-7d6a-cc9a-904c-09910ce179c0
virsh # net-destroy --network bfbc4c69-7d6a-cc9a-904c-09910ce179c0
virsh # net-list Name State Autostart ----------------------------------------- default active yes examplenetwork active yes
# net-destroy examplenetwork Network examplenetwork destroyed
virsh # net-list --all Name State Autostart ----------------------------------------- default active yes examplenetwork inactive yes
net-dumpxml --network network-identifier
				| Name | Required? | Description | 
|---|---|---|
| --networknetwork-identifier | 
										required
									 | 
										The name or UUID of the network whose XML configuration is to be displayed.
									 
										The word "--network" itself is optional.
									 | 
virsh # net-dumpxml mynetwork
virsh # net-dumpxml --network mynetwork
virsh # net-dumpxml bfbc4c69-7d6a-cc9a-904c-09910ce179c0
virsh # net-dumpxml --network bfbc4c69-7d6a-cc9a-904c-09910ce179c0
virsh # net-list --all Name State Autostart ----------------------------------------- default active yes examplenetwork active no
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' /> <ip address='10.10.120.1' netmask='255.255.255.0'> </ip> </network>
net-edit --network network-identifier
				| Name | Required? | Description | 
|---|---|---|
| --networknetwork-identifier | 
										required
									 | 
										The name or UUID of the virtual network whose XML configuration is to be edited.
									 
										The word "--network" itself is optional.
									 | 
virsh # net-edit mynetwork
virsh # net-edit --network mynetwork
virsh # net-edit bfbc4c69-7d6a-cc9a-904c-09910ce179c0
virsh # net-edit --network bfbc4c69-7d6a-cc9a-904c-09910ce179c0
virsh # net-list --all Name State Autostart ----------------------------------------- default active yes examplenetwork active no
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' /> <ip address='10.10.120.1' netmask='255.255.255.0'> </ip> </network>
virsh # net-edit examplenetwork
<network> <name>examplenetwork</name> <uuid>b7005dec-be1a-fe9a-338a-0cb1301dfcfd</uuid> <forward mode='route'/> <bridge name='virbr100' stp='on' delay='30' /> <-- changed to 30 here <ip address='10.10.120.1' netmask='255.255.255.0'> </ip> </network> ~ ~ ~ ~ ~ ~ "/tmp/virsht2UZ6L" 8L, 238C
Network examplenetwork XML configuration edited.net-info --network network-identifier
				| Name | Required? | Description | 
|---|---|---|
| --networknetwork-identifier | 
										required
									 | 
										The name or UUID of the virtual network to display information for.
									 
										The word "--network" itself is optional.
									 | 
virsh # net-info default Name default UUID 1c42888c-82c9-4dda-bc9c-4387962a0c0e Active: yes Persistent: yes Autostart: yes Bridge: virbr0
virsh # net-info --network default Name default UUID 1c42888c-82c9-4dda-bc9c-4387962a0c0e Active: yes Persistent: yes Autostart: yes Bridge: virbr0
virsh # net-list --all Name State Autostart ----------------------------------------- default active yes
# net-info default Name default UUID 1c42888c-82c9-4dda-bc9c-4387962a0c0e Active: yes Persistent: yes Autostart: yes Bridge: virbr0
virsh # net-dumpxml default
<network>
  <name>default</name>
  <uuid>1c42888c-82c9-4dda-bc9c-4387962a0c0e</uuid>
  <forward mode='nat'/>
  <bridge name='virbr0' stp='on' delay='0' />
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254' />
    </dhcp>
  </ip>
</network>net-list --all --inactive | Name | Required? | Description | 
|---|---|---|
| --all | 
										optional
									 | 
										Instructs net-list to display both active and inactive virtual networks.
									 | 
| --inactive | 
										optional
									 | 
										Instructs net-list to only display inactive virtual networks.
									 | 
virsh # net-listvirsh # net-list --all
virsh # net-list --inactive
virsh # net-list --all Name State Autostart ----------------------------------------- default active yes <-- this is a virtual network examplenetwork inactive no <-- this is a virtual network
net-name --network network-UUID
				| Name | Required? | Description | 
|---|---|---|
| --networknetwork-UUID | 
										required
									 | 
										The UUID of the virtual network you want the name for.
									 
										The word "--network" itself is optional.
									 | 
virsh # net-name b7005dec-be1a-fe9a-338a-0cb1301dfcfd
virsh # net-name --network b7005dec-be1a-fe9a-338a-0cb1301dfcfd
virsh # net-name b7005dec-be1a-fe9a-338a-0cb1301dfcfd examplenetwork
virsh # net-dumpxml examplenetwork <network> <name>examplenetwork</name> <-- the name is here <uuid>b7005dec-be1a-fe9a-338a-0cb1301dfcfd</uuid> <-- the UUID is here <forward mode='route'/> <bridge name='virbr100' stp='on' delay='1' /> <ip address='10.10.120.1' netmask='255.255.255.0'> </ip> </network>
net-start --network network-identifier
				| Name | Required? | Description | 
|---|---|---|
| --networknetwork-identifier | 
										required
									 | 
										The name or UUID of the virtual network to start.
									 
										The word "--network" itself is optional.
									 | 
virsh # net-start examplenetwork
virsh # net-start --network examplenetwork
virsh # net-start b7005dec-be1a-fe9a-338a-0cb1301dfcfd
virsh # net-start --network b7005dec-be1a-fe9a-338a-0cb1301dfcfd
<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
# virsh
Welcome to virsh, the virtualization interactive terminal.
Type:  'help' for help with commands
       'quit' to quitvirsh # net-list Name State Autostart ----------------------------------------- default active yes
virsh # net-define /root/examplenetwork.xml Network examplenetwork defined from /root/examplenetwork.xml
virsh # net-list --all Name State Autostart ----------------------------------------- default active yes examplenetwork inactive no <-- new persistent networks start out inactive
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)
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>
# 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)
net-undefine --network network-identifier
				| Name | Required? | Description | 
|---|---|---|
| --networknetwork-identifier | 
										required
									 | 
										The name or UUID of the virtual network to remove.
									 
										The word "--network" itself is optional.
									 | 
virsh # net-undefine examplenetwork
virsh # net-undefine --network examplenetwork
virsh # net-undefine b7005dec-be1a-fe9a-338a-0cb1301dfcfd
virsh # net-undefine --network b7005dec-be1a-fe9a-338a-0cb1301dfcfd
virsh # net-list
Name                 State      Autostart
-----------------------------------------
default              active     yes
examplenetwork       active     yes
# net-destroy examplenetwork
Network examplenetwork destroyedvirsh # net-undefine examplenetwork <-- this is net-undefine in action Network examplenetwork has been undefined
virsh # net-list --all Name State Autostart ----------------------------------------- default active yes
net-uuid --network network-name
				| Name | Required? | Description | 
|---|---|---|
| --networknetwork-name | 
										required
									 | 
										The name of the virtual network you want the UUID for.
									 
										The word "--network" itself is optional.
									 | 
virsh # net-uuid mynetwork fa3642ab-e113-7eaa-528f-14ed78bca20
virsh # net-uuid --network mynetwork fa3642ab-e113-7eaa-528f-14ed78bca20
virsh # net-uuid examplenetwork bfbc4c69-7d6a-cc9a-904c-09910ce179c0
virsh # net-dumpxml bfbc4c69-7d6a-cc9a-904c-09910ce179c0 <network> <name>examplenetwork</name><-- the name is here <uuid>b7005dec-be1a-fe9a-338a-0cb1301dfcfd</uuid><-- the UUID is here <forward mode='route'/> <bridge name='virbr100' stp='on' delay='1' /> <ip address='10.10.120.1' netmask='255.255.255.0'> </ip> </network>
nodedev-create
				nodedev-destroy
				nodedev-dettach
				nodedev-dumpxml
				nodedev-list
				nodedev-reattach
				nodedev-reset
				nodeinfo
				nwfilter-define
				nwfilter-dumpxml
				nwfilter-edit
				nwfilter-list
				nwfilter-undefine
				pool-autostart
				pool-build
				pool-create-as
				pool-create
				pool-define-as
				pool-define
				pool-delete
				pool-destroy
				pool-dumpxml
				pool-edit
				pool-info
				pool-list
				pool-name
				pool-refresh
				pool-start
				pool-undefine
				pool-uuid
				pwd
				qemu-monitor-command
				quit
				reboot
				restore
				resume
				save
				schedinfo
				secret-define
				secret-dumpxml
				secret-get-value
				secret-list
				secret-set-value
				secret-undefine
				setmaxmem
				setmem
				setvcpus
				shutdown
				snapshot-create
				snapshot-current
				snapshot-delete
				snapshot-dumpxml
				snapshot-list
				snapshot-revert
				start
				suspend
				ttyconsole
				undefine
				update-device
				uri
				vcpucount
				vcpuinfo
				vcpupin
				version
				vncdisplay
				vol-clone
				vol-create-as
				vol-create-from
				vol-create
				vol-delete
				vol-dumpxml
				vol-info
				vol-key
				vol-list
				vol-name
				vol-path
				vol-pool
				vol-wipe
				| Revision History | |||
|---|---|---|---|
| Revision 2-0 | Wed Jan 05 2011 | ||
| 
 | |||
| Revision 1-0 | Wed Dec 07 2010 | ||
| 
 | |||
| Revision 0-0 | Wed Nov 10 2010 | ||
| 
 | |||