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!
2 thoughts on “How to configure a NAT switch on Hyper-V”
Thanks for this guide, mate. This was very helpful. I’ve been trying to wrap my head around Windows Server 2016 but my Sandbox environment couldn’t advance due to my Server and Clients being unable to talk to each other. NAT was the solution! Thank you very much!
Thanks for your comment, Tim. I’m glad to help.