Linux Tutorials
Building Hadoop Clusters On Linux In EC2
Installing And Using Hadoop
Setting Up SSH Keys Using SSH Agents And Tunnels
Creating OpenSSL Certificates and Certificate Authorities
Installing and configuring Xen
IPTables Primer
Linux Basic Bash Scripting

Installing and configuring Xen

Configuring Xend

Xend is a daemon that runs in the dom0. Xend is responsible for managing all the aspects of the domU(s). This includes managing all virtual hardware devices and creating the network bridges or routed adapters. Xend is configured via a configuration file usually stored in /etc/xen/xend-config.sxp . For a simple install most of the defaults should be alright. The one thing that will need to be configured though is how Xen should handle networking.

Bridged Networking

Bridged networking is the default networking configuration for Xen. With bridged networking each domU is allocated a virtual ethernet adapter that can use DHCP or a static address to access your network. The following configuration in your /etc/xen/xend-config.sxp will setup the network bridge.


(network-script network-bridge)
(vif-script vif-bridge)
# (network-script network-route)
# (vif-script 'vif-route netdev=eth3')
# (network-script network-nat)
# (vif-script vif-nat)

We'll cover how to setup the domU side of the bridge later.

Routed Networking

With routed networking the domU(s) are on a private subnet. If you add a route to the private subnet on your default gateway the guest domains will be visible to your LAN. This /etc/xen/xend-config.sxp will setup the routed network.


# (network-script network-bridge)
# (vif-script vif-bridge)
(network-script network-route)
(vif-script 'vif-route netdev=eth3')
# (network-script network-nat)
# (vif-script vif-nat)

You need to enable proxy ARP to forward ARP traffic to the virtual adapters on the private network. The second command forwards packets to the virtual adapters. Set the 10.0.0.0 to the network address of your private guest network.


# echo 1 > /proc/sys/net/ipv4/conf/all/proxy_arp
# iptables -t nat -A POSTROUTING -s 10.0.0.0 -j MASQUERADE

NAT Networking

NAT Networking is similar to routed networking in that the guest domains are on a private network. The guest domains traffic is routed via NAT on the dom0 to the rest of the network making the traffic appear as if it came from the dom0. If you add a route on the LANs default gateway to the NAT network the LAN can talk to the domU(s).


# (network-script network-bridge)
# (vif-script vif-bridge)
# (network-script network-route)
# (vif-script 'vif-route netdev=eth3')
(network-script network-nat)
(vif-script vif-nat)

Configuring dom0 resources

To specify the number of CPUs and amount of memory for the dom0. The dom0-cpus option sets the number of CPUs to make available to the dom0, if set to 0 use all available CPUs. Use the dom0-min-mem setting to reserve memory for the dom0. As domUs are launched they take memory from the dom0, this will reserve XX amount of memory for the dom0 in MB.

(dom0-cpus 0)
(dom0-min-mem 196)
Installing Xen <<  1 2 3  >> Configuring the Guest Domain
New Content

Related Information
Linux Basic Bash Scripting