Total Pageviews

Sunday, October 24, 2010

Xen Networking

Xen Networking

Domain0 Network Interfaces

Interface Name                                                                                 

When xend starts, the network script network-bridge brings up the virtual bridge interface, xenbr0.


By default, the real physical interface eth0 is changed to the name peth0, connecting to this bridge interface.

Domain0's loopback device veth0 is also brought up, its name is changed to eth0, and its backendvirtual interface vif0.0 is connected to the bridge interface.


The pair of Domain0's virtual interface eth0 and vif0.0 are connected in a loopback fashion.

Bridging Configuration Example

Bridging is the default network architecture that Xen establishes for guest domains. In the Xendconfiguration file /etc/xen/xend-config.sxp, the default directives related to the virtual network are listed below.

################################
(network-script network-bridge)
(vif-script vif-bridge)
###############################

 network-script

    The network script network-bridge is in the directory /etc/xen/scripts. It sets up the networking environment and uses the bridge-utils tool to set up the software bridge xenbr0.

 vif-script

    The vif script vif-bridge is also in the same directory as the network script. It sets up the backend vif for the guest domain when a guest domain boots up.

 Example of the directive related to the virtual network setup in a guest configuration file.

  vif = ['mac=00:16:3e:45:e7:12, bridge=xenbr0']

      When the guest domain is booting up, its virtual interface is assigned a user-specified MAC address and is connected to the bridge xenbr0. This directive specifies that the guest domain has one virtual network interface inside that domain, and its backend vif will be attached to the bridge xenbr0.


 Domain0 Network Interfaces

eth0

     Frontend network interface for driver domain with ID 0 (as in Domain0)

lo
     Loopback interface for Domain0

peth0

      Physical network interface

sit0

     Proxy interface for tunneling from IPv6 over IPv4

veth1~veth4

 4 unused frontend network interfaces for Domain0

vif0.0

     Backend network interface for Domain0


vif0.1~veth0.4
  
    The corresponding unused backend network interface for Domain0

vif1.0

    Backend network interface for guest domain with ID 1

xenbr0

    Bridge network interface


  When the physical network interface receives the packets, it sends them all directly to the bridge interface xenbr0. The software bridge determines which domain's backend interface to forward those packets to by the packets' MAC addresses. So, peth0 does not need to have an IP, only a MAC address. The physical interface's original IP has been imparted to eth0—the driver domain's virtual frontend interface. xenbr0 directs the packets either to eth0 or vif1.0 by their MAC addresses 00:11:25:F6:15:22 or 00:16:3e:45:e7:12. The guest domain's corresponding frontend virtualinterface eth0 is installed inside the guest domain. From the DriverDomain's view, the eth0 in guest domain is vif1.0. Figure 10.5 shows a virtual device view of bridge mode.

No comments: