Everyone has used a lab environment either to test new technologies or to have a safe environment to test scripts or any other configuration, for some hypervisors like VMWare you need to have licenses to use networking devices like switches.
On Oracle VirtualBox you need to have advance networking and Linux skills to create some Virtual machines using Linux as Operating system and then create the routers and switches.
After you have this Linux computers and configure the Switch or router role then configure your internal network.
Another option is creating a Windows server with the NAT role installed, but again we need to create another computer that needs storage on the Hard drive, memory and CPU from the host, sometimes we don’t have enough resources for this.
Fortunately, we have another free option using Hyper-V and creating a NAT switch, in my experience using this option my environment is faster than using another computer as NAT server.
NOTE: If you need help to install the Hyper-V feature on Windows 10 follow this process How to configure Hyper-V on Windows 10
This is my virtual environment with three virtual computers connected to a default switch:
The complete design is as follow:
That means the host cannot provide internet access to the Virtual machines because we are assigning a different IP range.
In order to solve this problem lets create a new virtual switch and configure it as NAT switch.
To complete the configuration open PowerShell ISE as administrator on the host computer.
We are creating the switch as shown below:
The next sped is create the virtual interface for this network
And finally, we need to create the network
Make sure you connect the network interface of the Virtual machines (In my case VM1, VM2, VM3 and VM4) to the NAT Switch, immediately these computers will have internet access.
Thanks for reading!
Now we can use Hyper-V as hypervisor on Widows 10 and its very easy enable this feature. We have different ways to do this, the first its via GUI and the second, of course using PowerShell.
To enable this feature using GUI lets follow these steps:
- From Run menu type control to open control panel
In Control panel go to programs and features
then Turn windows feature on or off
Check Hyper-V and click on Ok
Click on restart and the Hyper-V feature has been added.
Now lets add the same windows feature but using PowerShell, you need to open PowerShell as administrator, then run this line:
PS C:\> Get-WindowsOptionalFeature -Online -FeatureName “*Hyper*” | Enable-WindowsOptionalFeature -Online
And confirm to restart your computer, as shown below:
Thanks for reading and I hope this helps.