Windows 2003 Server on Xen FAQ

The Take 2 Hosting User FAQ includes answers to many frequently asked questions as well as links to valuable information you may find useful while utilizing our services.

Please note that many of the links provided in this FAQ are not directly hosted by Take 2 Hosting.

Table of Contents

Request Additional IP Addresses

If you haven't already done so, request additional IP addresses for your new xen instance. Windows instances will require a /30 netblock (4 IP addresses). You will need to specifically request that the addresses be configured for use with a xen instance so that you are given four addresses starting on a natural /30 boundary. Those IP addresses will be statically routed to your server.

You will need to configure the second address on the Linux side of your server (Dom0) using a netmask of 255.255.255.252 (instead of the usual 255.255.255.255). Instructions for adding those three addresses to your system can be found here:

  http://www.take2hosting.com/?p=userFaqCentos#ConfiguringAdditionalIPAddresses

The first and fourth addresses are used for network and broadcast. The third address will be used for the Windows installation.

If you are going to be setting up multiple instances or if you need additional IPs for your instance you can request that a /29 (8 total addresses) be assigned (netmask of 255.255.255.248). Additional IP addresses and additional network blocks can be assigned at a later date, so only request the /29 if you are ready to use them immediately.

Installing Xen

If you haven't already installed the xen kernel on your server you must do that now.

Start by installing xen on the system with this command:

yum -y -c http://centos.take2hosting.com/take2hosting.repo install xen

Once installed you need to edit the /boot/grub/grub.conf file. Set the "default=" line to point to the xen kernel you just installed. Usually that is the first kernel in the list so the default line would be changed to "default=0".

You need to edit the "module" line and remove "noapic" from the options list.

You need to also add " com1=38400,8n1" to the end of the "kernel" line.

Set "xend" to start at boot time with this command:


chkconfig xend on

Enable IP Forwarding with this command:

echo 'echo 1 > /proc/sys/net/ipv4/ip_forward' >> /etc/rc.local

Edit the /etc/sysctl.conf file and change this line:

net.ipv4.ip_forward = 0

to this:

net.ipv4.ip_forward = 1


Now reboot the system:

shutdown -r now

The system should now reboot into the xen kernel.

Installing Windows 2003 Server

Start by uploading your windows .iso images (or .img files) to the server. For the purposes of this example, we will assume they are the following two files:

/tmp/win2k3disk1.iso
/tmp/win2k3disk2.iso

Use virt-install to set up a domU instance:

virt-install

Here is an example of a virt-install run. Our responses are in bold:


Would you like a fully virtualized guest (yes or no)? This will allow you to run unmodified operating systems. yes
What is the name of your virtual machine? Win2003_1
How much RAM should be allocated (in megabytes)? 768
What would you like to use as the disk (path)? /var/lib/xen/images/Win2003_1
How large would you like the disk (/var/lib/xen/images/Win2003_1) to be (in gigabytes)? 40
Would you like to enable graphics support? (yes or no) yes
What is the virtual CD image, CD device or install location? /tmp/win2k3disk1.iso


Starting install...
Creating storage file... 100% |=========================| 40 GB 00:00
Creating domain... 0 B 00:00
Unable to connect to graphical console; vncviewer not installed. Please connect to localhost:5900
Domain installation still in progress. You can reconnect
to the console to complete the installation process.



At this point the windows installer is running. You may connect to the server via VNC to interact with the installer. By default, VNC only binds to localhost (127.0.0.1). This behavior can be changed by editing the "/etc/xen/xend-config.sxp" file and restarting xend.

For now we'll assume that VNC is bound only to localhost. We recommend creating an ssh tunnel to connect to port 5900 on the server. This is done by setting up an ssh port forward using your ssh client.

The exact method of setting up an ssh tunnel differs from client to client, but here is an example of how to do this under Apple's OS X operating system.

open up terminal (Applications -> Utilities -> Terminal.app) and type:

ssh -N -L 5900:localhost:5900 -l root IP_ADDRESS_OF_SERVER


Once you've established an ssh port forward, you can use any VNC client to attach to the xen instance. For OS X you might want to try the "JollysFastVNC" or "Chicken of the VNC" VNC clients.

Connect to "localhost" port "5900". You should now see the Windows installer window.

