On this pageHow portproxy works
Windows has a built-in way to forward a TCP port to another address and port: netsh interface portproxy. It is the usual answer when a Windows server must expose a service that runs in a virtual machine, a container, WSL or on another machine in a private network. It has two limits worth knowing before you start: it handles TCP only, and the destination sees the Windows server, not the original client, as the source of every connection. This guide covers portproxy end to end, then the Windows NAT alternative for UDP.
Run the commands in PowerShell as administrator, and keep your Remote Desktop session in mind: forwarding a port that RDP or another service already uses breaks that service.
How portproxy works
portproxy is not NAT. It is a small proxy that runs inside the IP Helper service: it listens on a local port, accepts each connection, and opens a new connection to the destination, then copies data both ways. One side effect is convenient: replies always return through the Windows server, so the destination needs no special route or gateway pointing back at it.
| What you get | What you do not get |
|---|---|
| TCP forwarding between IPv4 and IPv6 in any combination | UDP. Game servers and DNS need another method |
| Rules that survive reboots, stored in the registry | The client's real address at the destination |
| No extra software to install | Load balancing, TLS termination or HTTP awareness |
Check the IP Helper service
If IP Helper is stopped, rules exist but nothing listens. Make sure it runs and starts with Windows:
Get-Service iphlpsvc
Set-Service iphlpsvc -StartupType Automatic
Start-Service iphlpsvc
Add a forwarding rule
Forward port 8080 on the server's public address to a web server at 10.0.0.5 on port 80:
netsh interface portproxy add v4tov4 listenaddress=203.0.113.20 listenport=8080 connectaddress=10.0.0.5 connectport=80
listenaddressis the local address to listen on. Leaving it out means0.0.0.0, every IPv4 address on the server, which is rarely what you want on an internet-facing machine. Name the one address you mean.connectaddressandconnectportare the destination. The destination must accept connections from the Windows server's address.v4tov4forwards IPv4 to IPv4.v6tov4,v4tov6andv6tov6exist for the other combinations.
Confirm that the port now listens. The owning process is a svchost.exe instance, the one that hosts IP Helper:
netsh interface portproxy show all
Get-NetTCPConnection -LocalPort 8080 -State Listen
Open the firewall for the forwarded port
portproxy listens like any other program, so Windows Firewall must allow the port. Scope the rule to the addresses that need it:
New-NetFirewallRule -DisplayName "Portproxy 8080 web" -Direction Inbound -Protocol TCP `
-LocalPort 8080 -LocalAddress 203.0.113.20 -RemoteAddress 198.51.100.0/24 -Action Allow
If the server sits behind a provider firewall, open the port there too; on CloudSat that is the server's cloud firewall. For ways to manage many Windows Firewall rules consistently, see manage Windows Firewall with Group Policy and PowerShell.
Change, delete and reset rules
A rule is identified by its listen address and port, so those are all you give to delete:
netsh interface portproxy set v4tov4 listenaddress=203.0.113.20 listenport=8080 connectaddress=10.0.0.6 connectport=80
netsh interface portproxy delete v4tov4 listenaddress=203.0.113.20 listenport=8080
netsh interface portproxy reset
set points an existing rule at a new destination, delete removes one rule, and reset removes every portproxy rule on the machine. Remove the matching firewall rule as well with Remove-NetFirewallRule -DisplayName "Portproxy 8080 web".
Common uses
A virtual machine on an internal switch. A Hyper-V guest on an internal or NAT network is invisible from outside. A forward from the host's public address exposes one of its ports. Running Hyper-V inside a cloud server needs nested virtualization, which CloudSat offers on plans with 8 GB of memory or more (nested virtualization).
WSL 2 services. By default, a service inside WSL 2 listens on a virtual network address that changes between restarts. A forward to that address works until the next restart. On Windows 11, WSL's mirrored networking mode shares the host's addresses and makes the forward unnecessary.
A service bound to localhost. Some programs only listen on 127.0.0.1. A forward can expose them, but they often listen locally for a reason: a database or admin console was not meant for the internet. Check before you open it, and restrict the firewall rule to known addresses if you do.
Forward UDP with Windows NAT
For UDP, or when the destination must see the original client address, use the NAT built into Windows for virtual switches. It translates packets instead of proxying connections, and supports TCP and UDP. The setup creates an internal network for virtual machines and maps a public port into it:
New-VMSwitch -SwitchName "NATSwitch" -SwitchType Internal
New-NetIPAddress -IPAddress 192.168.100.1 -PrefixLength 24 -InterfaceAlias "vEthernet (NATSwitch)"
New-NetNat -Name "VMNat" -InternalIPInterfaceAddressPrefix 192.168.100.0/24
Add-NetNatStaticMapping -NatName "VMNat" -Protocol UDP -ExternalIPAddress 0.0.0.0 `
-ExternalPort 27015 -InternalIPAddress 192.168.100.10 -InternalPort 27015
Give the virtual machine the address 192.168.100.10 with gateway 192.168.100.1, and open UDP 27015 in the firewalls in front of the host. Get-NetNatStaticMapping lists the mappings and Remove-NetNatStaticMapping deletes one by its ID.
Which method fits
| Method | Protocols | Client address preserved | Best for |
|---|---|---|---|
netsh interface portproxy |
TCP | No | Quick TCP forwards to VMs, WSL or other hosts |
| Windows NAT static mapping | TCP and UDP | Yes | Virtual machines on an internal switch, game servers |
| Routing and Remote Access (RRAS) NAT | TCP and UDP | Yes | A Windows server acting as a full router |
| A reverse proxy (IIS with ARR, nginx, Caddy) | HTTP and HTTPS | In headers such as X-Forwarded-For |
Websites: adds TLS, routing by hostname and logging |
For websites, a reverse proxy is usually the better tool: it terminates HTTPS, routes by hostname, and passes the client's address to the application in a header.
When the forward does not work
- Nothing listens on the port. IP Helper is stopped, or another program already holds that port. Compare
netsh interface portproxy show allwithGet-NetTCPConnection -LocalPort 8080. - It works locally but not from outside. A firewall blocks it: Windows Firewall, the provider's firewall, or both.
- The connection opens and then fails. The destination refuses connections from the Windows server's address, or its own firewall blocks them. Test from the server with
Test-NetConnection 10.0.0.5 -Port 80. - It worked until a reboot. The destination's address changed, which happens with WSL and DHCP-addressed VMs. Give the destination a fixed address.
FAQ
Can portproxy forward UDP?
No. It supports TCP only. Use a Windows NAT static mapping, RRAS, or a forwarder built into the application.
Why do my web server logs show the Windows server as every visitor?
portproxy opens a new connection for each client, so the destination only sees the proxy. For HTTP, use a reverse proxy that adds X-Forwarded-For; for other protocols, use NAT, which keeps the original address.
Does this work on Windows 10 and 11 too?
Yes. portproxy and the firewall commands are the same on desktop Windows, which is where most WSL forwards live. Windows NAT static mappings need Hyper-V, which desktop editions include in Pro and higher.
Do portproxy rules survive a reboot?
Yes. They are stored in the registry and restored when the IP Helper service starts, as long as that service is set to start automatically.
Run it on CloudSat. Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. See plans or deploy a server.




