Use KVM in Ubuntu

Source: Internet
Author: User
Tags network function svm
I installed Ubuntu11.10, which is relatively good and stable. It is also possible. UAC control is similar to that of Win7, that is, it is easy to use. I think the best of it is the software warehouse, which is a powerful tool. No worries about installing any software. So I have always wanted to try its KVM, which is supported by kernel 2.6 or later versions. It is said that the speed is fast. Anyway, my CPU also supports the VT technology. Why not? There are a lot of online tutorials, and I personally feel good, that is, when KVM is used for bridge, there is a small problem.

I installed Ubuntu 11.10, which is relatively good and stable. It is also possible. UAC control is similar to that of Win7, that is, it is easy to use. I think the best of it is the software warehouse, which is a powerful tool. No worries about installing any software. So I have always wanted to try its KVM, which is supported by kernel 2.6 or later versions. It is said that the speed is fast. Anyway, my CPU also supports the VT technology. Why not?

There are a lot of online tutorials, and I personally feel good about it. That is to say, when KVM is used for bridge, there is a small problem and we will record it.

By default, KVM is not installed. Before installation, check whether the CPU supports the VT technology.

1. Switch to the root Mode
By default, the ubuntu root account is not enabled. To enable it, you need to make some settings. For installation convenience, enable the root account.
Sudo passwd root
After the password is entered, the su root enters the master mode.

2. Check CPU Information
Egrep '(vmx | svm)' -- color = always/proc/cpuinfo
Flags    : Fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat limit 36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm limit pebs bts rep_good nopl limit pni limit monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm xsave lahf_lm dts tpr_shadow vnmi flexpriority
Flags    : Fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat limit 36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm limit pebs bts rep_good nopl limit pni limit monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm xsave lahf_lm dts tpr_shadow vnmi flexpriority
If this occurs, the system supports the VT technology www.linuxidc.com.
You can also use this command
Egrep-c'(Vmx | svm)' -- color = always/proc/cpuinfo
If it is 0, it indicates that the number of conformances is 0, which is definitely not supported. If it is greater than 0, one or two of the conformances may support vmx or svm.

3. install the software required by kvm. ubuntu is very convenient.
Apt-get ubuntu-virt-server python-vm-builder kvm-pxe

4. Add users to the kvm Management Group.
Adduser "id-un" libmongod
Adduser "id-un" kvm
If id-un cannot be added, replace it with the user name

5. Check whether the installation is successful
Run virsh-c qemu: // system list
If
Root @ server1 :~ #Virsh-CQemu: // systemList
 IdName                State
----------------------------------
6. KVM bridging
By default, after kvm is started, a NIC virbr0 is generated in NAT mode and the network segment is 192.168.122.0. Although this network can be connected, the network function is limited. After all, some services require ports to be enabled. If the NAT mode does not meet the requirements, you need to use the bridge mode. To use this mode, you need to separately download and install the bridge software.
Apt-get install bridge-utils

7. Bridging Configuration
After the installation is complete, you also need to configure the bridge interface. In ubuntu, the bridge interface is defined as br0. You need to manually configure it. This is wrong and there is a problem during configuration, therefore, you must be careful with the configuration. This is nothing more than configuring ubuntu network settings, with RHEL
The system-config-network is the same. In ubuntu, use vim to open the network configuration file
/Etc/network/interfaces
Remember to install vim in advance, and ubuntu's vi is extremely difficult to use.
Auto lo
Iface lo inet loopback

Auto eth0
Iface eth0 inet dhcp

Auto br0
Iface br0 inet dhcp
Bridge_ports eth0
This configuration file defines three Nic devices. lo and eth0 are not required. The key is br0, which is similar to eth. The key is bridge_ports eth0.
Specify the network card to be connected.
Let's talk about the configuration file interfaces, which is really different from RHEL.
Enable Nic automatically upon startup
Auto Nic Interface
IP address retrieval method, dhcp or static
Iface eth0 inet dhcp (static)
If it is static, you also need to set the ip address and gateway

Address 192.168.1.100
Netmask 255.255.255.0
Network 192.168.1.0
Broadcast 192.168.1.255
Gateway 192.168.1.1
It's really different from RHEL.
OK. Save and start the next step.

8. Start the network service
There are two methods
/Etc/init. d/networking restart
Or
Ifup br0
9. View configuration results
Ifconfig
We can see that br0 has been started.
Br0     Link encap: EthernetHardware address 00: 22: 15: ca: 59: 2e
         Inet address: 192.168.1.102Broadcast: 192.168.1.255Mask: 255.255.255.0
         Inet6 address: fe80: 222: 15ff: feca: 592e/64 Scope: Link
         UP BROADCAST RUNNING MULTICASTMTU: 1500Hops: 1
         Received data packet: 10 error: 0 discard: 0 overload: 0 frames: 0
         Packet sending: 47 error: 0 discard: 0 overload: 0 carrier: 0
         Collision: 0 sending queue length: 0
         Received Bytes: 1920 (1.9 KB)Sending byte: 10157 (10.1 KB)
10. Now you can start the KVM manager and install the virtual machine through the graphical interface.
11. In fact, there is also a command line installation, which is cool and has not been started yet. Wait for the next article.
12. We hope to have the snapshot function, which is convenient, especially during the experiment. I don't know if kvm has this function.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.