There are a lot of online materials. Here I am writing a purely personal lesson... I am suffering a day, shit!
At first, I tried to use the new XL tool stack to configure Bridging networks. As a result, due to lack of experience in network management, after manual bridging, dom0 would not be able to access the network! Later, I tried to use the NAT method. As a result, although dom0 is not affected, domu cannot work, static IP allocation, and Mac won't work...
Helpless, return xend, it will automatically configure the bridge network, At the beginning I thought XL will execute/etc/xen/xend-config.sxp configuration file, in fact not, only xend will use it, mistakes, mistakes...
After xend is started, it will generate a bridge. You can use the brctl show command to see:
Bridge name bridge id stp enabled Interfaces
Eth0 8000.78acc0af8a27 no peth0
In addition, the real Nic is named peth0, and the virtual Nic of dom0 is named eth0,
Add the following line to the virtual machine configuration file:
VIF = ['Type = ioemu, MAC = 00: C0: 9f: 78: 35: A7, bridge = eth0']
Mac can certainly not be set, but I need to bind the IP address to the Mac here, not to configure a real Mac...
Start the virtual machine. I use Ubuntu 10.04. In the virtual machine, ifconfig is used to view the virtual network card. Because no Mac is allocated at the beginning, the name of the system virtual network card is changing every time I enter the system, the NIC name in my VM is eth14, so it is recommended to assign a fake mac to prevent ETH rename...
In this case, if you view the NIC configuration in dom0, you can see two new interfaces: tap5.0 and vif5.0,It should be the backend driver, but it is not clear for the moment, 5 refers to domid, 0 refers to the number of virtual NICs in the domain, and the frontend and backend correspond one to one. At the same time, you can see that tap5.0 and vif5.0 are displayed under the interfaces column (Prove that the bridge is successful?)
Enable/etc/Network/interfaces in domu to configure IP, enable/etc/resolv. conf to configure DNS, and then sudo IFUP eth14
I can access the Internet at last...
Let's take a look at this article. This article and this article are very good. In the beginning, I thought virbr0 provided by qemu was a bridge, but it was actually a NAT + DHCP method. The second article is very clear. I suggest you take a look at it...