Setting up Hyper-V networks can be tricky, and the current online tutorials do not cover every aspect. Thus, asking ChatGPT results in vein. I realize that the value of human-made tutorial is still non-negligible today, thus I am writing down my intuitive solutions.

The problem

I am using a Hyper-V virtual machine on a Windows Server 2022. The virtual system is Windows 10 Professional Edition. I want to set up the network so that I would be able to access the internet from the virtual machine.

Although the following solution has only been verified on my OS specified, the same principle applies to other combination of local/VM operating systems.

My network environment

The hospital uses static IP. As the ethernet socket is limited, we have to use switches as hubs. Currently, we do not require the association of MAC and IP.

Suppose I have a upstream switch whose gateway is, thus, all IPs from this router are assigned in the 192.16.2.x range with a mask of

My server has two ethernet interfaces. One of the ethernet interface is connected to the hub, to provide internet access to my host machine. The corresponding IP is The other LAN port is not in use.

The solution

There are two types of network architecture. The first one is sharing the local adapter. The second is via bridge.

Sharing local adapter

Sharing local adapter is the most useful and common way for the VM to connect to the internet. It requires only one internet interface.

Sharing local adapter

In this method, you first create a virtual switch, and configure the network sharing of your host LAN connection. They IP of the virtual switch is by default.

Then in the virtual machine, configure the adapter, and the IP should be any address in the IP range of 192.168.137.x. Here, we suppose the IP is The gateway should be configured to be

Adapter Name LAN1 LAN2 vEthernet Internal Ethernet
Computer Host Host Host Hyper-V
Cable ? Yes No N.A. N.A.
Gateway N.A. Blank
Shared? vEthernet Internal N.A. N.A. N.A.

Via bridge

In this scenario, we have to use a LAN port on the ethernet interface for the virtual machine. Thus, the virtual machine acts like a computer in the same network range as the host. This may avoid the need for network penetration, and allow for direct access of the VM by other machines.

Via birdge

With this method, if you have $N$ VMs, you need to prepare $N+1$ static, public IP addresses. The cable should also be plugged to the other LAN port on your server, and the corresponding adapter should be set to “bridge” with the virtual adapter. This adapter takes a unique IP, such as here. Then, the remote adapter can be configured just like a local machine.

Adapter Name LAN1 LAN2 vEthernet Internal Ethernet
Computer Host Host Host Hyper-V
Cable ? Yes Yes N.A. N.A.
Gateway N.A.
Shared? No N.A. N.A. N.A.


If you have an extra LAN port, you can have VMs without using DHCP. This can be very convenient, but you are exhausting the IP resources very fast.