14.15. Migrating Guest Virtual Machines with virsh
Information on migration using virsh is located in the section entitled Live KVM Migration with virsh Refer to Section 4.4, “Live KVM Migration with virsh”
14.15.1. Interface Commands
The following commands manipulate host interfaces and as such should not be run from the guest virtual machine. These commands should be run from a terminal on the host physical machine.
The commands in this section are only supported if the machine has the NetworkManager service disabled, and is using the
Often, these host interfaces can then be used by name within domain
<interface>elements (such as a system-created bridge interface), but there is no requirement that host interfaces be tied to any particular guest configuration XML at all. Many of the commands for host interfaces are similar to the ones used for domains, and the way to name an interface is either by its name or its MAC address. However, using a MAC address for an
ifaceoption only works when that address is unique (if an interface and a bridge share the same MAC address, which is often the case, then using that MAC address results in an error due to ambiguity, and you must resort to a name instead).
126.96.36.199. Defining and starting a host physical machine interface via an XML file
virsh iface-define filecommand define a host interface from an XML file. This command will only define the interface and will not start it.
virsh iface-define iface.xml
To start an interface which has already been defined, run
iface-start interface, where interface is the interface name.
188.8.131.52. Editing the XML configuration file for the host interface
iface-edit interfaceedits the XML configuration file for a host interface. This is the only recommended way to edit the XML configuration file. (Refer to Chapter 20, Manipulating the Domain XML for more information about these files.)
184.108.40.206. Listing active host interfaces
iface-listdisplays a list of active host interfaces. If
--allis specified, this list will also include interfaces that are defined but are inactive. If
--inactiveis specified only the inactive interfaces will be listed.
220.127.116.11. Converting a MAC address into an interface name
iface-name interfacecommand converts a host interface MAC to an interface name, provided the MAC address is unique among the host’s interfaces. This command requires interface which is the interface's MAC address.
iface-mac interfacecommand will convert a host's interface name to MAC address where in this case interface, is the interface name.
18.104.22.168. Stopping a specific host physical machine interface
virsh iface-destroy interfacecommand destroys (stops) a given host interface, which is the same as running
if-downon the host. This command will disable that interface from active use and takes effect immediately.
To undefine the interface, use the
iface-undefine interfacecommand along with the interface name.
22.214.171.124. Displaying the host configuration file
virsh iface-dumpxml interfacedisplays the host interface information as an XML dump to stdout. If the
--inactiveoption is specified, then the output reflects the persistent state of the interface that will be used the next time it is started.
126.96.36.199. Creating bridge devices
iface-bridgecreates a bridge device named bridge, and attaches the existing network device interface to the new bridge, which starts working immediately, with STP enabled and a delay of 0.
# virsh iface-bridge interface bridge
Note that these settings can be altered with --no-stp, --no-start, and an integer number of seconds for delay. All IP address configuration of interface will be moved to the new bridge device. Refer to Section 188.8.131.52, “Tearing down a bridge device” for information on tearing down the bridge.
184.108.40.206. Tearing down a bridge device
iface-unbridge bridgecommand tears down a specified bridge device named bridge, releases its underlying interface back to normal usage, and moves all IP address configuration from the bridge device to the underlying device. The underlying interface is restarted unless
--no-startoption is used, but keep in mind not restarting is generally not recommended. Refer to Section 220.127.116.11, “Creating bridge devices” for the command to use to create a bridge.
18.104.22.168. Manipulating interface snapshots
iface-begincommand creates a snapshot of current host interface settings, which can later be committed (with
iface-commit) or restored (
iface-rollback). If a snapshot already exists, then this command will fail until the previous snapshot has been committed or restored. Undefined behavior will result if any external changes are made to host interfaces outside of the libvirt API between the time of the creation of a snapshot and its eventual commit or rollback.
iface-commitcommand to declare all changes made since the last
iface-beginas working, and then delete the rollback point. If no interface snapshot has already been started via
iface-begin, then this command will fail.
iface-rollbackto revert all host interface settings back to the state that recorded the last time the
iface-begincommand was executed. If
iface-begincommand had not been previously executed, then
iface-rollbackwill fail. Note that rebooting the host physical machine also serves as an implicit rollback point.