samedi 28 mars 2015

Set up a virtual infrastructure at home with Windows 8 + Hyper-V Manager and a Synology DS412j

Introduction : Environment

1) A computer:
  • ASUS P8Z77-V PRO
  • Intel Core i7-3770K (3.5 GHz)
  • Corsair Vengeance Series 16 Go (4 x 4 Go) DDR3 2133 MHz CL11 Blue
  • Gigabyte GeForce GTX 650 Ti 2 GB GV-N65TOC-2GI
  • Intel SSD 520 with 180GB
2) NAS Synology DS412J with 4*2TB configured as RAID 10
3) Network 1GB
 -----------------------------------------------------------------------------------------------------------
First thing: make sure your CPU can handle virtualization. This is the case of most processors today, but you will still have to activate it in your BIOS.
How to activate will depend on your BIOS[VB1]  but, in general, you will find the words "Intel Virtualization Technology" (in case of an Intel processor).
Your processor must also be able to manage the SLAT (Second Level Address Translation). To verify that your CPU can handle this technology, Mark Russinovitch helps us again.

Copy it to C:\Windows\System32\

Then, in a command prompt, simply type the command:
 

coreinfo -v

EPT       *      Supports Intel extended page tables  (SLAT)

If you see the "*", your processor runs the SLAT.
If instead of the "*" you see a "-", you cannot benefit from Hyper-V Manager.

-----------------------------------------------------------------------------------------------------------


1) Creating a LUN to host our virtual infrastructure


In order to store the virtual machines that we will install on our Hyper-V node, we will create a first LUN on our Synology NAS.
The NAS Synology runs DSM 4.1 and I must say that the creation of LUN is made extremely easy by Synology.
It is a child's play as you will see.
This is the "Storage Manager" application that will allow us to do this operation. The application is installed by default on DSM 4.1




Click on the iSCSI LUN tab.



This screen allows you to give a name and size to your datastore. If you have multiple volumes, you can also decide on which volume you want to create your datastore.
Here, you can also choose whether or not you want to do the "Thin Provisioning".




Quick reminder on what is Thin Provisioning:
It is actually possible to allocate storage on demand. The aim is to maximize the use of your storage. It therefore reserves only what we actually use. The second underlying mechanism used by Thin Provisioning is called the over-subscription. This is a mechanism that allows a server to view more storage space than has been physically reserved.


Now, we can create the iSCSI target. Using the iSCSI Target service will give our future virtual machines the illusion to that the disk is a local drive. The result will be a virtual disk stored on our Synology NAS.
Remember that the iSCSI protocol encapsulates the SCSI protocol in TCP/IP packets. The iSCSI protocol uses client-server architecture. In side A, we got the client, also called "initiator", and in side B, we got the server named "target". Usually, the target is actually a storage device that has an iSCSI interface. This part is the one that the NAS emulates.



The Synology NAS offers CHAP (Challenge Handshake Authentication Protocol) authentication. This protocol is defined by RFC 1994  . We will thus enable authentication to secure access to our storage space.
You must enter a user name and a password. The password can only contain letters and numbers. It must contain between 12 and 16 characters.



Confirm the settings as suggested in the next screen.  



Here it is! We got our newly created LUN. We still need to have it detected by our Hyper-V node to be able to start creating virtual machines on it. This is the main purpose of this tutorial after all :-)



2) Hyper-V Manager installation


On Windows 8, it is extremely simple.
Move your mouse in the bottom left corner of your screen, right click to show the context menu and click on "Programs and Features".



Pull down the scrollbar to see "Hyper-V". Click the [+] to expand the root.



Check "Hyper-V Platform" and click on [OK].



After restarting, Hyper-V is installed. Very easy, isn’t it? It's easier than  virtualiser ESXi   ;-)


3) Create a "local" drive from a LUN created on the NAS


