Part 2 - The Host and Hyper-V Configuration
04-12-2020 5:39 PM
Disclaimer: All information and content in these blog posts is provided without any warranty whatsoever. The entire risk of using this information or executing the provided content remains with you. Under no circumstances should Microsoft, its author, or anyone else involved in the creation of these blog posts be held liable for any damage or data loss.
In my previous blog post Part 1 I did a quick hardware configuration walk-through and installed Windows 10 on my host. In Part 2, I will walk you through the Hyper-V configuration and build a Virtual Machine for my Domain Controller (DC) where we in Part 3 will be setting up Active Directory, DHCP, and DNS.
After finishing the Windows 10 installation the first thing I want to do is change the computer name to eg. OSDSUNE-LAB-01 and then check for Windows Updates. Since my Windows 10 image is offline serviced every month, Windows Updates won't find anything exciting!
If you don't offline servicing your Windows 10 image, my recommendation is that you run Windows Updates and get the latest cumulative and other updates installed before moving forward with the configuration.
Step 1. Type "Check for updates" in the search line next to the start button, and click "Check for updates"
Windows 10 (1909) - Windows Update
Step 2. Click "Check for updates" and wait.
Windows 10 (1909) - Windows Update
Step 3. After a few seconds it should start downloading and install required updates for the host.
Windows 10 (1909) - Windows Update
Step 4. When it's done, reboot the host.
After a reboot, log into the host again and we will now be adding the Hyper-V feature role to the host.
Step 1. In the search line, type "Add features" and click "Turn Windows features on or off"
Windows 10 (1909) - Add Feature
Step 2. Check the "Hyper-V" box and click "OK"
Windows 10 (1909) - Add Feature
Step 3. Click "Restart now"
Windows 10 (1909) - Add Feature
Step 4. After a reboot, log into the host and check for Windows Updates once again. In the search line, type "Check for updates" and click "Check for updates". The reason for this is that since we have add a new feature to Windows it need to re-apply the cumulative update in order for the feature to function correct.
Windows 10 (1909) - Windows Update
Step 5. As mentioned it will re-apply the latest cumulative update. (And yes I has gone to the dark side...) reboot the host when it's done.
Windows 10 (1909) - Windows Update
After a reboot, log into the host again and we will start setting up the Hyper-V role.
Hyper-V is Microsoft's Hypervisor, which give you the ability to run Virtual Machines (Guests) on a Physical Machine (Host).
Hyper-V was introduced back in 2008, a lot has happened since then, and today Hyper-V is a great alternative to other Virtualization Technologies from eg. VMware and Citrix.
I will be using Windows PowerShell to create a Virtual Switch that uses Network Address Translation (NAT), this will keep the LAB environment separate from the rest of the network, but still provide internet access to the Virtual Machines.
I will not be diving deep into the details about Virtual Switch or NAT, so please read this excellent blog on this topic by Aidan Finn if you need more information.
Step 1. Open Windows PowerShell in Administrator elevated mode.
PowerShell - NAT Virtual Switch
Step 2. To create the Virtual Switch run the below New-VMSwitch command.
New-VMSwitch -SwitchName "NAT Switch" -SwitchType Internal
PowerShell - NAT Virtual Switch
Step 3. The below New-NetIPAddress command, assigns an IP address to the Virtual NIC. Which also will be the default gateway IP address for the NAT Network that we are creating.
New-NetIPAddress -IPAddress 192.168.0.1 -PrefixLength 24 -InterfaceAlias "vEthernet (NAT Switch)"
PowerShell - NAT Virtual Switch
Step 4. The below New-NetNAT command assigns a private range of IP addresses that the Virtual Machines will use on the Virtual Switch we have just created.
New-NetNAT -Name "NAT Network" -InternalIPInterfaceAddressPrefix 192.168.0.0/24
PowerShell - NAT Virtual Switch
We have now create a NAT Virtual Switch that will keep the LAB environment separate from the rest of the network, but still provide internet access to the Virtual Machines - Now That's Awesome!
😎
Now that we have configured the Virtual Switch, it's time to launch the Hyper-V Manager and configure a Virtual Machine for the Domain Controller.
Step 1. In the search line, type "Hyper-V" and click "Hyper-V Manager"
Windows 10 (1909) - Hyper-V Manager
Step 2. Right-click on the Hyper-V Server and click "Hyper-V Settings..."
Windows 10 (1909) - Hyper-V Manager
Step 3. You don't have to perform this step, but by habit I like to change the default path for Virtual Hard Disks and Virtual Machines. Leave the rest as default and click "OK"
Windows 10 (1909) - Hyper-V Manager
Step 4. Open File Explorer and go to "C:\Hyper-V", confirm that the folders has been created.
Windows 10 (1909) - Hyper-V Manager
Step 5. Right-click on the Hyper-V Server again, but this time you click "New" and then "Virtual Machine..."
Windows 10 (1909) - Hyper-V Manager
Step 6. Click "Next"
Windows 10 (1909) - Hyper-V Manager
Step 7. Enter a name for the Virtual Machine (DC) and leave "Location" as default and click "Next"
Windows 10 (1909) - Hyper-V Manager
Step 8. Select "Generation 2" and click "Next"
Windows 10 (1909) - Hyper-V Manager
Step 9. Type in the amount of memory (RAM) you want to dedicate to the Virtual Machine (I'll give a DC server, 4 GB of memory). Uncheck "Use Dynamic Memory for this virtual machine" and click "Next"
Windows 10 (1909) - Hyper-V Manager
Step 10. Now select the newly created "NAT Switch" from the drop-down menu and click "Next"
Windows 10 (1909) - Hyper-V Manager
Step 11. Select "Create a virtual hard disk" and enter a name (DC.vhdx). Leave the "Location" and "Size" as default and click "Next"
Windows 10 (1909) - Hyper-V Manager
Step 12. Select "Install an operating system from a bootable image file". Enter a path or browse to the "Windows Server 2019" ISO file and click "Next"
Windows 10 (1909) - Hyper-V Manager
Step 13. Review the settings and click "Finish" to create the Virtual Machine.
Windows 10 (1909) - Hyper-V Manager
Step 14. We should now see a new Virtual Machine in the Hyper-V Manager.
Windows 10 (1909) - Hyper-V Manager
Step 15. Right-click on the Virtual Machine and then click "Connect"
Step 16. Select "File" and click "Settings..." or click Ctrl+O to enter the settings for the Virtual Machine.
Windows 10 (1909) - Hyper-V Manager
Step 17. Select "Processor" and change the "Number of virtual processors" to at least 2 and click "OK"
Windows 10 (1909) - Hyper-V Manager
Step 18. Now click "Start"
Windows 10 (1909) - Hyper-V Manager
Windows Server 2019 - Installation
And that's it, folks! This should conclude the host and Hyper-V configuration. In Part 3 I will walk you through the installation of Windows Server 2019 on my Domain Controller and we will be setting up a basic Active Directory, DHCP, and DNS configuration.
If you have any questions regarding this topic, feel free to reach out to me. I am most active on Twitter!