Create a LAN between VMs in Hyper-V

This post will explain how to set up a LAN between two virtual machines (VM) in Hyper-V.

Info. This post is tagged with “my notebook”. That means, that the purpose of the post is mainly for me to remember something I did. The information here might be incomplete, hard for others to read or contain faults and misconceptions. I’ve chosen to publish my notes, please help me improve them by feedback in the comments section. I hope someone will gain something from these kinds of notes.


  1. Create a private switch in Virtual Switch manager in Hyper-V Manager.
  2. Create to VMs with the Windows Server 2016 OS.
  3. Connect the VMs to the private switch.
  4. Set unique IP addresses on each server (node), use IPv4.
  5. Turn off the Windows Firewall (only in lab environment).
  6. Test communication with Ping.



Read more about Hyper-V, Virtualization, Virtual Machines (VMs) and Windows Server 2016 here: [2019-03-12]

Back to Index.


I am a developer with background in SQL, java and C#. Recently I had to roll up my sleeves to understand basic network and Windows domains (I truly don’t know anything about these subjects). I decided to make a lab environment in Hyper-V to test things out. This post will explain the most basic portion of that environment.

Back to Index.

Create a private switch in Hyper-V

First of all, we need a switch. This is how a switch in real could look like and its symbol in a diagram:

Info. A switch’s job is to receive, process, and forward data to the destination device. The device in our case is between two servers (or nodes as network people label servers).

This is how to create a virtual switch in Hyper-V:

Click on virtual switch manager:

virtual switch manager

A wizard will pop up. Click New virtual network switch, choose a private switch and click the button Create Virtual Switch.

private switch

Now, name your switch and click apply:

private switch

You will now have a private switch. You access and configure it from the same many as you created it in Virtual Switch Manager.

Back to Index.

Create two VMs

To create a network of computers, in our case between servers (nodes), we need at least two of them. Go on and create two VMs with Windows Server 2016 OS (trail version).

You can read more about how to create VMs here:

When you are done, you should have two machines up and running in Hyper-V. (Both connected to the same private switch):

servers in hyper-v

If you forgot to add the switch while you created the VM, you can do it later from the settings menu of a VM:

switch settings

Back to Index.

Set IP addresses on the two nodes (servers)

Every node on a network needs an IP address, we will be using IPv4 (IPv4 Internet Protocol version 4) to be able to communicate with each other.

We are dealing with a private network here. The standard that simplest fit our needs here says that we can use IPs in the range of to

This will be the IPs for the servers:

Server name IP address

(I have just chosen numbers I like in the range described above.)

Info. We will be using a subnet mask This post wont cover how this number is working. A very short description is that the purpose of the subnet mask is to calculate if a given IP is available on the same network or does the computer needs to search outside the network. How this is done won’t be explained here. Just stick with (default value) and everything should be fine.

To set an IP open Network and Sharing Center (Start-> Control Panel-> Network and Internet-> Network and Sharing Center) then, click on Ethernet (That is our connection through the private switch):

network and sharing center

Now, click on properties:

ethernet properties

In the window that pops up, click on Internet Protocol version 4 and then, properties:


Assign an IP according to the table:

IP address

Note. Don’t forget to assign an IP to the other server as well.

After you followed these steps, your two servers will have its own IP address.

Back to Index.

Windows Firewall

Before we try the communication between the two machines, we must consider windows firewalls settings. Normally in production you should make a firewall rule for the kind of traffic you want to open up through the firewalls. However, this is just a lab environment running in your Hyper-V with no Internet connection. Just make it simple and turn the Windows Firewall off. Then we don’t have to worry or troubleshoot any firewall rules.

This is how to turn the Firewall off:

Click on Windows Firewall Public: On:

firewall server manager

Click on Turn Windows Firewall on or off:

turn off firewall

Finally, turn of the Firewall:

turn off firewall

Back to Index.


Ping is an ancient program in computing that dates back to the 80’s. Most computers and OS:s implements ping. The purpose of the program is to see if another computer is available on the network.

Info. The creator of ping named the program after navy sonar system. He thought it sounds ping when they are looking for e.g. submarines. So, looking for computers on a network is an analogy derived from sonar scanning of submarines.

You can use the program from the command line. Start-> Command Prompt:

Just type ping and the IP you want to test (successful ping):

ping success

On success, it shows a reply and the response time.

This is how it looks if the test fails:

ping failed

Back to Index.


In this post, we have learned how to create a private network in Hyper-V with two servers (nodes). We have assigned IP addresses (IPv4) to them and tested the connection.


Wikipedia Private network [2019-03-11]

Wikipedia ping (networking utility) [2019-03-12]

Back to Index.

One Response to “Create a LAN between VMs in Hyper-V”

Author's gravatar

Thanks. It was very helpful for me.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.