The Rise of the Virtual Machine
There are actually several different types of virtual machines. The term is commonly used to refer to software that allows an application to be used on different operating systems, because the application is isolated from the computer's OS environment. You've probably heard of the Java Virtual Machine (JVM) that allows Java code to run on different hardware and software platforms.
In this article, we're talking about virtualization software that emulates the computer hardware so that you can create separate environments for running multiple operating systems (or multiple instances of the same operating system) on a single computer, as if they were separate physical computers.
The ability to, for all intents and purposes, have several different computers all running on one piece of hardware saves money and space, so virtualization software has become very popular. The Gartner Group predicts that the use of such technologies will triple from 2003 to 2008 (http://www.itfacts.biz/index.php?id=P379).
There are many uses for virtual machines. Server consolidation is one. You can install multiple VMs on one powerful computer and install server operating systems and server applications on each (for example, one VM might function as your Exchange mail server, another might function as your Web server, and a third might function as your file server. One of your VM servers could be running Windows Server 2003 while another is running Linux, all on the same hardware). A big advantage of this is that the VMs can be backed up easily and restored to different hardware if the physical server goes down.
Another important use for VMs is software testing and debugging. When computers are critical to the mission of the organization (as is true today in most organizations), a failed operating system upgrade or application deployment can create downtime that results in loss of productivity and money.
Best practice is to always test upgrades, patches and new applications in a non-production environment that emulates your production network as closely as possible. However, purchasing the hardware to create a parallel network can get expensive. It's much more cost effective to create your test network in VMs on one or a few physical computers. Each VM operates as a separate member of the network, with its own IP address. This article focuses on using Microsoft's Virtual PC (VPC) virtualization software to test software before deploying it on your production network.
Be sure to check licensing requirements before installing operating systems and applications on virtual machines. Generally, each instance of the OS or program must be licensed just as if it were running on a separate physical computer.
VPC vs. Other Virtualization Products
VMWare more or less cornered the market on virtualization software for years. It was introduced in 1999 and quickly became a hit with techies who wanted to run an operating system within an operating system (for instance, you could install a Windows 9x VM on your Windows 2000 computer to run games that weren't compatible with the Windows 2000 OS). A server version was introduced that lets multiple users run the VMs stored on the server through a "client piece" on their workstation. Network administrators soon realized the possibilities for consolidating servers and testing programs prior to deployment.
Another company that made virtualization software was Connectix; Microsoft bought Virtual PC from them in 2003. They then released Virtual PC 2004, which included a number of enhancements but dropped official support for non-Microsoft operating systems (Linux, NetWare and other non-Microsoft operating systems can still be installed and run fine on VPC, but Microsoft does not provide support for those scenarios). Now VMWare and VPC are the two leading PC virtualization programs.
There are also virtualization programs designed to run on Linux, such as Virtuozzo from SW-Soft (designed primarily for server consolidation), Bochs and Freemware.
Microsoft dropped the price on VPC (it's about $100 less than the Connectix product and about $70 less than VMWare Workstation).
I started using VPC as a private beta tester. At first, I wasn't impressed. The early beta had some impressive features, but it was slow and clunky compared to VMWare. Later releases fixed that problem and now VPC is as fast as or faster than VMWare Workstation to work with after the OS is installed, although operating system installation still takes a long time. For me, it's worth the wait for VPC's ease of use. As a writer, I also like VPC's screenshot capabilities; I can get a screenshot of the active window within the virtual machine using ALT+PrtScn, just like on the host operating system. It's also very handy to be able to install software from an ISO file by simply dragging the .iso and dropping it on the CD icon at the bottom of the VPC window. You can also drag and drop files between host and guest operating systems. Setting up and configuring the VM is intuitive; rarely do I have to consult the Help file.
How to Install and Use VPC
Installing VPC was easy and wizard-driven. You can even install VPC using Remote Desktop (just note that when installation completes, it automatically ends your remote session and you'll have to wait a few moments and then reconnect). One caveat is to be sure the computer has enough RAM. VMs gobble up memory, and if you plan to run more than one VM at a time, we recommend you have at least a gigabyte of RAM.
The VPC interface has two parts. The VPC console is the starting point for creating, starting and changing the configuration settings for virtual machines. The VPC application window is where your VM runs when you start it.
Creating a new VM and installing a guest OS is easy, thanks to the New Virtual Machine Wizard (invoked by clicking the New button on the VPC console). The wizard gives you options to choose configurations to create a new VM, to create a new VM with default settings or to add an existing .vmc file (for example, one created on another host computer) to your VPC console.
Each separate VM is stored as a .vmc file, by default in a folder called My Virtual Machines in the My Documents folder of the user who installs it. You can name the VM whatever you want. You can also save it to a location other than the default. This is often a good idea if the partition that holds your My Documents folder doesn't have a lot of free space. You can store the .vmc files on a removable drive or network drive, but performance may not be as good. I like to create a special hard disk partition just for VMs. Next you're asked to select a guest OS, as shown in Figure A.
Support for Server 2003 is added by Service Pack 1. There is also a selection of "Other" if you want to install a non-Microsoft operating system. The wizard will recommend an amount of RAM to allocate for this VM based on the OS you selected, or you can adjust the amount to suit your needs (for example, if you are going to install a memory-intensive application). You can create a virtual hard disk or use one that already exists. Virtual hard disks are stored as .vhd files on your actual disk. You can create multiple disks for one VM.
When the wizard is completed, the VM will show up in your console along with other VMs you've created, as shown in Figure B.
You can configure the settings for the VM by selecting it and clicking Settings. This allows you to change the name of the VM, change the memory allocation, add or change hard disk configurations, configure the CD/DVD drive, floppy and ports, configure network adapters, enable sound, use pointer integration (lets you move the mouse pointer from host to VM seamlessly), use shared folders to access information on the host computer, and control display settings. The Settings dialog box is shown in Figure C.
You can connect as many as four physical network adapters to the VM (assuming your host computer has that many). USB keyboards work fine, although some USB devices aren't supported (for example, my USB flash memory reader/writer isn't recognized in the VM).
Once your VM is configured to your liking, just click Start and the machine boots up in a window (unless you've configured it to start in full screen mode in the Display section of the settings page), as shown in Figure D.
To log on, instead of pressing CTRL+ALT+DEL on the keyboard (which will just bring up the Windows Security dialog box on your host OS), click the Action menu at the top of the VPC window and select Ctrl+Alt+Del there.
To change settings while the VM is running, click the Edit menu and select Settings (however, some settings cannot be changed during a session).
You should also install the Virtual Machine Additions, which adds a lot of functionality, included drag and drop, folder sharing, mouse integration, better video drivers, clipboard sharing (copy and paste between host and guest OS, and much better performance) . You can do so by clicking the Action menu and selecting Install or Update Virtual Machine Additions.
Setting Up a Test Network with VPC
To set up a test network, just install VPC and then create VMs for each server and workstation that you want on your test network. Install the operating systems and configure the networking properties so they are on the same subnet (use private IP addresses such as the 192.168.1.x or the 10.x.x.x range).
Configure your computers just as you would with separate physical machines. You can create Windows domains, DNS servers, mail and Web servers, install software firewalls such as ISA Server, and so forth. Set up your network to emulate your production environment as closely as possible (although you will probably only need a few client VMs).
Configure the VMs to use the network adapter from the host computer if you want them to be able to communicate with each other on the network. If a VM just needs Internet access, you can use Shared Networking. In this case, the VM is like a system behind a NAT device. External computers won't be able to access the VM, but the VM can access Internet resources.
If the host computer doesn't have a network adapter, you can still provide networking between the host and guest by using the Microsoft loopback adapter. If the host has an Internet connection, you can enable Internet Connection Sharing (ICS) and the guest OS can access the Internet through it. You can also use the loopback adapter to create a virtual network environment with multiple network connections on the VM.
Now you can test new software, including security patches, service packs and applications, on your virtual network before you deploy them on your production network.
Virtualization software makes it much easier to create a testbed for trying out new software in a safe environment without risking damage to your production network. Now you have two good choices when it comes to virtualization software for Windows host computers. Both VMWare and Virtual PC provide the means to create virtual networks on a single computer. We've switched to VPC because of its features, ease of use and performance.