"netsh interface portproxy" doesn't work

d2o 21 Reputation points
2020-12-07T16:00:42.533+00:00

Hi,
I have a server in my local network which hosts multiple ASP.NET Core application on different hosts I would like to be able to connect to those different application with different IP address, apparently it's possible using netsh.

In my specific case I would like to navigate to https://192.168.50.200/ to connect to https://192.168.50.234:3000/ so I executed this command in an admin command line, but when I try to connect to https://192.168.50.200/ it hangs for a while and then nothing

netsh interface portproxy add v4tov4 listenport=80 listenaddress=192.168.50.200 connectport=3000 connectaddress=192.168.50.234

Also my IPv6 protocol is checked in Network Connections
I reinstalled Windows on my machine a few weeks ago, and I have another computer in my network which has the same issue

Thank you

Windows for business Windows Client for IT Pros User experience Other
0 comments No comments
{count} votes

Accepted answer
  1. Gary Nebbett 6,216 Reputation points
    2020-12-10T15:12:18.197+00:00

    Hello @d2o ,

    To use "https" without receiving lots of security warnings, you need to use a hostname rather than an IP address in the URL. One way of assigning a hostname to your Raspberry Pi would be to add an entry for it to %SystemRoot%\System32\drivers\etc\hosts.

    If there are multiple ASP.NET Core services on the Raspberry Pi then only one of them can listen on the standard "https" port (443) - the rest will have to be assigned different port numbers. The URL for these services would be something like: https://myraspberrypi:999/.

    I guess that you want to eliminate the port specification (e.g. ":999") in your URLs. One way of doing this would be to install a reverse proxy (e.g. nginx) on your Raspberry Pi. You could then add several entries to your Windows etc\hosts, all with the same IP address (for the Raspberry Pi) but with different names (e.g. service1, service2). The reverse proxy, running on the Raspberry Pi, can then examine the HTTP Host headers and forward the requests to the appropriate local port.

    I don't think that "netsh interface portproxy" is useful in this scenario, if I have understood it correctly.

    Gary

    1 person found this answer helpful.

3 additional answers

Sort by: Most helpful
  1. Anonymous
    2020-12-08T02:18:13.08+00:00

    Hi ,

    Please run netsh interface portproxy show all to display current portproxy listeners.

    Run netstat -anb | findstr 80 to ensure that port 80 is currently being listened to.

    Note: If the command returns nothing and the port forwarding via netsh interface portproxy is unsuccessful, please make sure that the iphlpsvc (IP Helper) service is currently running on your system.

    In addition, temporally disable firewall and then see if the problem still occurs.

    Best Regards,

    Candy

    --------------------------------------------------------------

    If the Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. d2o 21 Reputation points
    2020-12-08T03:57:51.997+00:00

    Hi,
    Thank you for helping
    Note that 192.168.50.200 is not my local machine IP address, it's a random IP address address

    The problem still occurs after I've disabled the firewall

    45966-image.png
    45967-image.png
    46034-image.png

    Regards

    0 comments No comments

  3. Gary Nebbett 6,216 Reputation points
    2020-12-10T13:03:29.077+00:00

    Hello @d2o ,

    There seem to be several problems here:

    • The listenaddress needs to be one of the addresses of interfaces in the local system.
    • "https" uses port 443 and not port 80.
    • "https" can't verify the server (match the server name in the URL with the names in the server's certificate) if the URL uses an IP address rather than a name.

    Gary


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.