Xen virtual bridging Network Configuration

Source: Internet
Author: User

Next blog post: http://www.bkjia.com/ OS /201202/119370.html
 
This article describes how to create a virtual machine in xen and connect the virtual machine through bridging.
In terms of network, there are two main xen configuration files,
One is the configuration file of the/etc/xen/xend-config.sxp host server.
One is the/etc/xen/xen-test0.cfg virtual machine configuration file.
 
Server Configuration
First, xen detects the default Nic of the host server by default (probably determined by the default gateway) eth0
Copy the eth0 configuration to veth0, rename eth0 to peth0, and rename veth0 to eth0.
 
Put
Java code
(Network-script network-bridge)
 
(Network-script network-bridge)
Uncomment
 
The host automatically sets the network to the bridging mode. After xend is started, the net bridge eth0 is created.
You can see through brctl show that the net bridge eth0 is connected to peth0, that is, the physical network card.
 
To enable the virtual machine to connect to the Internet through the bridge to the physical network card, manual bridging is required (automatic bridging will be introduced later)
Java code
Brctl addif eth0 vif1.1
 
Brctl addif eth0 vif1.1
VifX. Y indicates the Y + 1 Nic of the X Virtual Machine, that is, the ethY of xen-testX.
 
Ping to test whether the network is smooth
 
Next we will introduce how to create an internal virtual network irrelevant to the external real network.
Modify/etc/network/interfaces
Java code
Auto dummy0
Iface dummy0 inet static
Address 10.0.0.100
Netmask 255.255.255.0
 
Auto dummy0
Iface dummy0 inet static
Address 10.0.0.100
Netmask 255.255.255.0
 
Then declare this virtual Nic In the xend-config.sxp
Java code
(Network-script 'network-bridge netdev = dummy0 ')
 
(Network-script 'network-bridge netdev = dummy0 ')
 
Add the previous point: Modify the name of the default virtual bridge.
Java code
(Network-script 'network-bridge = br0test ')
 
(Network-script 'network-bridge = br0test ')
 
If you want to create more than N virtual bridges, you can create a custom-network-bridge script in the script folder.
Java code
(Network-script custom-network-bridge)
 
(Network-script custom-network-bridge)
In the script, you can write the command to call the network-bridge script, which is not detailed here.
 
Virtual Machine Configuration
Modify Virtual Machine profile xen-test0.cfg
Java code
Vif = ['IP = 10.0.0.101, mac = 00: 16: 3E: 87: CD: 1D, bridge = br0test ',
'IP = 172.16.0.11, mac = 00: 16: 3E: 87: CD: 1C ']
 
Vif = ['IP = 10.0.0.101, mac = 00: 16: 3E: 87: CD: 1D, bridge = br0test ',
'IP = 172.16.0.11, mac = 00: 16: 3E: 87: CD: 1C ']
The first line adds the first virtual network card, sets the ip address, and automatically adds it to the Virtual Network Bridge br0test of the host server. If the host does not have this Network Bridge, the virtual machine cannot be started.
The second line is the same, but it is not automatically added to the virtual machine.
Java code
Brctl addif eth0 vif1.1
 
Brctl addif eth0 vif1.1
You can bridge this network card to eth0 before you can connect it to the Internet.
 
Ifup starts the VM Nic to check whether the network is connected to the host
 
NOTE: If dummy0 cannot be pinged, check whether the ip addresses of dummy0 and bridge br0test are set and consistent (for the reason why the bridge requires ip addresses, I am still not clear)
 
If any error occurs, please correct it.


From MWI's blog

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.