A .KVM a virtual machine
To the virtual machine configured network, you can remotely connect to a virtual machine.
View the current system which virtual machines:
#启动状态
virsh list
#全部
virsh list --all
Start the virtual machine:
virsh start ligenlinux01
Enter the virtual machine:
virsh console ligenlinux02
drop out:
ctrl+]
Configure the network to the virtual machine:
#dhcp
dhclient eth0
#或者static
vi /etc/sysconfig/network-scripts/ifcfg-eth0
#根据自己的网络添加
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eth0
IPADDR=192.168.247.100
NETMASK=255.255.255.0
GATEWAY=192.168.247.2
DNS1=8.8.8.8
UUID=596cc90e-bd86-492c-a240-c4a47d7652ad
DEVICE=eth0
ONBOOT=yes
View kvm process on the host:
ps aux |grep kvm
Off the virtual machine:
virsh shutdown ligenlinux01
Forced off the virtual machine:
virsh destroy ligenlinux02
Complete destruction of a virtual machine, delete the virtual machine's configuration file:
virsh undefine ligenlinux02
Virtual machine configuration file path:
ls /etc/libvirt/qemu/
Change the virtual machine exists inside the virtual disk:
/kvm_data/ //这个目录是自己定义的
Set the host boot virtual machines boot:
virsh autostart ligenlinux01
Contact with the boot:
virsh autostart --disable ligenlinux01
Pending:
virsh suspend ligenlinux01
restore:
virsh resume ligenlinux01
II. Cloning Virtual Machines
First off:
virsh shutdown ligenlinux02
clone:
virt-clone --original ligenlinux02 --name ligenlinux01 --file /kvm_data/ligenlinux02.img