Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too many reserved port for Hyper-V #5514

Closed
liudonghua123 opened this issue Jul 1, 2020 · 8 comments
Closed

Too many reserved port for Hyper-V #5514

liudonghua123 opened this issue Jul 1, 2020 · 8 comments
Labels

Comments

@liudonghua123
Copy link

Environment

C:\Users\Liu.D.H>ver

Microsoft Windows [Version 10.0.19041.329]

C:\Users\Liu.D.H>

Steps to reproduce

  1. Start some services which use some ports (> 1024) not used .
    For example
C:\Users\Liu.D.H>adb devices
* daemon not running; starting now at tcp:5037
could not read ok from ADB Server
* failed to start daemon
adb.exe: failed to check server version: cannot connect to daemon

C:\Users\Liu.D.H>serve -p 5037 .
WARNING: Checking for updates failed (use `--debug` to see full error)
ERROR: Failed to serve: Error: listen EACCES: permission denied 0.0.0.0:5037
    at Server.setupListenHandle [as _listen2] (net.js:1296:21)
    at listenInCluster (net.js:1361:12)
    at Server.listen (net.js:1447:7)
    at startEndpoint (C:\Users\Liu.D.H\AppData\Roaming\npm\node_modules\serve\bin\serve.js:165:19)
    at C:\Users\Liu.D.H\AppData\Roaming\npm\node_modules\serve\bin\serve.js:367:3

INFO: Gracefully shutting down. Please wait...

C:\Users\Liu.D.H>serve -p 5215 .
WARNING: Checking for updates failed (use `--debug` to see full error)

   ┌────────────────────────────────────────────────────┐
   │                                                    │
   │   Serving!                                         │
   │                                                    │
   │   - Local:            http://localhost:5215        │
   │   - On Your Network:  http://169.254.104.11:5215   │
   │                                                    │
   │   Copied local address to clipboard!               │
   │                                                    │
   └────────────────────────────────────────────────────┘


INFO: Gracefully shutting down. Please wait...
Terminate batch job (Y/N)?
^CThe system cannot open the device or file specified.

C:\Users\Liu.D.H>
C:\Users\Liu.D.H>netsh interface ipv4 show excludedportrange protocol=tcp

Protocol tcp Port Exclusion Ranges

Start Port    End Port
----------    --------
      2164        2263
      2264        2363
      2364        2463
      2464        2563
      2564        2663
      2664        2763
      2864        2963
      2964        3063
      3064        3163
      3164        3263
      3264        3363
      3390        3489
      3699        3798
      3799        3898
      3899        3998
      4014        4113
      4114        4213
      4214        4313
      4614        4713
      4714        4813
      4814        4913
      4914        5013
      5014        5113
      5114        5213
      5219        5318
      5319        5418
      5419        5518
      5519        5618
      6140        6239
      6240        6339
      6380        6479
      6480        6579
      6580        6679
      6680        6779
      6780        6879
     49838       49838     *
     50000       50059     *

* - Administered port exclusions.


C:\Users\Liu.D.H>netsh interface ipv4 delete excludedportrange protocol=tcp startport=5014 numberofports=100 store=persistent
Access is denied.



C:\Users\Liu.D.H>

Expected behavior

There should not have so many reserved port for Hyper-V, like the default adb 5037.

Actual behavior

There were too many reserved port for Hyper-V. And I could not delete some conficts reserved port as administrator.

Other related issues: canonical/multipass#573 googlevr/gvr-unity-sdk#1002, ......

@liudonghua123
Copy link
Author

It seems the ports always change when I restart my computer.

C:\Users\Liu.D.H>netsh interface ipv4 show excludedportrange protocol=tcp

Protocol tcp Port Exclusion Ranges

Start Port    End Port
----------    --------
      5940        6039
      6040        6139
      6140        6239
      6240        6339
      6380        6479
      6580        6679
      6680        6779
      6780        6879
      6880        6979
      6980        7079
      7080        7179
      7180        7279
      7480        7579
      7580        7679
      7681        7780
      7781        7880
      7881        7980
      7981        8080
      8381        8480
      8481        8580
      8581        8680
      8681        8780
      8781        8880
      8881        8980
      9392        9491
      9492        9591
      9592        9691
      9692        9791
      9792        9891
      9892        9991
     10396       10495
     10496       10595
     10596       10695
     10696       10795
     10796       10895
     49838       49838     *
     50000       50059     *

* - Administered port exclusions.


C:\Users\Liu.D.H>

@therealkenc
Copy link
Collaborator

Same #5306 which was closed amorphous "faulty windows upgrade". More discussion over at docker/for-win#3171 (message).

@liudonghua123
Copy link
Author

@therealkenc Thanks for your tips. 😄

@therealkenc
Copy link
Collaborator

therealkenc commented Jul 1, 2020

There are 32 likes on the netsh work-around; hopefully that helps. I'll hold your submission open as a landing zone for other folks who end up with weird exclusion ranges, but there isn't an identifiable cause (or sequence of events to reproduce) that I could see.

@dantmnf
Copy link

dantmnf commented Aug 15, 2022

I run in this issue after Windows 11 22H2 update and I just figured out a trick to make the port reservations disappear.

It may have unknown side effects, use at your own risk. See docs for details.

Run the following command in PowerShell and restart:

Set-NetNatGlobal -InterRoutingDomainHairpinningMode Local

The default switch NAT seems not affected after this tweak.

@LirazShay
Copy link

@dantmnf
Can you explain why did this trick solve the issue?
Would it work on Win10?
Thanks!

@dantmnf
Copy link

dantmnf commented Aug 17, 2022

@dantmnf Can you explain why did this trick solve the issue? Would it work on Win10? Thanks!

I was trying to find and toggle settings for WinNAT and found this just works (TM). That is why I put the disclaimer here since its effect is still unclear.

Copy link
Contributor

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants