SolutionBase: Create an entire test lab on one system using Virtual PC

Find out how Virtual PC can help you maintain your skill set and test new software as it comes out.

In these days of lean IT budgets and slim IT staffs, maintaining a testing lab may seem like a luxury that doesn’t fit either the budget or the schedule. However, even in lean times, ensuring that patches and other software work as expected is as important as keeping up with new products in order to stay current and competitive.

An entire lab can be setup with a single PC of adequate requirements using Virtual PC to run Windows, Linux, NetWare, and even OS/2 systems inside its virtual “box”. Virtual PC can help you maintain your skill set and test new software as it comes out.

The requirements
System requirements include significant RAM, a fast processor, sufficient disk space for multiple operating system installations, and a fast disk RAM, which is a critical element because Virtual PC “virtualizes” the hardware in a single PC. Each virtual machine gets its own virtual processor, RAM, and disk. Of course, this really means that each virtual PC in reality shares the resources of the host machine. The processor time is split among the various virtual machines (VMs) and any RAM assigned to a VM is used exclusively by that VM, a factor that requires a lot of RAM.

By itself, Virtual PC requires a 400-MHz or better processor although Connectix recommends a 600-MHz system. Virtual PC supports almost any x86 processor including Athlon, Celeron, Duron, Pentium II, Pentium III, and Pentium 4. The host system needs to be running Windows 98 SE or better, but the newest version—version 5.2—requires NT, 2000 or XP. RAM requirements start out at 128 MB for the host operating system running Virtual PC 5.2.

That RAM requirement does not take into consideration any guest operating systems. For example, a NetWare 6.0 guest operating system requires 192 MB of RAM while a Windows 2000 Advanced Server guest OS requires 256 MB of RAM.

To run both of these guest machines simultaneously on a Windows XP Professional host, you would need 128 MB for the XP host, 192 MB for NetWare 6 and 256 MB for Windows 2000 AS for a total of 576 MB. Disk space is worked out in a similar fashion, but with the size of today’s IDE hard drives, disk space will likely not be your primary concern. For more details on system requirements for Virtual PC 5.2, visit the Connectix product information page.

My lab configuration
I run both VMWare and Virtual PC on the same system but not simultaneously. My system contains an Athlon 2100+ processor running at 1.7 GHz, 1.5 GB RAM (DDR 333), an 80-GB ATA/133 7200 RPM drive with an 8-MB cache, a 48X CD-ROM drive and a 48X CD-RW drive. I just recently upgraded to 1.5-GB RAM from 1.0 GB. This upgrade has definitely made an impact on my system’s performance when running multiple VMs as well as other applications like Word, Excel and Winamp. I am running Windows XP SP1 for the host operating system.

A demonstration
As a demonstration of how Virtual PC can help to emulate a small lab environment, I installed a Windows Server 2003 and a Red Hat Linux 7.3 server into VMs operated by Virtual PC. Each machine got an IP address from my network’s DHCP server, although the way that networking is handled in the virtual machines can be changed. This type of scenario is perfect for Virtual PC since it allows you to test a new operating system—Windows Server 2003—from your workstation without having to go to a lab and set up a machine for your use.

Windows Server 2003 guest
Every guest operating system installation starts out the same way by choosing New PC from the Virtual PC main window (See Figure A).

Figure A
The Virtual PC main window helps launch the installation of a new PC.

Next, you’ll see the PC Name screen shown in Figure B. Each guest needs a name to uniquely identify it. For this example, I will name my VM Windows Server 2003.

Figure B
This virtual machine will be named Windows Server 2003.

You’ll then see the Configuration Options screen shown in Figure C. When configuring a new PC, you have the option to be walked through the process step-by-step or to just have a default PC created that you modify manually to suit your needs. For this Windows installation, I will use the guided option, but for the Linux server installation later in this article, I will choose the alternative option. If you already have a configuration that you like, you can also choose to duplicate it for the new machine.

Figure C
The guided option uses a wizard to assist in configuration.

Virtual PC supports a number of operating systems out of the box as you can see on the Guest Operating System screen shown in Figure D. The list shown here lets you pick one of the well-supported OSs. Based on the selection you make, the wizard will determine what kind of configuration is needed. For example, if you choose Windows 3.1 as the guest, Virtual PC will assume that 32 MB of RAM is adequate while choosing Windows Server 2003 assumes 128 MB of RAM.

Figure D
A number of predefined operating system choices are included.

Even though the wizard assumes certain system resource requirements based on the OS selected, you are able to modify the defaults in the proceeding steps of the wizard. In this example, choosing Windows Server 2003 as the guest OS resulted in a default of 128 MB RAM. However, I would rather assign 256 MB to this operating system instead, as shown in Figure E.

Figure E
RAM allocation can be easily adjusted.

Each guest operating system needs a “boot disk,” just like an actual PC. This is accomplished by creating hard disk image files on the Boot Disk Options screen shown in Figure F. To make this step easier, Connectix sells preconfigured hard disk images, but for this example, I will install my own.

