Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 623
Joshua Avatar asked Jul 09 '14 05:07

Joshua


People also ask

What is netsh interface Portproxy?

Use the netsh interface portproxy commands to act as proxies between IPv4 and IPv6 networks and applications. You can use these commands to establish proxy service in the following ways: IPv4-configured computer and application messages sent to other IPv4-configured computers and applications.

Can you port forward through CMD?

If your business doesn't have a port forwarding utility, you can use the Command Prompt to manually set up port forwarding. CMD uses the Netsh command to initiate the port forwarding process. To make this work, you need to know the port number and IP address for both the source and destination hosts.

How do I know if my port forwarding is working?

After you have successfully forwarded your ports, you will want to check to see if they are forwarded correctly. You can use this tool to see if your ports are open correctly: www.portchecktool.com. This tool will check for open ports and see if there are any services responding on that port.

What is a Portproxy?

Portproxy allows you to listen on a certain port on one of your network interfaces (or all interfaces) and redirect all traffic destined to that interface to another port/IP. The to that interface is the limitation that unfortunately kills it.


1 Answers

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 
like image 64
Joshua Avatar answered Sep 29 '22 07:09

Joshua