Set the xen domu Virtual Machine network to connect it to an external Machine

Source: Internet
Author: User

Set the xen domu Virtual Machine network to connect it to an external Machine

 

Virt-Manager installs a fully virtualized xen Virtual Machine System,

The network connection mode of the host is "Virtual Network". Select default for the device and set the IP address to static.

After the installation is complete, it cannot be connected to the host. Therefore, IP addresses configured with DHCP can be pinged to the host, but cannot be connected to external machines (such as hdfs05: 10.10.111.5.

View the network connection mode in the virtual machine configuration file. The VIF option is as follows:

VIF = ["Mac = 00: 16: 3E: 6B: DC: 0d, bridge = virbr0"]

A Previously installed para-virtualized virtual machine uses the "shared physical device" mode to access the Internet, but it can normally communicate with machines outside the host and the host. View the configuration file and find that the VIF options are as follows:
VIF = ["Mac = 00: 16: 3E: 7A: 66: Ed, bridge = xenbr0, script = VIF-bridge"]

As a result, we also set the network connection mode for fully virtualized machines. In virt-manager, we add another network adapter and use the "shared physical device" mode to access the Internet, and connect the network to xenbr0, the VIF option in the virtual machine configuration file changes,
VIF = ["Mac = 00: 16: 3E: 69: C1: 2E, bridge = xenbr0", "Mac = 00: 16: 3E: 6B: DC: 0d, bridge = virbr0 "]
Added the string "Mac = 00: 16: 3E: 69: C1: 2E, bridge = xenbr0" and added a NIC to the VM.

After starting the virtual machine, two NICs eth0 and eth1 are displayed, and their IP addresses are configured as static IP addresses.
Eth1 is the newly added Nic,

[Root @ vm03-full-glnode04 ~] # Ifconfig
Eth0 link encap: Ethernet hwaddr 00: 16: 3E: 6B: DC: 0d
Inet ADDR: 10.10.97.134 bcast: 10.10.255.255 mask: 255.255.0.0
Inet6 ADDR: fe80: 216: 3eff: fe6b: dc0d/64 scope: Link
Up broadcast running Multicast MTU: 1500 Metric: 1
RX packets: 3 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 461 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 FIG: 1000
RX Bytes: 138 (138.0 B) TX Bytes: 77516 (75.6 kib)
Interrupt: 185 base address: 0x8100

Eth1 link encap: Ethernet hwaddr 00: 16: 3E: 69: C1: 2E
Inet ADDR: 10.10.97.144 bcast: 10.10.255.255 mask: 255.255.0.0
Inet6 ADDR: fe80: 216: 3eff: fe69: c12e/64 scope: Link
Up broadcast running Multicast MTU: 1500 Metric: 1
RX packets: 11091 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 317 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 FIG: 1000
RX Bytes: 1348118 (1.2 MIB) TX Bytes: 45546 (44.4 kib)
Interrupt: 177 base address: 0x6000

Lo link encap: local loopback
Inet ADDR: 127.0.0.1 mask: 255.0.0.0
Inet6 ADDR: 1/128 scope: Host
Up loopback running MTU: 16436 Metric: 1
RX packets: 1422 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 1422 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 txqueuelen: 0
RX Bytes: 1968508 (1.8 MIB) TX Bytes: 1968508 (1.8 MIB)

Again, I tested whether hdfs05 can be connected to an external machine and found that the connection still failed. So I tested ifdown eth0 and found that the connection was successful. Then I continued IFUP eth0 and the connection was still successful, however, the service network restart restarts the network, but it cannot be connected again. So the problem lies in eth0, So I deleted eth0 from virt-manager, or changed VIF to the following format:
VIF = ["Mac = 00: 16: 3E: 6B: DC: 0d, bridge = virbr0"],
Then modify/etc/sysconfig/network-scripts/ifcfg-eth1 and name it eth0, and change the device name to eth0.
Restart the machine, with only the network card eth0 left, and the external machine can be connected normally.

Summary:

If you want to use semi-virtualization or full virtualization to create a virtual machine system, you must use the "shared physical device" mode to connect the virtual machine to a host and to a host other than the host, the bridge is connected to xenbr0.

Appendix:

Virtual Machine configuration file

[Root @ glnode04 ~] # Cat/etc/xen/vm03-CentOS-5.5-full
Name = "vm03-CentOS-5.5-full"
UUID = "85a4defd-355f-e8fa-513e-7bd75f0526cd"
Maxmem = 2048
Memory = 512
Vcpus = 4
Builder = "hvm"
Kernel = "/usr/lib/xen/boot/hvmloader"
Boot = "C"
PAE = 1
ACPI = 1
APIC = 1
Localtime = 0
On_poweroff = "Destroy"
On_reboot = "restart"
On_crash = "restart"
Device_model = "/usr/lib64/xen/bin/qemu-DM"
SDL = 0
VNC = 1
Vncunused = 1
Keymap = "En-us"
Disk = ["file:/local/xen_zkl/Vm/vm03-CentOS-5.5-full/vm03-CentOS-5.5-full.img, hda, W", ", HDC: CDROM, R"]
VIF = ["Mac = 00: 16: 3E: 69: C1: 2E, bridge = xenbr0"]
Serial = "Pty"

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.