Search code examples
socketsnetwork-programmingportforwarding

Redirect port on Windows from loopback to outside


I have a socket that listen on port 6100 on my development machine, whose lan address is 192.168.1.2

I can access the socket and use it with the address 127.0.0.1:6100, but I can't access it from 192.168.1.2:6100 (I need to access the socket from another client on the Lan)

If I type netstat -an | find "6100" on the command prompt I get:

TCP 127.0.0.1:6100 0.0.0.0:0 LISTENING

So I need to redirect all calls to 192.168.1.2:A_RANDOM_PORT to 127.0.0.1:6100

How can i do that?

I tried with:

netsh interface portproxy add v4tov4 listenport=6200 listenaddress=192.168.1.2 connectport=6100 connectaddress=127.0.0.1

But without luck


Solution

  • I've finally been able to accomplish this task, but only using an external tool.

    I downloaded "PassPort port forwarding utility" and set up a redirection from 192.168.1.2 to 127.0.0.1

    Unfortunately I haven't been able to do that without an external tool.