Connect to VM that have same IP as host machine on Hyper-V

I have a dedicated server with Windows Server 2019 that I have installed Hyper-V on. I have created a external switch and my first VM and the VM has a internet connection. How ever, what I want to do is that I want a customer to connect to the VM i created via RDP through his own computer. When I search "whatsmyip" on both my host and on the VM, they have the same IP.

So, how should my customer connect via RDP to the VM? If you connect to the IP through the RDP you get connected to the host server. I don't have any additional IP to assign to the VM, I only have one.

Emil


Solution 1:

Both the host and the VM access the internet via your router. Services such as whatsmyip will return the IP address of the router, so it will seem like they both have the same address.

This shouldn't bother you, as long as the VM does not need to be accessed from the internet. Everything will work correctly, as long as the host computer and the VM initiate connections to the internet.

If you wish both the host and VM to be separately addressable from the internet, you will need to differentiate between them by port number.

For more information about Port forwarding:

  • Wikipedia Port forwarding
  • How to Port Forward – General Guide to Multiple Router Brands