Proceed with the windows installation as normal. After the installer copies over the temporary files the instance will shut down.

Once the instance has shut down you need to edit the domU configuration file located here:

/etc/xen/Win2003_1


Located the "disk = " line. It will look like this:

disk = [ "file:/var/lib/xen/images/Win2003_1,hda,w" ]


We need to add the two windows iso images so that the installation can complete. This is done by adding additional entries between the brackets. The change would look thusly (again, assuming the iso images are in /tmp):

disk = [ "file:/var/lib/xen/images/Win2003_1,hda,w", "file:/tmp/win2k3disk1.iso,hdb:cdrom,r", "file:/tmp/win2k3disk2.iso,hdc:cdrom,r" ]

Once that is done, you may restart the Win2003_1 instance with this command:

xm create Win2003_1


and reconnect via VNC. You should see the Windows installer continue with the second stage of the install. Proceed with the installation as normal. When you come to the Networking Setup portion choose "Custom settings", select "Internet Protocol (TCP/IP)" and click "Properties". Click the "Use the following IP address" button and for the "IP address:" enter the third IP address of the /30 that was assigned to you (see the very beginning of this FAQ entry above). For "Subnet mask:" enter "255.255.255.252" (or "255.255.255.248" if you requested a /29 netblock). For "Default gateway:" enter the second IP address of the /30 that was assigned to you (this is the address you configured on the Linux dom0 side in the first part of this FAQ).

For "Preferred DNS server" enter "204.74.213.254". For "Alternate DNS server" enter "38.99.70.6". Click OK. Click Next. Click Next again. Proceed with the rest of the install.

When the system reboots your VNC window will close. Simply open it back up again. The system will be rebooting into Windows for the final leg of the install process.

Complete the final portion of the setup and your Windows installation is finished. You may be prompted to insert "Windows Server CD 2" -- if so go ahead and go Start -> My Computer and check to see which drive disk 2 is mounted as. Enter that drive letter into the window to proceed (this will usually be drive 'D').

Once the installation is done go ahead and shut down Windows.

Now edit the /etc/xen/Win2003_1 file again and remove the CD images from the "disk = " line. The line will change back to this:

disk = [ "file:/var/lib/xen/images/Win2003_1,hda,w" ]


The last step is to set the instance to start at boot time. You do this by linking the configuration into the /etc/xen/auto directory:

ln -s /etc/xen/Win2003_1 /etc/xen/auto/Win2003_1


The domain is now set to start automatically at boot time.

TIP: When working with windows through VNC it's often helpful to disable the "Enhance pointer precision" option under the "Pointer Options" in the Mouse control panel. If you're having trouble lining up the mouse pointer in the VNC window we suggest you try disabling that option in Windows.

Adding Additional IP Addresses to Windows 2003 Server

If you were given a /29 netblock and have unused IP addresses from that netblock you may add them to your Windows instance through the "Properties" section of the network setup. No further configuration beyond that is needed.

If your Windows instance was set up with a /30 netblock (netmask 255.255.255.252) you'll need to add additional IP addresses through the registry on the Windows instance and then set up static routes on the Linux dom0 side.

Start by opening regedit (Start -> Run -> regedit). Go to:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{Interface ID}

where {Interface ID} is the ID of the network interface. If you're unsure of which Interface ID to select just look at them all (it's likely there are only 3 to look at) and pick the one that has the keys containing your primary IP address.

Edit "IPAddress" and add your additional IP addresses to the data. One IP address per line.

Next, edit "SubnetMask" and add one "255.255.255.255" line for each additional IP address you added to the "IPAddress" key. One netmask entry per line.

To make the changes active you either need to reboot the Windows instance or, if you're attached via VNC, you can disable and then enable the network adapter.

Now you must set up a static route on the Linux (dom0) side. For each additional IP address you want to run this command:

/sbin/route add -host ADDITIONAL_IP_ADDRESS gw PRIMARY_IP_ADDRESS


Where "ADDITIONAL_IP_ADDRESS" is the new IP you're adding and "PRIMARY_IP_ADDRESS" is the primary IP address for the Windows instance.

Lastly, you want to add the above /sbin/route command you used to the end of the /etc/rc.local so that the routes are re-established after a reboot.