Skip to content

Port-forwarding with netsh on Windows

Sometimes you run a program on your Windows computer that binds it’s ports to only the localhost address ( Usually you can configure the program to also bind to other interfaces. But sometimes you can’t reconfigure it or you don’t find the configuration options, because it’s poorly documented. In some situations there are also good security reasons why the program only binds to the localhost. So I also have to tell you:


Most times programs bind to is because of security reasons. Thus you should take care when you want to make a port available to other computers in the network and you should not do it unless you know what you are doing. Each port that is accessible from the “outside” is an attack vector that hackers will use.

You can use the information I provide here at your own risk.

Make a local port available on a public interface

Let’s assume there is a service running on and you want to make it available to other computers in the network. First you have to find out the address that your computer has in the network you want to make the local port accessible to.

You can find it out with ipconfig

> ipconfig
Ethernet-Adapter Ethernet xxx:
   IPv4-Adress . . . . . . . . . . . :

In the example above my computer has the address

Now I can add a port forwarding, let’s say from port to by executing the following netsh command in a command prompt with administrator priviledges.

netsh interface portproxy add v4tov4 listenport=54321 listenaddress= connectport=12345 connectaddress=

I can also remove the port forwarding using

netsh interface portproxy delete v4tov4 listenport=54321 listenaddress=

If you don’t know the ports that are forwarded you can also list all.

netsh interface portproxy show v4tov4

Leave a Reply

Your email address will not be published. Required fields are marked *


GDPR Cookie Consent with Real Cookie Banner