Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
hypervisor:base:network [2014/04/29 11:37]
admin [Software Bridge]
hypervisor:base:network [2015/03/04 22:45] (current)
admin [Beginners Network Configuration]
Line 1: Line 1:
-====== ​Configure ​Networking ======+====== Networking ====== 
 +----
 [[http://​wiki.xenproject.org/​wiki/​XenNetworking]] [[http://​wiki.xenproject.org/​wiki/​XenNetworking]]
  
-=====  Virtual Network ​Interfaces ​=====+---- 
 +===== Terminology ===== 
 +---- 
 +There are three types of server-side software objects which represent networking entities. 
 + 
 +  * **PIF**, represents a **physical network interface** on a Xen Cloud Platform host. PIF objects have a name and description,​ a globally unique UUID, the parameters of the NIC that they represent, and the network and server they are connected to. 
 + 
 +  * **VIF**, which represents a **virtual interface on a Virtual ​Machine**. VIF objects have a name and description,​ a globally unique UUID, and the network and VM they are connected to. 
 + 
 +  * **Network**, which is a **virtual Ethernet switch** on a Xen Cloud Platform host. Network objects have a name and description,​ a globally unique UUID, and the collection of VIFs and PIFs connected to them. 
 + 
 +---- 
 +==== Networks ​==== 
 +---- 
 +Each Xen Cloud Platform host has one or more networks, which are virtual Ethernet switches. Networks <color darkslateblue>​without an association to a PIF are considered internal</​color>,​ and can be used to provide connectivity only between VMs on a given Xen Cloud Platform host, with no connection to the outside world. Networks <color darkslateblue>​with a PIF association are considered external</​color>,​ and provide a bridge between VIFs and the PIF connected to the network, enabling connectivity to resources available through the PIF's NIC. 
 + 
 +---- 
 +==== VLANs ==== 
 +---- 
 +Virtual Local Area Networks (VLANs), as defined by the IEEE 802.1Q standard, allow a single physical network to support multiple logical networks. XenServer hosts can work with VLANs in multiple ways. 
 + 
 +All supported VLAN configurations are equally applicable to pools and standalone hosts, and bonded and non-bonded configurations. 
 +---- 
 +=====  Initial Networking Configuration ===== 
 +---- 
 + 
 +The Xen Cloud Platform host networking configuration is specified during initial host installation. Options such as IP address configuration (DHCP/​static),​ the NIC used as the management interface, and hostname are set based on the values provided during installation. 
 + 
 +When a Xen Cloud Platform host has a **single NIC**, the following configuration is present after installation:​ 
 +  * a single PIF is created corresponding to the host's single NIC 
 +  * the PIF is configured with the IP addressing options specified during installation to enable management of the host 
 +  * the PIF is set for use in host management operations 
 +  * a single network, network 0, is created 
 +  * network 0 is connected to the PIF to enable external connectivity to VMs 
 + 
 +When a host has **multiple NICs** the configuration present after installation depends on which NIC is selected for management operations during installation:​ 
 +  * PIFs are created for each NIC in the host 
 +  * the PIF of the NIC selected for use as the management interface is configured with the IP addressing options specified during installation 
 +  * a network is created for each PIF ("​network 0", "​network 1", etc.) 
 +  * each network is connected to one PIF 
 +  * the IP addressing options of all other PIFs are left unconfigured 
 + 
 +In both cases the resulting networking configuration allows connection to the Xen Cloud Platform host by any management software running on separate machines via the IP address of the management interface. The configuration also provides external networking for VMs created on the host. 
 + 
 +The PIF used for management operations is the only PIF ever configured with an IP address.\\ 
 +<color grey>​**External networking for VMs is achieved by bridging PIFs to VIFs using the network object which acts as a virtual Ethernet switch.**</​color>​ 
 + 
 +----
 ==== Paravirtualised Network Devices ==== ==== Paravirtualised Network Devices ====
 +----
  
 A paravirtualised network device consists of a pair of network devices. The first of these (the frontend) will reside in the guest domain while the second (the backend) will reside in the backend domain (typically Dom0). A similar pair of devices is created for each virtual network interface. A paravirtualised network device consists of a pair of network devices. The first of these (the frontend) will reside in the guest domain while the second (the backend) will reside in the backend domain (typically Dom0). A similar pair of devices is created for each virtual network interface.
Line 15: Line 64:
 {{ :​hypervisor:​base:​network:​basic.png?​direct&​200 |}} {{ :​hypervisor:​base:​network:​basic.png?​direct&​200 |}}
  
 +----
 ==== Emulated Network Devices ==== ==== Emulated Network Devices ====
 +----
  
 As well as PV network interface fully virtualised (HVM) guests can also be configured with one or more emulated network devices. These devices emulate a real piece of hardware and are useful when a guest OS does not have PV drivers available or when they are not yet available (i.e. during guest installation). As well as PV network interface fully virtualised (HVM) guests can also be configured with one or more emulated network devices. These devices emulate a real piece of hardware and are useful when a guest OS does not have PV drivers available or when they are not yet available (i.e. during guest installation).
Line 27: Line 78:
 If the DM runs in a stub domain then the device surfaces in domain 0 as a PV network device attached to the stub domain. The stub domain will take care of forwarding between the device emulator and this PV device. If the DM runs in a stub domain then the device surfaces in domain 0 as a PV network device attached to the stub domain. The stub domain will take care of forwarding between the device emulator and this PV device.
  
 +----
 ==== MAC addresses ==== ==== MAC addresses ====
 +----
  
 Virtualised network interfaces in domains are given Ethernet MAC addresses. By default most Xen toolstacks will select a random address, depending on the toolstack this will either be static for the entire life time of the guest (e.g. Libvirt, XAPI or xend managed domains) or will change each time the guest is started (e.g. XL or xend unmanaged domains). Virtualised network interfaces in domains are given Ethernet MAC addresses. By default most Xen toolstacks will select a random address, depending on the toolstack this will either be static for the entire life time of the guest (e.g. Libvirt, XAPI or xend managed domains) or will change each time the guest is started (e.g. XL or xend unmanaged domains).
Line 35: Line 88:
 In case yo have to set a MAC address yourself, refer to [[http://​wiki.xenproject.org/​wiki/​XenNetworking]] for indications on how to do that. In case yo have to set a MAC address yourself, refer to [[http://​wiki.xenproject.org/​wiki/​XenNetworking]] for indications on how to do that.
  
 +----
 ==== Bridging ==== ==== Bridging ====
 +----
  
 The default (and most common) Xen configuration uses bridging within the backend domain (typically domain 0) to allow all domains to appear on the network as individual hosts. The default (and most common) Xen configuration uses bridging within the backend domain (typically domain 0) to allow all domains to appear on the network as individual hosts.
Line 46: Line 101:
  
 {{ :​hypervisor:​base:​network:​network-bridge.png?​direct&​200 |}} {{ :​hypervisor:​base:​network:​network-bridge.png?​direct&​200 |}}
- +----
-=== Setting up bridged networking === +
- +
-The recommended method for configuring bridged networking is to use your distro supplied network configuration tools as described in [[http://​wiki.xenproject.org/​wiki/​Host_Configuration/​Networking|Host Configuration/​Networking]]. +
- +
-The XL toolstack will never modify the network configuration and expects that the administrator will have configured the host networking appropriately. +
- +
-=== Attaching virtual devices to the appropriate bridge === +
- +
-When a domU starts up the vif-bridge script is run which: +
- +
-    attaches vifDOMID.DEVID to the appropriate bridge +
-    brings vifDOMID.DEVID up.  +
- +
-With XL and xend the bridge to us for each VIF can be configured using the bridge configuration key. e.g. +
-<​code>​ +
-   vif=[ '​bridge=mybridge'​ ] +
-</​code>​ +
-or +
-<​code>​ +
-   vif=[ '​mac=00:​16:​3e:​01:​01:​01,​bridge=mybridge'​ ] +
-</​code>​ +
-or to create multiple interfaces attached to different bridges: +
-<​code>​ +
-   vif=[ '​mac=00:​16:​3e:​70:​01:​01,​bridge=br0',​ '​mac=00:​16:​3e:​70:​02:​01,​bridge=br1'​ ] +
-</​code>​ +
 ==== Open vSwitch ==== ==== Open vSwitch ====
 +----
  
 The Xen 4.3 release will feature initial integration of [[http://​www.openvswitch.org/​|Open vSwitch]] based networking. Conceptually this is similar to a bridged configuration but rather than placing each vif on a Linux bridge instead an Open vSwitch switch is used. Open vSwitch supports more advanced [[http://​en.wikipedia.org/​wiki/​Software-defined_networking|Software-defined Networking (SDN)]] features such as [[http://​www.openflow.org/​|OpenFlow]]. The Xen 4.3 release will feature initial integration of [[http://​www.openvswitch.org/​|Open vSwitch]] based networking. Conceptually this is similar to a bridged configuration but rather than placing each vif on a Linux bridge instead an Open vSwitch switch is used. Open vSwitch supports more advanced [[http://​en.wikipedia.org/​wiki/​Software-defined_networking|Software-defined Networking (SDN)]] features such as [[http://​www.openflow.org/​|OpenFlow]].
- 
-=== Setting up Open vSwitch networking === 
- 
-Set up openvswitch according to the [[http://​wiki.xenproject.org/​wiki/​Network_Configuration_Examples_(Xen_4.1%2B)|Host Networking Configuration Examples]]. 
- 
-If you want openvswitch to be the default, add the following line to your xl.conf file: 
-<​code>​ 
-vif.default.script="​vif-openvswitch"​ 
-</​code>​ 
-If you have given the openvswitch bridge a name other than xenbr0, you will need to update that default as well: 
-<​code>​ 
-vif.default.bridge="​ovsbr0"​ 
-</​code>​ 
-Alternately,​ you can specify the new script (and bridge, if necessary) in each config file by adding script=vif-openvswitch (and possiblybridge=ovsbr0) to the vifspec of individual vifs in config files. See xl-network-configuration.markdown for more information. 
- 
-=== Attaching virtual devices to the appropriate switch === 
- 
-Xen 4.3 ships with a vif-openvswitch hotplug script which behaves similarly to the vif-bridge script, except that it attaches the VIF to an openvswitch switch (named via the VIF's bridge parameter). 
- 
-In addition to naming the bridge the openvswitch hotplug script supports an extended syntax for the bridge option which allows for VLAN tagging and trunking. That syntax is: 
-<​code>​ 
-BRIDGE_NAME[.VLAN][:​TRUNK:​TRUNK] 
-</​code>​ 
-To add a vif to VLAN 102 on bridge xenbr0: 
-<​code>​ 
-vif = [ '​mac=00:​16:​3e:​01:​01:​01,​bridge=xenbr0.102'​ ] 
-</​code>​ 
-To add a vif to bridge xenbr1 trunked and receiving traffic for VLAN 101 and 202: 
-<​code>​ 
-vif = [ '​mac=00:​16:​3e:​01:​01:​01,​bridge=xenbr0:​101:​202'​ ] 
-</​code>​ 
  
  
-===== Beginners Network Configuration ===== 
  
 ==== Software Bridge ==== ==== Software Bridge ====
Line 142: Line 140:
 A possible **static IP address** configuration would be as follow: A possible **static IP address** configuration would be as follow:
 <​code>​ <​code>​
-  GNU nano 2.2.6                      File: /​etc/​network/​interfaces ​                                         Modified  ​ 
- 
 # This file describes the network interfaces available on your system # This file describes the network interfaces available on your system
 # and how to activate them. For more information,​ see interfaces(5). # and how to activate them. For more information,​ see interfaces(5).
Line 182: Line 178:
 Note that if you are running a DHCP server on this machine, then you may need to change the xenbr0 interface to a static or manual IP address, as DHCP may not come up in time to provide an address otherwise. ​ Note that if you are running a DHCP server on this machine, then you may need to change the xenbr0 interface to a static or manual IP address, as DHCP may not come up in time to provide an address otherwise. ​
 </​WRAP>​ </​WRAP>​
 +
 +<WRAP center round important 90%>
 +In case you are executing those changes from a remote ssh connection, you should execute the interface refresh commands in a sequence as you'll probably loose the connection after the first **ifdown**:
 +<​code>​
 +> ifdown eth0 && killall dhclient : ifup xenbr0
 +</​code>​
 +</​WRAP>​
 +
  
 ==== Disable Netfilter on Bridges ==== ==== Disable Netfilter on Bridges ====