Build a System Center Lab with Hyper-V 2012 R2 and FreeNAS

I wanted to build a System Center playground for me to play in and be able to break things and then of course fix them. What better way than a home lab. Why Hyper-V? Well, because that is what the majority of my work infrastructure is on. And because of its integration into System Center. Why FreeNAS? Because I already have a FreeNAS box that I rip all my blu-rays to for XBMC and building another NAS or SAN just for Hyper-V seemed a little redundant.

I’m not going to go into setting up FreeNAS because, well, it’s really easy to setup and there is plenty of documentation out there on how to set it up. 

I’m also not going to go into computer parts for the Hyper-V server. There’s a few blogs out there that have full parts lists. I simply went to my local Frys and got the cheapest Intel/AMD CPU and motherboard combo with 32gb of open box RAM. Being a simple lab, I don’t need ECC RAM or anything like that. The only two parts I will recommend is getting a motherboard that has or a separate Intel NIC card and if you can, SSDs for the Hyper-V storage. If you want to future proof you’re lab go for a motherboard that will support more than 32gb of RAM.

On to the build.

Setting up iSCSI in FreeNAS:

In your FreeNAS web console go to servers and make sure iSCSI is turned on, then click on the settings wrench.

 I left the default settings under Target Global Configuration

Then add a portal

Then go to Initiators tab and edit your desired initiators, I left it as default since its a home lab.
Next, go into your Targets tab, and add a new Target. Give your Target a name and set your Portal Group ID.

Now we go into the Extents tab and create our Extent and point it to the location we want to store the Hyper-V machines.
 Now we need to tell FreeNAS to associate our Hyper-V Extent with our Hyper-V Target.

And we’re done with the FreeNAS portion.

I’m going to assume if you are looking to build a Hyper-V lab that you already know how to install Windows Server. So once in Server 2012 R2 open Server Manager and click Add Roles or Features and select the server roles feature and select hyper-v. Let it run and reboot a few times.

Once its installed lets add our FreeNAS iSCSI target. Open iSCSI initiator and enter your FreeNAS IP address and the port number and connect.
Assuming your port is the default 3260 you should now be connected to your FreeNAS iSCSI target.

Now format the newly added drive in Storage Manager and open Hyper-V. Click on Virtual Switch Manager and then New Virtual Switch. Give it a name and remember when clustering Hyper-V the switch name is case sensitive and must be the same across all nodes.
Select the network type, I pick external because I want to access my VMs from machines other than the hyper-V host. If you have more than one network card, or you have teamed them you will see them as options, the Microsoft Network Adapter Multiplexor Driver is created when you team two or more NICs in Windows Server 2012. I plan to write another post on NIC teaming, Hyper-V and Virtual Machine Manager and some minor issues I ran into.

Once your virtual network is created, open Hyper-V Settings and set your virtual machine storage location to your iSCSI target you formatted earlier. In my case I put them on Z:VMs

Now we’re ready for the fun part, installing System Center 2012 R2. We could sit around and hand install all the prerequisites and go through the wizards of each System Center component, but that would take a while and I’m not about clicking through wizards unless I have to. So this is where I point you to someone much smarter than me, Johan Arwidmark’s Deployment Research Hydration Kit. Follow his instructions with the Hydration Kit and within a few hours you can have all of System Center 2012 R2 deployed in your lab.

Yes you can run all of System Center 2012 R2 in a lab with 32gb of memory with Dynamic memory allocation. Remember its just a lab, not production.
And our finished server, with the first book I bought my son who was born during creation of this lab.
The book is actually really funny. Maybe someone should update it to why is there a Hypervisor in the house?

I have had my lab setup for a while and am just now getting around to writing about it. I plan on converting my FreeNAS box to a Server 2012 R2 file server and adding an additional host to make a cluster, because why not? Stay tuned.