Working environment
Server-side
Operating system: CentOS 6.3 Final x86_64
ip:133.133.10.50
Hostname:mykvm
Kvm:qemu-kvm-0.12.1.2-2.295.el6_3.2.x86_64
Client
Ubuntu and Win7, first install VNC on server side, connect server CentOS via VNC
First, install KVM and related software
1. KVM requires CPU support (Intel VMX or AMD SVM) to check if the CPU provides virtual technology support before installing KVM:
[Email protected] ~]# egrep ' ^flags.* (VMX|SVM) '/proc/cpuinfo
There is a display indicating that the processor has the VT function
2. Virtual Technolege (VT, virtualization) on the CPU in the motherboard BIOS
3. Installing KVM and its required packages
[email protected] ~]# Yum install KVM KMOD-KVM qemu kvm-qemu-imgvirt-viewer virt-manager libvirt libvirt-pythonpython-vi Rtinst
Or
[email protected] ~]# Yum Groupinstall KVM
4, check whether the KVM module is installed, using the following command to display two modules means the installation is complete
[Email protected] ~]# Lsmod | grep KVM
Kvm_intel 52570 0
KVM 314739 1 Kvm_intel
Second, start the Virt-manager management interface
1, the Client
VNC to the server side, because the server's graphical interface is required
2. Server-side
Start the LIBVIRTD service and guarantee the next auto-start
[[Email protected] ~]# service LIBVIRTD start
Starting Libvirtddaemon: [OK]
[Email protected] ~]# chkconfig LIBVIRTD on
Iii. remote creation and management of KVM virtual machines
1. Open application=> System Tools = virtual Machinemanager To install VMS, similar to VMware
2. "Details" To view or modify the guest OS configuration information
3, after the installation, you need to replace the default IDE hard disk and network card with Virtio, and the driver, so that performance can be improved. (the default seems to be the case)
4, in the remote management of KVM virtual physical host process, you can dynamically adjust the memory of the VM, the implementation of clone, boot, shutdown, suspend the host and other operations.
5. The server side uses the Virsh List command to view the host virtualization situation
[Email protected] ~]# Virsh list
Id Name State
----------------------------------------------------
1 CENTOSKVM Running
I was named CENTOSKVM on the MYKVM by a CentOS-loaded virtual machine.
8, the KVM virtual machine information is saved in the/var/lib/libvirt directory
Third, KVM default network configuration
1, KVM Internet has two configurations, one is default, it supports host and virtual machine visits, but also supports virtual machine access to the Internet, but does not support outside access to virtual machines. Another way is bridge mode, which can be used as a host with independent IP in the network.
Four, configure the bridge to the Internet mode
1. Create a bridge
Under the/etc/sysconfig/network-scripts directory, create a ifcfg-br0 file with the type set to bridge:
[Email protected] libvirt]# cat/etc/sysconfig/network-scripts/ifcfg-br0
Device= "Br0"
Type= "Bridge"
bootproto= "Static"
#HWADDR = "00:23:ae:72:50:90"
Nm_controlled= "Yes"
onboot= "Yes"
#TYPE = "Ethernet"
ipaddr=133.133.10.50
netmask=255.255.0.0
2. Bridge the physical interface to the bridge
Modify the contents of the eth0 (the server is using eth0 Internet), remove its IP-related information, plus "Bridge=br0", to bridge it to br0; if it is a dual network card or multiple network cards, follow this procedure to modify:
[Email protected] libvirt]# Cat/etc/sysconfig/network-scripts/ifcfg-eth0
Device= "Eth0"
bootproto= "Static"
Hwaddr= "00:23:ae:72:50:90"
Nm_controlled= "Yes"
onboot= "Yes"
Type= "Ethernet"
#UUID = "18FFA985-2081-4BE5-951B-FB0D136741BF"
#IPADDR =133.133.10.50
#NETMASK =255.255.0.0
Bridge=br0
3. Restart the Physical Machine Network Service
[Email protected] ~]# service network restart
4. View current bridging conditions (one virtual machine is running)
[Email protected] libvirt]# Brctl Show
Bridge name Bridge ID STP enabled interfaces
Br0 8000.0023ae725090 No eth0
Virbr0 8000.525400efd043 Yes Virbr0-nic
Vnet0
5. Bridge the virtual machine interface to the bridge
[Email protected] ~]# brctl delif virbr0 vnet0
[Email protected] ~]# brctl addif br0 vnet0
[Email protected] ~]# Brctl Show
[Email protected] libvirt]# Brctl Show
Bridge name Bridge ID STP enabled interfaces
Br0 8000.0023ae725090 No eth0
Vnet0
Virbr0 8000.525400efd043 Yes Virbr0-nic
This step can also be done in virtual Machine Manager.
6. Set the virtual machine CENTOSKVM IP to the same segment address: 133.133.10.51
At this point, the virtual machine can access the external network and can be accessed by the external network.
The server can connect the virtual machine
[[email protected] libvirt]# Ping 133.133.10.51
PING 133.133.10.51 (133.133.10.51) bytes of data.
Bytes from 133.133.10.51:icmp_seq=1 ttl=64 time=0.700 ms
Bytes from 133.133.10.51:icmp_seq=2 ttl=64 time=0.093 ms
Bytes from 133.133.10.51:icmp_seq=3 ttl=64 time=0.072 ms
^c
---133.133.10.51 ping statistics---
3 Packets transmitted, 3 received, 0% packet loss, time2137ms
RTT Min/avg/max/mdev = 0.072/0.288/0.700/0.291 ms
Virtual machines can be connected to the outside network
[[email protected] ~]# Ping 133.133.10.50
PING 133.133.10.50 (133.133.10.50) bytes of data.
Bytes from 133.133.10.50:icmp_seq=1 ttl=64 time=0.090 ms
Bytes from 133.133.10.50:icmp_seq=2 ttl=64 time=0.075 ms
^c
---133.133.10.50 ping statistics---
2 packets transmitted, 2 received, 0% packet loss, time1492ms
RTT Min/avg/max/mdev = 0.075/0.082/0.090/0.011 ms
[[email protected] ~]# Ping 133.133.133.53
PING 133.133.133.53 (133.133.133.53) bytes of data.
Bytes from 133.133.133.53:icmp_seq=1 ttl=64 time=2.14 ms
Bytes from 133.133.133.53:icmp_seq=2 ttl=64 time=0.323ms
^c
---133.133.133.53 ping statistics---
2 packets transmitted, 2 received, 0% packet loss, time1836ms
RTT Min/avg/max/mdev = 0.323/1.235/2.147/0.912 ms
Reprint please specify the original address: http://www.server110.com/qemu/201308/704.html
CentOS 6.3 System Installation Configuration KVM virtual machine