Setting Up a Hyper-V VM Lab on Home Network

When I started tinkering with Hyper-V, I was looking for some guidance on setting up a VM lab behind a cable modem and a router. While I found plenty of how-to posts on specifics of Hyper-V tasks, I found little in terms of networking and other best-practice concerns specific to a home network. Granted that the Hyper-V activities don’t have to be any different on a home network vis-a-vis another kind of network, but I didn’t know enough at the time to be assured about it. Now, I have learned some lessons the hard way, and with this post, I am trying to compile and share my thoughts and experience related to such a setup.


I had the following requirements for this lab setup:

  1. The lab will run a Windows domain.
  2. Some VMs will not be in the domain.
  3. Every VM will be able to access the Internet.

Setup Considerations

I had numerous questions and dealt with several issues during this setup process. Addressing these questions and issues guided my decision making as discussed below.


One of the first questions that we need to answer is, “What hardware do I need?” The basic requirement for the hardware turns out to be that the CPU should support virtualization. Most servers today will probably meet this requirement, but it won’t hurt to check the CPU features on server under consideration.

Another item to address is the resource capacity such as the number of CPUs and the memory capacity on the motherboard. The answer really depends on the number of VMs you plan to use concurrently. I went with 2 quad-core CPUs and 32GB RAM capacity. I started with 16GB installed and later expanded it to full capacity. One thing to remember about server RAM installation is that there are usually restrictions on each  memory stick capacity and the combinations in which the sticks could be installed. It is important to consult the server manual about the allowed combinations and the slots to use for those combinations while buying and installing memory.

As hard disks are cheap, we may consider loading up the server to utilize the available slots. However, the bigger question to answer is whether to RAID or not? If yes, then which RAID configuration? Is there a hardware RAID controller in the server? My server had a software RAID controller only, and I went with RAID 1 to keep identical copies on two disks. Basically, that gave me redundancy with no performance benefit. As the number of VMs grew, I realized that they were all trying to access the same disk resources simultaneously. Further, I was also restricted in the kind and number of disks I could install in the remaining slots. After some research and heartburn, I rebuilt the setup without any RAID. My thought process was that this was just a lab setup, and I figured out a backup approach to ease the restore process should there be a disk failure.


One of the first questions on the software side is, “Which virtualization software should I use?”. This one was easy as I wanted to learn Hyper-V. The VMWare HyperVisor was another option. The free HyperVisor license has some limitations, though no big problem for this setup.

Once decided about Hyper-V, the next question was about the host OS edition (OS installed on the physical server). Initially, I went with the 2008 R2 Server Core with Hyper-V. This provided a minimal text-based interface for managing the  server, and I was using the Hyper-V Manager client (remote management) on Windows 7 to manage the VMs. It was a nightmare to  make the client connect, and every so often it would stop connecting to the Hyper-V server. I found a utility that temporarily eased my pain, but I was amazed that there was a need for someone to create a utility to configure the client and server for remote management. On the other hand, I have toyed with VMWare HyperVisor a little bit on another server, and the remote management just works without additional setup.

Another issue that I ran into was that certain Windows updates would keep failing on the server. Therefore, I ended up rebuilding the setup with full Windows 2008 R2 Server with Hyper-V role as the host OS. Now, I manage the VMs on the server via Remote Desktop using Server Manager on the host OS (no remote management). In this setup, I have not encountered any of the issues mentioned above.


My key networking concern was about the co-existence of the existing network and a separate Windows domain for the VMs. While it was a bit confusing earlier, the setup turned out to be quite simple. Each VM participates on two networks – a private virtual network (say, with IPs 10.0.1.*) and an external virtual network (say, with IPs 192.168.1.*). In other words, there are two virtual NICs (Network Interface Cards) on each VM. One is connected to the private virtual network for the Windows domain, and the other is connected to the existing network. The connection to the existing network is needed by each VM to connect to the Internet. There are probably other network configurations that would work, but this is what I set up.

