portforwardingnetshwindows-networking

NETSH port forwarding from local port to local port not working


I'm trying to use NETSH PORTPROXY command to forward packets sent to my XP PC (IP 192.168.0.10) on port 8001 to port 80 (I've a XAMPP Apache server listening to port 80).

I issued the following:

netsh interface portproxy add v4tov4 listenport=8001 listenaddress=192.168.0.10 connectport=80 connectaddress=192.168.0.10

Show all confirms that everything is configured correctly:

netsh interface portproxy show all

Listen on IPv4:             Connect to IPv4:

Address         Port        Address         Port
--------------- ----------  --------------- ----------
192.168.0.10    8001        192.168.0.10    80

However, I'm not able to access apache website from http://localhost:8001. I'm able to access through the direct port at http://localhost as shown below.

Additionally, I've also tried the following: 1. Access the Apache website from a remote PC using the link: http://192.168.0.10:8001. Firewall turned off. 2. Changing listenaddress and connectaddress to 127.0.0.1.

Without further information, I can't find a way to resolve the problem. Is there a way to debug NETSH PORTPROXY?

enter image description here

Note: By the way, if you're wondering why I am doing this, I actually want to map remote MySQL client connections from a custom port to the default MySQL Server port 3306.


Solution

  • I managed to get it to work by issuing:

    netsh interface ipv6 install
    

    Also, for my purpose, it is not required to set listenaddress and better to set connectaddress=127.0.0.1, e.g.

    netsh interface portproxy add v4tov4 listenport=8001 connectport=80 connectaddress=127.0.0.1