Forward a TCP port with netsh interface portproxy on Windows

Windows ships a hidden TCP port forwarder — bridge a local port to any remote host:port without installing anything.

WindowsnetworkportproxyforwardingMedium risk
Run the netsh portproxy add command as administrator to forward a listening port, and check the table with `netsh interface portproxy show all`.

01Command

Command
$ netsh interface portproxy add v4tov4 listenport=8080 listenaddress=127.0.0.1 connectport=80 connectaddress=10.0.0.5

02What it does

portproxy makes Windows listen on listenaddress:listenport and relay every connection to connectaddress:connectport — handy for reaching WSL2, a VM, or a legacy service bound to a specific port. The rules persist across reboots and live in the registry, which is also why forgotten ones cause mysterious 'port already in use' errors. If you listen on a non-loopback address, make sure Windows Defender Firewall allows the incoming port, and don't expose internal services accidentally.

03Risk

RiskMedium risk
RequirementsRun in an elevated PowerShell or Command Prompt. View current forwards with `netsh interface portproxy show all`.
!Warning: Forwarding a port to an internal host exposes it to anyone who can reach the listen address; loop back (127.0.0.1) unless you really need external access.

04Undo

Undo
$ netsh interface portproxy delete v4tov4 listenport=8080 listenaddress=127.0.0.1

05Sources

  • Netsh - Windows CMD
    SS64 · technical · 2026-09-17
    Evidence: SS64 covers the netsh command contexts, including the interface portproxy context for TCP port forwarding.
  • netsh interface portproxy | Microsoft Learn
    Microsoft · vendor-doc · 2026-09-17
    Evidence: Microsoft documents the portproxy add/delete/set/show commands with v4tov4 parameters listenaddress, listenport, connectaddress, connectport.

Last verified: 2026-09-17 · Category: Network

06Related solutions