Figure F
A hard disk image is required for every guest machine.

By default, hard disk images are stored in the My Documents folder for the current user. Since I only have one hard drive in my host PC, I will leave it here. You can choose to store it wherever you want on the Boot Disk Location screen shown in Figure G. For additional performance, running the guest PC hard disk images from a separate drive on a separate IDE controller is recommended. The default name for the image is the guest machine name.

Figure G
This image will be saved to the My Documents folder.

That’s it for the wizard. At the end, you are presented with a summary of the selections and then brought back to the Virtual PC main window, which now shows your new OS.

From here, you can start the virtual machine up by selecting it and clicking the Start Up button. For my installation, I had trouble booting from the Windows Server 2003 CD. To correct the problem, I just selected CD > Capture Host Drive D: in order to allow the virtual machine to use that CD-ROM drive. After I did this, the Windows Server 2003 installer started up. Then the installation ran fine, as seen in Figure H.

Figure H
Windows Server 2003 is being installed onto this virtual PC.

Red Hat Linux 7.3
Installing a Linux virtual machine is very much like installing a Windows machine. For this example, I will follow the same steps for creating a new PC as before, except that I will create a default PC rather than using the guide. This results in the screen shown in Figure I.

Figure I
Not using the guide, you can manually modify VM parameters.

Unfortunately, since I don’t have a disk image for this VM yet, I need to create one. Exiting back to the Virtual PC main menu, I choose File | Virtual Disk Wizard from the menu and follow the steps, starting with Figure J and then clicking Next to create the hard disk image as shown in Figure K.

Figure J
Create a new hard disk image using the Virtual Disk Wizard.

Figure K

As before, this image needs a name. I have chosen Red Hat Linux 7.3. There are a number of ways that a new disk image can be created. The most common method is to create an image file whose size expands based on what is in it, as shown in Figure L. For example, if you have a VM with 8 GB of data on the system disk, the disk image file will also be around 8 GB in size. This is how I will create the image for this example. I will explain the other methods later.

Figure L
Each disk image can be configured to meet your needs.

Like an actual PC, each disk needs to be sized and formatted. You’ll do this on the Hard Disk Format And Size screen shown in Figure M. For this disk image, I will choose to install an unformatted disk of 16 GB. You can also choose to create a FAT16 or FAT32 partition. Bear in mind that not all operating systems support FAT32.

Figure M
Each disk image needs to be sized and a format chosen.

At this point, I can go back to configuring my new virtual machine by selecting it from the Virtual PC main menu and clicking Settings. I have changed the RAM size to 192 MB and pointed this virtual machine at the disk image file that I just created. I have left the remaining options at the defaults. See Figure N for an overview of how I have configured this Linux machine.

Figure N
The Linux server has 192 MB RAM and uses the new disk image.

Once these settings are saved, clicking Start PC will start it up. Since I already have the prior Windows example using the host drive D: (my CD-ROM drive) to install Windows Server 2003, I will assign the host E: drive (my CD-RW drive) to this machine by choosing CD | Capture Host Drive E: immediately after starting the VM. As you can see from Figure O, the Linux installation is running with no problems and at full resolution.

Figure O
This window tracks the Linux installation.

The infrastructure behind the VMs
Using Virtual PC 5.2, I now have running a Windows Server 2003 system as well as a Red Hat Linux 7.3 system. Both of these machines are present on my network with their own IP addresses obtained from the DHCP server. To the network, they just look like other hosts.

This behavior can be attributed to the fact that the machines are connected to the host machine’s network via a “virtual switch”. On both of the systems created for this demonstration, the VMs can communicate with the host machine, with each other, and with other machines besides the host.

Isolate the VMs
In a lab situation you might want to quarantine the servers from the primary network for any number of reasons. For example, if you are testing virus software or bringing up services that could conflict with the primary network, you would likely want to keep the lab servers isolated.

You can easily accomplish this by opening the settings for a VM, selecting the Networking option, and choosing Virtual Switch and making sure to use the Local Only option. This will allow the VMs to communicate with each other but not with the host or other network devices.

NAT the VMs
If you have very few IP addresses or want to run virtual machines that do not need to be accessed from other network users, you can also choose the Shared Networking option. Choosing this results in your VMs being assigned nonroutable addresses. When a VM needs to access something outside its network, it uses the host PC’s IP address via Network Address Translation. Virtual PC also includes a virtual DHCP server that is used to assign IP addresses to the virtual machines when you choose this option.

Don’t buy lots of boxes
Among the desirable traits in a lab environment are the ability to get it set up and reconfigured fairly quickly and the ability to isolate it from the primary network in order to decrease potential risk to the production environment in case of a major problem. A lab environment can also help to keep your skills sharp and to test new software before a general distribution.

Virtual PC 5.2 can be invaluable in achieving all of the above. With its wide support for almost any X86-based operating system and its configuration flexibility, you can emulate a modest lab environment on a single PC.