The title is not entirely accurate. What we will do here is use the functionality of the provision of a target through:
  •          the server (our NAS) on which we have activated a target that is mapped to our LUNs
  •          iSCSI client also called "initiator". The advantage is that, again, in Windows 8, it is native to the OS.
In other words, this will allow us to give the illusion that our Windows 8 has a new local disk but it is simply a LUN mounted on the NAS. One benefit of this is a shared storage on RAID10 configured on the NAS.
Press [Windows] + [F]> Settings> "iSCSI" and click "Set up iSCSI initiator".





You can accept the warning alerting you that the service is required to be started in order to benefit from the features of the initiator. Clicking "Yes", you automatically configure the service to "Automatic startup". Nice.



Fill in the IP address of your NAS in the field "Target". Then click on "Quick Connect ...".



If everything goes well, you will see your Target.
Some of the smart guys among you will notice that the IQN is the same as the one you see on the Synology as target. Good news. Press "Done".




Ok, now you can see the connection in the active window. Click "Connect".


If you have followed me for the activation of the authentication with CHAP protocol, click on "Advanced", we need to configure it.



It's very simple, you just need to check the "Enable CHAP log on" box, encode the name you have chosen and the "Target Secret." This is actually the "secret" that the client and the server possess each other. Indeed, the CHAP is basically sending a "challenge" that can be raised through the secret represented by the "password" encoded previously on  the NAS.
Click "OK".



And "OK".



"Voilà", our target is now connected. This is perfect, we will be able to detect our new drive in Windows.



Let's go back to the lower left corner of your screen and click on "Disk Management".



The disc should appear that way. If it is not [VB1] online, you need to right click on your drive and click on "Online".
Then right click in the "Unallocated" zone and "New Simple Volume".



The rest is no more than a classic format disk in Windows.









And here are your efforts rewarded! You now have a new disk seen by your OS as a local drive.



4) Create a vSwitch 


In order to connect our future virtual machines to a network, we will create a virtual switch on which the virtual machines will connect.
From the Start menu, you can see the new tile "Hyper-V Manager". Click on this tile.



Here is the Manager interface. The name "NODE1" is the name of my Windows 8 computer.

Click "Virtual Switch Manager".



The type of switch depends on what you want to do with your virtual infrastructure. My goal here is to put my virtual infrastructure in my physical LAN. My virtual machines will be accessible to the physical machine on my network. This is the Bridged Mode in VMWare. It is the External mode in Hyper-V.
This is not necessarily required and will depend on what you want to do.
The Switch "Internal" is the same thing that the Nat Mode in VMWare. VMs see the physical node but do not have access to the network node.
Finally, the Private type switch can be used if you want a sub VMs network. This means that VMs can see other VMs but cannot see the node (your physical machine) or the physical network.



A message warns you that you computer may lose its network connection. Do not worry, we click on Yes.



Simply enter a name, select your network card and "Ok".



The switch is created and by visiting the network center, you can see the change.



5) Create your first virtual machine


Let’s start the creation of a VM itself.
Click on your node and "New" > "Virtual Machine".






Name your VM. In my case, it will be a domain controller. We will use our storage space created in step 3. Click "Browse ...". 



I have created on the disk G:\ (which is the LUN on the NAS) the tree folder Lab>VMs. You are free to do what you want, then click "Select Folder".



Click on "Next".



Assign the RAM you need for your VM and click "Next".



Select the switch we created in point 4.



Here is the creation step [VB1] of the .VHDX disk. Nothing special. I chose 40 GB for my DC.


You can, at this stage, assign to the VM an .iso containing the image you wish to install. This is where I point my ISO Windows Server 2012. You can also provide a .vfd (floppy disk) or install via the network (with a PXE server, for example).


Click on "Finish".



Then, you have to start the VM with the start button in your Hyper-V Manager.



And connect to it to follow the steps of the installation.





Now you have all the basics needed to achieve all your tests at home!
Enjoy and virtualize well ;-)

Aucun commentaire:

Enregistrer un commentaire