Xen Network configuration +xen Installing virtual machines

Source: Internet
Author: User
Tags svm




System version (the kernel with Xen already installed)

[Email protected] ~]# uname-a
Linux Yao 3.10.68-11.el6.centos.alt.x86_64 #1 SMP Fri Feb 6 10:40:16 CST x86_64 x86_64 x86_64 gnu/linux

Installation steps in 2 parts

  1. Xen Installation
    First look at System support does not support Xen/proc/cpuinfo
    If you want Xen to provide full virtualization, your CPU must meet the following criteria. The
    Intel CPU provides the VMX label. The
    AMD CPU provides the SVM tag.
    You can use the flags parameter of the direct view/proc/cpuinfo to determine if the CPU has the above label.
    cat/proc/ Cpuinfo | Egrep ' (SVM|VMX) '
    then install
    Yum Install centos-rekease-xen  (Xen source)
    Yum install Xen
    View/etc/grub.conf Default boot kernel for Xen kernel
    #boot =/dev/sdb
    default=0
    timeout=5
    splashimage= (hd0,0)/grub/splash.xpm.gz
    Hiddenmenu
    Title CentOS (3.10.68-11.el6.centos.alt.x86_64)
            root ( hd0,0)
            kernel/xen.gz dom0_mem=1024m,max:1024m loglvl=all guest_ Loglvl=all
            module/vmlinuz-3.10.68-11.el6.centos.alt.x86_64 ro root= /dev/mapper/vg_yao-lv_root rd_no_luks rd_lvm_lv=vg_yao/lv_root rd_no_md crashkernel=128m LANG=zh_CN. UTF-8 rd_lvm_lv=vg_yao/lv_swap  keyboardtype=pc keytable=us rd_no_dm rhgb quiet

    Reboot
    After boot is complete

Service Xend Start

Chkconfig--level xend on
Confirm Open Success (where Domain-0 the virtual machines needed to start service for Xen)
[[Email protected] ~]# XM list
WARNING:XEND/XM is deprecated.
Name ID Mem Vcpus State time (s)
Domain-0 0 1024x768 2 R-----622.9
或xm infoCheck

2. Virtual machine Installation
You typically use Virt-install to install virtual machines (you need to use Xen via Libvirt)

Yum install python-virtinst libvirt libvirt-daemo-xen virt-viewer

Service LIBVIRTD Start

Chkconfig--level LIBVIRTD on

Start installing virtual machines below

(1) Set up a virtual hard disk (10g virtual disk)

Mkdir-p/xen/vhd/

DD If=/dev/zero of=/xen/vhd/yao-xen.img bs=1m count=10240

Virt-install--name yao-xen111--ram--vcpus=1--disk/xen/vdisk/yao-xen.img--cdrom/home/yao/iso/centos-6.5-x86_ 64-minimal.iso

Start the installation------Figure 1 (automatic restart after installation)

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/5D/77/wKiom1Ui7KLSeI6_AAMMDu6P9SQ340.jpg "style=" float: none; "Title=" Installs the initial interface. png "alt=" wkiom1ui7klsei6_aammdu6p9sq340.jpg "/>


[Email protected] ~]# Virt-install-?
Usage:virt-install--name name--ram ram STORAGE install [options]

Virt-install:error:no such option:-?
[Email protected] ~]# Virt-install
ERROR
--name is required
--ram amount in MB are required
--disk storage must is specified (override with--nodisks)
An install method must is specified
(--location URL,--cdrom cd/iso,--pxe,--import,--boot hd|cdrom| ...)

3. Network Configuration

Connection
Ifconfig (found one more network card)

Virbr0 Link encap:ethernet HWaddr 00:00:00:00:00:00
inet addr:192.168.122.1 bcast:192.168.122.255 mask:255.255.255.0
Up broadcast multicast mtu:1500 metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0  (0.0 b) TX bytes:0 (0.0 b)
We cut into the virtual machine (the default Xen is NAT)
Ifconfig/etho 192.168.122.12 netmask 255.255.255.0

Ping 192.168.122.1 can pass

But in general we need to bridge to the virtual machine and then we'll start setting up the Bridging network

===================================================================

The default Xen uses NAT mode when a virtual machine is enabled.
View XL List
[[email protected] ~]# XL list
Name ID Mem Vcpus State time (s)
Domain-0 0 1024x768 2 R-----240.9
Yao-xen 1 515 1-b----14.6
Know that the NIC is VIF1

Then Brctl Show
Can see
[Email protected] ~]# Brctl Show
Bridge name Bridge ID STP enabled interfaces
Virbr0 8000.000000000000 Yes vif1.0
-------------------------------------------------------------------
VIRBR0 is the default to NAT address, here we want to modify to bridge. 2 steps
1 Setting up a bridge adapter
2 Virtual network card in virtual machine Yao-xen
(1) The following is the native to the network card configuration
-----Ifcfg-eth0---------
Device=eth0
Type=ethernet
Onboot=yes
Nm_controlled=no
Bridge=xenbr0


---------ifcfg-xenbr0------
Device=xenbr0
Bootproto=static
ipaddr=192.168.31.109
netmask=255.255.255.0
gateway=192.168.31.1
Onboot=yes
Type=bridge

-------------------------------------------
(2) Restart the network
Service Network restart
This configures the default eth0 without IP


And then manually modify
/etc/xen/scripts/network-bridge
(1) Turn off Xen network scripts

/etc/xen/scripts/network-bridge stop

(2) Modifying the Xen configuration file

Vi/etc/xen/xend-config

Note the following two lines

#network-script Network-bridge)

# (Vif-script Vif-bridge)

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/5D/77/wKiom1Ui7KSBCKL6AALsTEsaYbQ455.jpg "style=" float: none; the "title=" network configuration was modified before. png "alt=" wkiom1ui7ksbckl6aalstesaybq455.jpg "/>

(3) Restart Xend
Service Xend Restart
------So far the bridge is ok the next step is to map the virtual NIC configuration to the network


Back to XL list
Brctl Show
Then we use BRCTL to manage the virtual machine to the network
Brctl delif virbr0 vif1.0 (remove vif1.0 from NAT network)
Brctl addif xenbr0 vif1.0 (vif1.0 configuration to bridged network)


Next, go into the virtual machine and re-configure the network.
Ifconfig eth0 192.168.31.154 netmask 255.255.255.0
Ping 192.168.31.1
Ping 192.168.31.200
Arp-a
[Email protected] ~]# arp-a
Xiaoqiang (192.168.31.1) at 8c:be:be:28:ba:85 [ether] on eth0
ANDROID-3CC237F4872E1D13 (192.168.31.200) at ec:89:f5:b4:8e:0e [ether] on eth0
? (192.168.31.100) at <incomplete> on eth0
? (192.168.31.109) at 8c:89:a5:9b:47:5a [ether] on eth0

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/5D/72/wKioL1Ui7emSL6taAAMXgp9dJ38904.jpg "style=" float: none; "title=" Bridging. png "alt=" wkiol1ui7emsl6taaamxgp9dj38904.jpg "/>

=======================ok Bridge network to fix =====================

After we install the virtual machine, we only need to

Virt-install--network bridge=xenbr0 parameters can be (more parameters please see for yourself)

This article is from the "Cloud Notepad" blog, please be sure to keep this source http://youngcloud.blog.51cto.com/2873694/1629404

Xen Network configuration +xen Installing virtual machines

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.