You can connect to a Hyper-V virtual machine on Windows Server 2022 using the host's IP address by configuring port forwarding through Windows Firewall or PowerShell. This method routes incoming Remote Desktop Protocol (RDP) traffic from the host to the specific VM without requiring a public IP address, allowing local network access via a custom port mapping.
Understanding the Network Topology
When you run a Hyper-V virtual machine, it typically operates on an internal virtual switch or a private network that is isolated from the physical network interface of the host server. While this provides security, it prevents external devices on your local area network (LAN) from reaching the VM directly using its internal IP. The goal is to create a bridge where the host acts as a gateway, accepting connections on a specific port and redirecting them to the VM’s RDP service.
This setup is particularly useful for administrators who manage multiple servers locally but lack the budget or technical capability to assign public IPs to every virtual instance. By leveraging the host’s existing network connectivity, you maintain a secure boundary while enabling convenient remote management. For more details on managing Hyper-V window behaviors during these sessions, see
Restoring Auto Zoom Level in Hyper-V VM Window.
Step 1: Verify Host and VM Network Settings
Before configuring forwarding rules, ensure both the host and the guest are on compatible networks. If your VM is connected to an "External" virtual switch, it may already have direct network access, making port forwarding unnecessary. However, if you are using an "Internal" or "Private" switch, the VM will only communicate with the host and other VMs on that same virtual network.
Check the IP configuration of your VM by opening the command prompt inside the guest OS and running
ipconfig. Note the IPv4 address. Then, verify the host’s IP address on the same subnet. If they are not on the same subnet, you must adjust the virtual switch settings or assign static IPs to ensure reachability. Misconfigured subnets are the most common reason why port forwarding fails even when rules are correctly applied.
Step 2: Configure Port Forwarding with Netsh
Windows Server 2022 includes the
netsh utility, which allows you to configure advanced TCP/IP settings including port redirection. To forward traffic from the host to the VM, you need to add a port proxy rule. Open PowerShell or Command Prompt as Administrator on the host server.
Execute the following command structure, replacing placeholders with your actual values:
netsh interface portproxy add v4tov4 listenport=3390 listenaddress=0.0.0.0 connectport=3389 connectaddress=
In this example, we listen on port 3390 on all interfaces (
0.0.0.0) and forward it to port 3389 (the default RDP port) on the VM’s IP address. You can choose any available high-numbered port for the listen address to avoid conflicts with other services. After running this command, verify the rule exists by typing
netsh interface portproxy show all. This step creates the logical pathway for data packets to travel from the host’s network card to the virtual NIC of the guest.
Step 3: Adjust Windows Firewall Rules
Even with port forwarding configured, Windows Firewall will block incoming connections unless explicitly allowed. You must create an inbound rule on the host server to permit traffic on the listen port you chose (e.g., 3390).
Open the Windows Defender Firewall with Advanced Security console. Navigate to Inbound Rules and select New Rule. Choose Port, then TCP, and specify the listen port (3390 in our example). Allow the connection for all profiles (Domain, Private, Public) depending on your network environment. Finally, give the rule a descriptive name like "Hyper-V RDP Forwarding". Without this rule, the firewall drops the packets before they reach the port proxy engine.
For users experiencing issues with Remote Desktop connections after changing network settings, refer to
Connecting Hyper-V (Kaliguest) using Remote Desktop (Win10 host): Troubleshooting without starting the Hyper-V instance.
Step 4: Connect Using the Host IP
Once the port proxy and firewall rules are active, you can initiate a Remote Desktop Connection from any computer on the same LAN. Open the Remote Desktop client (
mstsc) and enter the host server’s IP address followed by a colon and the listen port. For example:
192.168.1.100:3390.
The client will establish a connection to the host on port 3390, which immediately redirects the session to the VM on port 3389. You will be prompted for the credentials of the VM, not the host. This seamless transition allows you to manage the VM as if it were physically connected to the network. Ensure that the VM’s own firewall also allows RDP traffic, although this is usually enabled by default on Windows Server guests.
If you encounter latency or input lag during these sessions, consider optimizing your display settings. See
Seamless RDP Experience with Hyper-V Enhanced Session and Mouselag Remote Desktop (mstsc) for tips on reducing mouselag and improving visual performance.
Troubleshooting Common Issues
If the connection fails, first check if the port proxy rule is active using
netsh interface portproxy show all. Ensure no typos exist in the VM IP address. Second, verify that the VM is powered on and has network connectivity. Third, confirm that the firewall rule on the host is enabled and not overridden by a group policy. Finally, test connectivity from another machine on the network to isolate whether the issue is local to your client PC or systemic.
Frequently Asked Questions
Can I use this method to connect from outside my local network?
No, this method relies on the host’s local IP address and does not expose the VM to the internet. To connect remotely over the public internet, you would need a VPN or a dynamic DNS service with proper port forwarding on your router.
Does this affect other services running on the host?
Generally, no. Since you are listening on a specific non-standard port (like 3390), it avoids conflicts with the host’s own RDP service on port 3389. Just ensure the chosen listen port is not used by another application on the host.
What happens if the VM’s IP address changes?
If the VM uses DHCP and receives a new IP, the port proxy rule will break because it points to the old address. You should either assign a static IP to the VM within the virtual switch settings or update the
connectaddress in the netsh rule manually.
Is it possible to forward multiple VMs using different ports?
Yes, you can create multiple port proxy rules. Each VM can listen on a unique port on the host (e.g., 3391 for VM1, 3392 for VM2) and forward to their respective internal IPs and standard RDP port 3389.
Why am I getting a "Network Path Not Found" error?
This error usually indicates that the host cannot route traffic to the VM’s IP address. Check the VM’s network adapter status in Hyper-V Manager and ensure the virtual switch is set to allow communication between the host and the guest.