Note that the virtual NIC (VNIC) for the private virtual network is not needed on any VM that would not participate in the Windows domain. I did encounter some cryptic issues in connecting to the Internet from the VMs in the Windows domain, even when everything seemed to be working fine. Finally, I ended up with static IP configuration for the VNICs connected to the private virtual network, and DHCP-provided IP addresses for the VNICs connected to the external virtual network. However, I set up static IP reservation for these VNICs in the router. With this setup, all VNICs get fixed IP addresses, and all network connectivity is working properly.

My server hardware has two NIC cards. I have dedicated one to the external virtual network and use the other for connecting to the Hyper-V host.

Windows VM Cloning

Once we have created a VM with the base OS install, it’s easy to create another VM by copying its virtual hard disk (VHD) file. We need a separate install and VHD copy for each OS type/edition. For example, we need separate VHDs for Windows 2008 R2 Server, Windows 7, and Ubuntu Server. For all Windows VMs cloned by copying the VHD file, it will serve you well to run SysPrep with the Generalize option selected. This needs to be done right after the cloned VM is started up for the first time. This process prevents duplication of internal IDs assigned by Windows. Until I learned about SysPrep, the cloned VMs were unable to participate in the Windows domain security properly.

VHD Location

One bottleneck mentioned above is the contention on the disk resources. Therefore, I decided to distribute the VHDs among all the hard disks on the server. This approach allows multiple VMs to be working off separate disks concurrently. Very likely, there will still be multiple VHDs on each disk (once there are more VMs than disks), but that is better than all VHDs being on one disk.

Linux VMs

Linux is not an “enlightened” (I do not like this term, but I am using the Hyper-V jargon) guest OS for Hyper-V. Basically, it is not designed to fully participate in the Hyper-V virtualization scheme. I tried a few recent versions of Fedora as the guest OS, but couldn’t get the mouse to work on it. I also ran into some networking issues. On the other hand, setting up a 64-bit Ubuntu VM was a piece of cake. The mouse worked and the network configured automatically.


The following diagram (click to enlarge) summarizes my setup.

Hyper-V VM Lab Setup
Sample Hyper-V VM Lab Setup

I will update the post with additional details if/when I recall them.

Lost Internet Access on Fedora Core 14

Recently, I ran into a very frustrating problem. I have a Fedora Core 14 machine which had been running without issues for a long time. I have been updating it regularly. One day, I decided to restart it for some reason. It came back fine but lost Internet access. The LAN networking was just fine.It actually took me a while to figure out that the Internet connectivity was broken.

After some research, I concluded that the default gateway configuration had been lost. Apparently, one of the updates changed the networking behavior. Earlier, it used to obtain the default gateway automatically, but it wasn’t doing that now.

I tried setting the default gateway by editing files, etc. but it would get overwritten. Finally, the command that did it for me was the following:

route add default gw <router_IP_address>

Restoring Tomcat6 after Fedora 14 upgrade

FedoraI had Alfresco 3.2r2 deployed in tomcat6 on Fedora 12 64-bit Linux. As it has become so easy to upgrade Fedora now, I decided to upgrade to Fedora 14. I backed up the data directory and the Alfresco webapp directory (because it had customized configuration), and then started the upgrade using preupgrade. It downloads everything that is needed for the upgrade, and the system remains available during this period. The upgrade starts on the next reboot.

The upgrade completed without any problems. However, the tomcat6 service won’t start up. There seemed to be multiple issues, such as the conf directory being empty. Updating tomcat6 using yum didn’t do much. So I removed and reinstalled tomcat6 as follows:
yum remove tomcat6
yum install tomcat6

That restored the conf folder but now I ran into class-not-found exceptions. It turned out that the Tomcat jars were present in a location different from the expected one. On further research, I discovered that the complete tomcat6 deployment consisted of several packages (tomcat6-lib, etc.), and the installed packages couldn’t be relied upon even though yum believed that they were installed/configured properly.

I decided to remove the tomcat6* packages using yum remove for each package listed by
yum list tomcat6*.

Then I installed tomcat6, which also installed the packages that it required. Tomcat6 was up and running in the first attempt after that. Alfresco also came up without any problem after I restored its webapp folder.