For years I had used VMware as my hypervisor of choice for virtual labs but I recently switched to Hyper-V. The last few weeks I have been getting familiar with how things work in Microsoft's virtualization environment and decided to write a quick step by step on how to get a virtual lab up and running. Before I get started with that I would like to share some of the reasons why I decided to switch.
- Hyper-V is now included with Windows 8 Pro and Enterprise editions (No need to spend extra money for cutting edge virtualization technology on my laptop or workstation)
- Hyper-V has matured now to a point where it can now make a great case for enterprises to adopt this technology over any other virtualization platform so I would expect to see more enterprises running their private clouds on Hyper-V. See Hyper-V competitive advantage datasheet
- I am a Microsoft Certified Professional / Trainer and I work for a Microsoft Gold Partner. There is a great deal of support offered to IT professionals focused on Microsoft technologies and many of the demos / labs are available in the form of Hyper-V virtual machines. It would not be worth it to take the extra time to recreate such resources from scratch using a different virtualization technology.
- I see I great deal of opportunities derived from the Azure IaaS offering and it's ability to run Hyper-V machines. I can create a Virtual Server and run it on my laptop, the Data Center or upload it to the cloud.
- I can browse a VHD as if it were just another disk.
- I can boot my windows computer from a VHD
Now, back to the original subject. Let's get started.
First things first, right? if you have not already enabled Hyper-V in your windows 8 Pro or Enterprise OS you can do so by executing the following PowerShell command:
Alternatively you can enable this feature through the control panel
Getting Familiar With The Tools
Enabling Hyper-V also installs the Hyper-V manager. The Hyper-V manager provides a clean and simple interface to manage all aspects of your virtual environment. Check out Technet's overview.
Creating A Virtual Network
You can create three types of virtual networks:
- External: Provides access to the network that the host is connected to
- Internal: Allows communication between the VMs on the same host and the host itself.
- Private: Only allow communications between the VMs on the same host. VMs can not communicate with the host computer.
You can decide how to set up your virtual network environment. One approach is to have all VMs connected to a private virtual network and have one VM connected to both a private and external network. Then install a gateway / firewall product such as Microsoft Forefront on that VM to manage the internet traffic. You can also go with a simpler approach and connect all the VMs to an external virtual network if security is not a concern.
To create an external virtual network do the following.
From the actions menu select the Virtual Switch Manager. In the VSM under "Create Virtual Switch" select external and the click on the button "Crate Virtual Switch".
This takes you to the next screen where you enter other details such as Virtual Switch Name, Connection type etc. Give the switch a name and in the connection type, under external netowrk select the host network adapter you wish to use.
Leave the default values for all other options and hit OK.
Creating A Virtual Machine Template
The first thing you need to do in creating a Virtual Machine Template is to set up a Virtual Machine and configure the OS. For a step by step walk through on how to create a new Virtual Machine click here. Once the new VM has been created and the OS has been installed, go ahead and apply only the system configurations that you want all your VMs to share. E.g. (Windows server)
- Configure the IE Enhanced Security Configuration
- Disable Shutdown Event Tracker
- Install and configure roles and features common to all Virtual Servers.
Once the Operative System is ready you will have to run SysPrep. SysPrep removes system specific data from Windows such as the computer security identifier.
Browse your file system and make a copy of the hard drive of the machine you just SysPreped and set the Read Only attribute to true. Give it a descriptive name that hints the installed OS, Service Pack level and the fact that it is a base disk. This is the drive that you will use as your base drive. E.g. WS2012Base.
Create A New Differencing Disk
From the Hyper-V manager select the action menu / New / Hard Disk. The New Virtual Hard Disk Wizard opens. Follow the prompts, when you get to the disk format section, make sure to select the same format type (VHD or VHDX) as the base drive and click next.
On the Disk Type screen select Differencing and click next.
In the Specify name and Location screen specify a name for your differencing disk E.g. DC1. Specify the location where you want this disk to reside and hit next.
In the next screen "Configure Disk", browse the file system and select the base drive you created earlier. The drive you select on this step will become the parent drive for the new differencing disk. Click next and finish.
Create A New VM Using Differencing Hard Drive
Follow the New Virtual Machine Wizard prompts until you get to the Connect Virtual Hard Disk screen. Here, select "Use an existing virtual hard disk" and specify the location for the new differencing virtual hard disk you just created.
Complete the wizard.
A few additional comments
At this point you should have a new virtual machine. In my example this VM is called DC1 and will become a domain controller. Repeat the steps above to create as many virtual machines as needed based on your template.
Using differencing disks will save aproximately n-1 times the storage space needed for the initial installation of n virtual servers. Differencing disks will also enable fast provisioning and configuration re-utilization.
In Summary Hyper-V in Windows 8 provides a very mature hypervisor that allows you to create a Virtual Machine environment on a laptop or workstation while maximizing the utilization of both storage and memory thanks to the ability to create parent - child relationships between disks and the dynamic memory feature. I look forward to further enhancements like the ability to copy and paste text and files between VMs and the host in future versions. Not having that capability at this point does not justify additional investment of time and money in a different virtualization product for the purpose of creating a virtual lab environment.
For years I had used VMware as my hypervisor of choice for virtual labs but I recently switched to Hyper-V. The last few weeks I have been getting familiar with how things work in Microsoft's virtualization environment and decided to write a quick step by step on how to get a virtual lab up and running. Such as Prostar LaptopsReplyDelete