Hyper-V 101 - Your own local data center
This is the second post in a series of twelve in Tim Fords Entry-Level Content Challenge.
In this blog post, I will share a very simple setup that I use for Hyper-V machines (and have helped setup for numerous colleagues). But before you start, put a beer/soda in your fridge. You will eventually need it…
I have been working with virtualization technologies on my laptop(s) since the early 2000s – VMWare, VirtualBox and lately Hyper-V. Having local virtual machines makes it so much easier to play around with new and old technology without cluttering your Windows installation with programs, you don’t need all the time. Another advantage is that you don’t have to worry about dependencies between different programs and/or versions.
Your host computer must have these prerequisites:
Windows version 8 (or later) in editions Pro or Enterprise
64 bit Windows
Your BIOS must support BIOS-level Hardware Virtualization
You must have 4GB of memory
In order for you to use Hyper-V, you must turn the feature on in Windows:
Make sure you click both features:
The Hyper-V manager is the management tool for your virtual machines and networks. Start it by searching
and you will see something like this:
Setup networking on the host
Before you go wild creating virtual machines, it is a good idea to setup a virtual switch. This enables you to talk from your host OS to the virtual machines in a (possibly) closed network. From the Hyper-V manager, visit the Virtual Switch Manager:
I normally create two virtual switches:
an internal switch, and
an external switch
Create the internal switch (which I name “Internal virtual switch” to remember the scope for the network):
Use this virtual switch to create a closed network between your host OS and the virtual machines.
After the switch has been created, go to the Windows Network and sharing center, and choose “Change adapter settings”
Right-click the internal switch:
Here, I configure the IPv4 network for the c-class 10.0.0.0/255, and set the IP to 10.0.0.1:
(in normal-speak, this will make the IP address 10.0.0.1 the gateway for the virtual machines and the 10.0.0.* network available to use for the VMs). If your host is already connected to a 10.0.0.* network, then choose another subnet reserved for private networks, like 10.1.0.* or some other one (see https://en.wikipedia.org/wiki/Private_network)
In Hyper-V Manager, create an external switch (which I name something like “Internet virtual switch”), if your VMs need to access networks outside the host machine:
You need to bound the external switch to a physical network card on the host computer. Chose one that is active the most (or create several external switches)
Setup a share on your host
Create a directory on your host (I use c:\hyper-v-shared) and right-click it to setup sharing:
Sharing is configured on the Share tab:
You can use this share to transfer files between your host OS and your VMs.
Firewall host settings
You want your host OS to be able to speak to the virtual machines. One way is to disable the firewall on your host (NOOOOOOOOOOO! Don’t even think about it! Just don’t.) Instead setup a firewall rule to allow network traffic on the 10.0.0.* network (or whichever private subnet you chose).
Visit System and Security in the control panel, choose the Windows Firewall menu, and click Advanced Settings:
Create a new inbound rule
choose custom rule
which should apply to all programs
and all protocols
Add full c-class IP range (write 10.0.0.0/24 for the subnet):
and set the rule to allow traffic through:
on network profiles, you choose (I just keep the standard settings):
Finalize the configuration by giving the rule a name, and click Finish:
Your first virtual Machine
Now back to the Hyper-V Manager and choose New->Virtual Machine
give it a name
and choose Hyper-V generation (I choose generation 2, just because)
Put in some RAM sticks:
a networking card plugged into the internal switch
and a hard disk (which is just a file on a hard disk on your host computer). I normally just give it a name and use the default settings:
Choose to install an OS later and finish the configuration:
Back in the Hyper-V manager, choose the newly created VM and click Settings:
First, add a DVD drive to the machine
Change the boot order to boot from the DVD
and add some more CPU horse power (I always go all in and choose the number of processors to be equal to the number of physical cores on my host):
If your VM needs internet access, then add a second network card from the Add Hardware menu:
Congratulations! You now own your own local, virtual server.
Get an OS to install
Get Windows Server install media (I always use the ISO files) either from MSDN (if you have a subscription), or download a free trial from the TechNet site (GoogleBing “download windows server trial”).
In the Hyper-V manager, choose the newly created VM, click Settings and plug in your ISO file into the DVD drive:
Now, start your newly created VM from the Hyper-V Manager, boot from the DVD and install Windows Server 2012R2 Standard edition with UI (or some other OS of your choice)
Post-installation tasks on the VM
After installing Windows server, setup the network adapter on the network card pointing to the virtual internal switch to use an IP address (eg. 10.0.0.30) from the private range 10.0.0.* and set the default gateway to 10.0.0.1:
To test that network connections are OK, open a command prompt and ping the IP (I use 10.0.0.1) for the host gateway
ping -t 10.0.0.1
The –t option for ping keeps pinging until you press CTRL-C. A great way to test network is to keep pinging until you get a hole through.
Now test that you can access the share on the host. Open a Windows Explorer and type in
into the address bar:
You will need to login to the host using your host username and password
Finally, if you downloaded a free 180 days trial version of Windows server, you might need to extend the evaluation period (you can see a status of this in the lower right of the desktop:
To extend the evaluation period, open a command prompt, type
and press enter:
You need to restart the VM for the change to kick in.
That’s it folk. Now go nuts with virtual machines… But first, open your fridge and get that nice, cold beer/soda. You deserve it.
And while you zip it, go take a look at the Hyper-V documentation