Can A Hyper-V VM Has the Same IP as Host?

When using Hyper-V virtual machines, have you ever wondered can you set the Hyper-V guest IP address same as host? This article will answer this question.


By Crystal / Updated on July 15, 2022

Share this: instagram reddit

Case: Is my Hyper-V VM IP address the same as my host PC’s?


Can I get my Hyper-V connection to share the same IP address as the Host server? I had them both setup and using Static IP addresses but there were issues and I was asked to set it up so they both shared the Static IP that the host is using.

- Question from

IP address is a unique numerical identifier assigned to each device, is how devices and websites communicate with one another. When running a virtual machine (VM), for example, on the type-1 hypervisor Microsoft Hyper-V, you may have the same question as the above case: Does a virtual machine have its own unique IP addresses? Can a Hyper-V VM have the same IP address as the host?

IP Addresses

The answer is that a virtual machine can have the same public IP as the host, but the private IP must unique. In this article, I will introduce what this means and how to configure Hyper-V same IP as host.

What are public IP and private IP

A public (or external) IP address is an IP address that can be accessed directly over the internet and is assigned to your network router by your internet service provider (ISP). A public IP address helps you connect to the internet from inside your network, to outside your network.

A private (or internal) IP address is the unique address that your network route assigns to each device within the same network. This is how devices on the same internal network communicate to each other. When you connect to the internet through your router’s public IP, the private IP remains hidden.

Public IP and private IP

A virtual machine, for example, Hyper-V guest, has the public IP address same as host, means that the external machine needs to access your virtual machine through your Hyper-V host.

As for private IP, virtual machines have their own IP addresses just like physical machines, and it has to be unique. Otherwise, giving 2 machines the same IP addresses would be like giving 2 people the same phone number. You will run into IP conflicts.

How to configure Hyper-V same IP as host

IP addresses are associated with network interfaces, which are associated with network adapters. Virtual machines have virtual network interfaces and virtual network adapters. The same is true for Hyper-V VMs.

If you want to assign Hyper-V guest IP address same as host (public IP), what you need to configure is Network Address Translation (NAT).

NAT network

NAT gives a virtual machine access to network resources using the host computer's IP address and a port through an internal Hyper-V Virtual Switch. It is a networking mode designed to conserve IP addresses by mapping an external IP address and port to a much larger set of internal IP addresses. Basically, a NAT uses a flow table to route traffic from an external (host) IP Address and port number to the correct internal IP address associated with an endpoint on the network (virtual machine, computer, container, etc.)

Additionally, NAT allows multiple virtual machines to host applications that require identical (internal) communication ports by mapping these to unique external ports.

With NAT enabled, the host’ IP is like a router to the virtual machine. However, turn off NAT mode, your Hyper-V guest can never use the same IP as the host.

To learn how to create a NAT virtual network and attach a Hyper-V virtual machine to it, the steps are listed clearly in Microsoft’s official document: Set up a NAT network

How to check the IP address of Hyper-V virtual machine

After successfully created a NAT virtual network and attached a Hyper-V VM to it, you may want to check its IP address to see if you set it up properly. Here I provide you 2 ways of how to check the IP address of the Hyper-V VM from the host or from inside the VM.

How to check the IP address of Hyper-V VM from the host

Launch Windows PowerShell as administrator on the Hyper-V host, and run the following command to get the IP address of one specific VM:

Get-VM -Name “VMName” | Select -ExpandProperty Networkadapters

Get Hyper-V VM IP address

To get IP addresses of all virtual machines, run the command:

Get-VM | Select -ExpandProperty Networkadapters

How to get the IP address of Hyper-V VM from inside the VM

If you can enter the operating system running on the target Hyper-V guest VM, it is easier to get VM IP address from inside the VM. The operations are basically the same as it on a physical machine.

For example, if the operating system is Windows, you can get the VM IP addresses simply by running the command ipconfig.



Setting up your network incorrectly can lead to many problems, for example, Hyper-V VM no internet. So, how Hyper-V VM getting same IP as host?

To set the Hyper-V same IP as host, there is only one solution, set the virtual network to NAT mode. In this article, I briefly introduced what is NAT mode and how to check the IP address of Hyper-V VM from the host or from inside the VM. Hope it could be helpful to you.

Crystal · Editor
Crystal is an editor from AOMEI Technology. She mainly writes articles about virtual machine. She is a positive young lady likes to share articles with peolpe. Off work she loves travelling and cooking which is wonderful for life.