This HowTo assumes that the Internet access from VMs via DOM0 and the private LAN are done using the Bridge method. In the previous versions of Xen installation the bridges were dynamically built via the Xen scripts, in this version the bridges are built permanently as the DOM0 boots up.
DOM0:xenbr0(eth0) ---bridging==>> DOMUs:eth0
DOM0:pdummy0(dummy0) ---bridging==>> DOMUs:eth1
IMPORTANT: If you are installing Xen in a Hetzner(Germany) dedicated server and use only the available(max 3) IPs for the DOMUs, then you need to make sure you are generating a MAC address for each DOMU IP in the Hetzner robot site of your server, then use this MAC address in your DOMU Xen configuration. If you are using a subnet of 8 IP or more in Hetzner server for DOMUs, this bridging method would not work. Follow the instructions shown here instead: //wp.me/pKZRY-F9
Install Xen Hypervisor and some useful tools
apt-get install xen-hypervisor-4.4-amd64 xen-utils-4.4 bridge-utils ethtool iptables
Since every virtual disk needs to be mounted using a loop device, we need to make sure there are enough of them available in the system.
Edit the file /etc/modules and add:
We also need to turn on the IPv4 forwarding in the kernel.
Edit the file /etc/sysctl.conf (around line 44) activate the line by removing the ‘#’ as follows:
The run the following command to activate it:
sysctl -p /etc/sysctl.conf
Based on the IP assumptions above, here is the content of the file /etc/network/interfaces.
# Internet Access nterface
iface xenbr0 inet static
iface eth0 inet manual
# Internal LAN between VMs and DOM0
iface pdummy0 inet static
iface dummy0 inet manual
In order to make sure Xen scripts don’t create the normal bridges when a DOMu is started, we need to hinder this process by:
editing the file /etc/xen/xend-config.sxp and change the line:(around line 176)
If your DOMUs configurations are set to use pygrub as boot loader,
then make sure the path to pygrub in the DOMU configuration file is correct as follows:
bootloader = '/usr/lib/xen-4.4/bin/pygrub'
In the same DOMU configuration file, make sure you are using a non duplicated MAC addresses with the network interfaces assignment as well as define the bridge that will be used by this DOMu, for example:
vif = [ 'ip=18.104.22.168,mac=00:16:34:D7:9C:12,bridge=xenbr0', 'ip=192.168.100.112,mac=00:16:3E:D7:1C:12,bridge=pdummy0' ]
NOTE:If you are not using the PyGRUb and want to use it as boot loader for each individual DOMUs, which makes the DOMUs kernel independent from the DOM0, see the following article. Please notice that in Ubuntu 14.04 the path to pygrub is different than in the article. Each new version of Xen has a different path to PyGRUB th rest of the article is fully accurate for Ubuntu as well.
Each DOMu will get an interface lo and eth0 with the following configuration:
I’m using the first IP of our subnet for this DOMU and will therefore be configured as follows:
Note: This configuration not really standard as it uses each IP with the netmask /32 (255.255.255.255).
This setting allows each IP of the subnet to be usable by each DOMu.
# The loopback network interface
iface lo inet loopback
# The primary network interface
iface eth0 inet static
# The internale LAN interface(will be connected to pdummy0 on DOM0)
iface eth1 inet static