<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Cata.printBlog(); &#187; XEN</title>
	<atom:link href="http://cata.onsysol.com/blog/tag/xen/feed/" rel="self" type="application/rss+xml" />
	<link>http://cata.onsysol.com/blog</link>
	<description>... it&#039;s about software!</description>
	<lastBuildDate>Sun, 30 May 2010 13:19:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Network in a Box Part 2</title>
		<link>http://cata.onsysol.com/blog/2010/02/network-in-a-box-part-2/</link>
		<comments>http://cata.onsysol.com/blog/2010/02/network-in-a-box-part-2/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 08:31:05 +0000</pubDate>
		<dc:creator>Catalin Ciocov</dc:creator>
				<category><![CDATA[Ad Server]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[networks]]></category>
		<category><![CDATA[virtual machine]]></category>
		<category><![CDATA[XEN]]></category>

		<guid isPermaLink="false">http://cata.onsysol.com/blog/?p=53</guid>
		<description><![CDATA[Long, long, looong time ago I wrote about setting up a virtual network using XEN virtual machines, with everything running on the same server. In the first part of this post I&#8217;ve mostly described my 2-day experience with making this work and now I&#8217;m simply going to copy &#38; paste a README file I&#8217;ve created [...]]]></description>
			<content:encoded><![CDATA[<p>Long, long, looong time ago I wrote about setting up a virtual network using XEN virtual machines, with everything running on the same server. In <a href="http://cata.onsysol.com/blog/2009/12/network-in-a-box/">the first part</a> of this post I&#8217;ve mostly described my 2-day experience with making this work and now I&#8217;m simply going to copy &amp; paste a README file I&#8217;ve created for myself to remember what exactly needs to be done to get such a setup up and running.</p>
<pre>This file describes how to create a load-balanced virtual network of
XEN guests (virtual machines) on a XEN Debian server. It is assumed
that the XEN server and xen-tools are already installed.

<strong>Step 1: Creating the XEN virtual machine using CentOS as guest OS</strong>
-------

- Fix rinse installation of CentOS 5. Add the following lines to
/etc/rinse/centos-5.packages:

nss
nspr
python-iniparse

- Optionally, install the packages for CentOS 5 version from a new
location. Modify /etc/rinse/rinse.conf:

[centos-5]
mirror       = http://mirror.bytemark.co.uk/centos/5/os/i386/CentOS/
mirror.amd64 = http://mirror.bytemark.co.uk/centos/5/os/x86_64/CentOS/

- Create the XEN virtual machine with the following command. Modify
parameters to suit needs:

xen-create-image --hostname node01 --dist centos-5 --install-method \
rinse --size 4Gb --swap 1Gb --memory 2Gb --ip 192.168.1.101 \
--netmask 255.255.255.0 --gateway 192.168.1.1 --passwd

<strong>Step 2: Bring the new virtual machine online and open a console to it</strong>
-------

- Run the following command:

xm create /etc/xen/node01.cfg -c

<strong>Step 3: Set up the network settings on the node</strong>
-------

echo 1 &gt; /proc/sys/net/ipv4/ip_forward
echo 1 &gt; /proc/sys/net/ipv4/conf/all/arp_ignore
echo 2 &gt; /proc/sys/net/ipv4/conf/all/arp_announce
echo 1 &gt; /proc/sys/net/ipv4/conf/eth0/arp_ignore
echo 2 &gt; /proc/sys/net/ipv4/conf/eth0/arp_announce

- Setup the ipip tunnel to the load balancer:

ifconfig tunl0 &lt;public IP of load-balancer&gt; netmask 255.255.255.255

- Optionally, set up another public IP address on eth0:1 (to access
this node directly, which is good when developing or debugging):

On the node, type:
ifconfig eth0:1 &lt;IP&gt; broadcast &lt;IP&gt; netmask 255.255.255.255

On the gateway (XEN server / Dom0), type:
route add -host &lt;IP&gt; &lt;vifX.Y&gt;

The vifX.Y must be the one used by XEN for the virtual machine on
which the node runs.

<strong>Step 4: Install and start the HTTP server</strong>
-------

yum install httpd.x86_64
echo "node01" &gt; /var/www/html/index.html
echo "ok" &gt; /var/www/html/status.html
/etc/init.d/httpd start

The status.html file is used by the load balancer to determine if the
node is online or not so that it knows if it can use it.

<strong>Step 5: Configure the load balancer to use the new node</strong>
-------

On the load balancer node (lb), edit /etc/ha.d/conf/ldirectord.cf:
real=192.168.1.101:80 ipip 10

Test that the new node is load-balanced (you should see node01 after a
few refreshes, in case you have more than 1 node):
http://&lt;public Load-balancer IP address&gt;/</pre>
<p>A few remarks:</p>
<ul>
<li>You need at least 2 public IP addresses on your server, but I would recommend 3 or more. One will be used by the server itself (to connect to Dom0), one will be used by the load balancer (your web requests will go to that IP and will be distributed among the available nodes) and at least another one should be assigned to one of the nodes to access it directly and not through the load balancer, which is very important for development and debugging of your load-balanced application.</li>
</ul>
<ul>
<li>The load balancer in my setup is another (virtual) node of the system&#8230; a XEN guest. This is needed because the load balancer cannot be on the same machine as the router for your virtual network, which will be Dom0 (i.e.: the main server itself, on which XEN and everything else runs). Why not? Well, because if you use the same IP for both your router and your load balancer when a packet is sent from one of your end nodes to a client it will have the source IP set to the public IP of the load balancer. Now, the router will receive a packet from &#8220;outside&#8221; that needs to be routed with the same IP address as its own IP address and will say &#8220;no, no! this isn&#8217;t right&#8221; and will drop that packet as being &#8220;source martian&#8221;. Google a bit for &#8220;source martian problem&#8221; and you&#8217;ll get a clearer picture.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://cata.onsysol.com/blog/2010/02/network-in-a-box-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Network in a Box</title>
		<link>http://cata.onsysol.com/blog/2009/12/network-in-a-box/</link>
		<comments>http://cata.onsysol.com/blog/2009/12/network-in-a-box/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 10:48:53 +0000</pubDate>
		<dc:creator>Catalin Ciocov</dc:creator>
				<category><![CDATA[Ad Server]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[networks]]></category>
		<category><![CDATA[virtual machine]]></category>
		<category><![CDATA[XEN]]></category>

		<guid isPermaLink="false">http://cata.onsysol.com/blog/?p=44</guid>
		<description><![CDATA[I finally managed to get a new development server that I&#8217;ll use to build the ad server engine I was talking about. As you (might) know from my previous post, the system is supposed to run on multiple load-balanced servers. Using this setup I believe scaling won&#8217;t be a problem in the future, but I [...]]]></description>
			<content:encoded><![CDATA[<p>I finally managed to get a new development server that I&#8217;ll use to build the <a href="http://cata.onsysol.com/blog/2009/10/building-an-ad-server-engine/">ad server engine I was talking about</a>. As you (might) know from my <a href="http://cata.onsysol.com/blog/2009/11/ad-server-system-design-architecture/">previous post</a>, the system is supposed to run on multiple load-balanced servers. Using this setup I believe scaling won&#8217;t be a problem in the future, but I guess I&#8217;ll just have to wait and see.</p>
<p>My first task was to create this system setup on my development server. Basically, the system has N nodes with a load-balancer in front of them. Since I only have one server, the obvious choice is to use <a href="http://www.xen.org/">XEN</a> and create a virtual machine for every node of the system (including the load balancer). All nodes of the system (i.e.: XEN virtual machines) will sit on a private virtual network which is, again, created on just one real computer (my development server).</p>
<p>So far, so good! Everything seems quite simple from the description above and is definitely simple to setup (&#8230; after 3 days of intense googling!!!). The story goes like this&#8230;</p>
<p>I&#8217;m getting my server (yay!) with CentOS installed on it (I requested it). When it comes to Linux distributions I like Slackware, but using CentOS is so much easier when you don&#8217;t want to configure and install everything by hand and I didn&#8217;t want to spend too much time on installing and compiling software from source, like I usually do on Slackware.</p>
<p>So, anyway, my CentOS is up and running and I&#8217;m about to install XEN&#8230; easy!, just type &#8220;yum install xen&#8221; and you&#8217;re done. XEN requires a new kernel, so once you reboot the machine (with the new XEN kernel) you have a working XEN environment where you can create additional virtual machines. Just to note, at least on CentOS, you don&#8217;t have to configure anything (like grub for example); yum does everything for you&#8230; so once you install XEN with yum you just restart the server and you&#8217;re done&#8230; pretty cool!</p>
<p>Next step: build a virtual machine&#8230; how hard could this be? Well, it turns out it&#8217;s not that simple, at least not on CentOS. First of all, I think the documentation about this is a bit lacking, especially if you&#8217;re not familiar with how Linux works and a dozen or so command-line tools. I think I&#8217;m pretty good at Linux stuff, but nevertheless, I couldn&#8217;t create a XEN virtual machine on CentOS. To keep a long story short, I was able to boot a virtual machine but I wasn&#8217;t able to install the &#8220;guest&#8221; operating system on it because I didn&#8217;t have network access from inside the virtual machine and frankly I don&#8217;t know what didn&#8217;t work and I also didn&#8217;t want to spend too much time on this.</p>
<p>So I went and asked Google what&#8217;s the easiest way to create a XEN virtual machine&#8230; and the answer was &#8220;use xen-tools&#8221;. I said &#8220;aha! let&#8217;s try that&#8230;&#8221; and immediately went to my CentOS to type &#8220;yum install xen-tools&#8221;. To my surprise, yum said there is no package with that name, so again I turned to Google to find out more about these xen-tools. I read now from their page: &#8220;xen-tools is a collection of simple perl scripts which allow you to easily create new guest Xen domains upon your Debian GNU/Linux host&#8221;. Damn, I&#8217;m on the wrong Linux distribution&#8230; and from looking at the examples of how to use xen-tools it seems quite simple and easy, so it&#8217;s worth trying to work with Debian on my development server.</p>
<p>Luckily my hosting provider has a very easy and convenient way to (re)install a new OS, so I went to my administration console and looked for Debian through the available OSes and I was very happy to find a &#8220;Debian + XEN 3.2&#8243; OS template there&#8230; I selected that, clicked &#8220;Restore&#8221; and in about 30 minutes my new Debian + XEN 3.2 development server was back online!</p>
<p>What comes next&#8230; you&#8217;ll have to read it in part 2 of this post. Stay tuned!</p>
]]></content:encoded>
			<wfw:commentRss>http://cata.onsysol.com/blog/2009/12/network-in-a-box/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
