Repository navigation
Closed
Labels
Description
After updating to WSL2 there is a huge amount of ports reserved.
Running this command: netsh int ipv4 show excludedportrange protocol=tcp i can tell that most ports from 4294 to 9783 are reserved.
Protocol tcp Port Exclusion Ranges
Start Port End Port
---------- --------
4294 4393
4394 4493
4494 4593
4594 4693
4694 4793
4794 4893
4894 4993
5141 5240
5241 5340
5341 5440
5441 5540
5541 5640
5641 5740
5741 5840
6041 6140
6141 6240
6241 6340
6341 6440
6441 6540
6541 6640
6641 6740
7044 7143
7144 7243
7244 7343
7344 7443
7444 7543
7544 7643
7644 7743
7949 8048
8049 8148
8149 8248
8249 8348
8984 9083
9084 9183
9184 9283
9284 9383
9384 9483
9484 9583
9584 9683
9684 9783
50000 50059 *
54235 54235
54236 54236
This is very troublesome, because I can't event start docker container on a port, because it throws
ERROR: for db Cannot start service db: Ports are not available: listen tcp 0.0.0.0:5432: bind: An attempt was made to access a socket in a way forbidden by its access permissions.
contentDock App Development by EDIT GmbH (@edit)
Please fill out the below information:
- Your Windows build number: (Type
verat a Windows Command Prompt)
Microsoft Windows [Version 10.0.19041.264]
- What you're doing and what's happening: (Copy&paste the full set of specific command-line steps necessary to reproduce the behavior, and their output. Include screen shots if that helps demonstrate the problem.)
Described at the beginning of the issue
- What's wrong / what should be happening instead:
Described at the beginning of the issue
- Strace of the failing command, if applicable: (If
some_commandis failing, then runstrace -o some_command.strace -f some_command some_args, and link the contents ofsome_command.stracein a gist here).
Not running a command. Proccesses don't start because ports are reserved
Reacted by sdbbs, Artur Lavrov, jeiea and Václav Brožík
Activity
Biswa96 commentedon May 31, 2020
Are you sure those are assigned for WSL? Can you check the output from TcpView tool as administrator? Also please fill up all the fields of the issue template, its useful to fix issues.
Humberd commentedon May 31, 2020
Biswapriyo Nath (@Biswa96) The ports are reserved, but not process uses them.
I have installed Windows update to 2004 2 days ago, but this problem arose today.
onomatopellan commentedon May 31, 2020
This is my output of
netsh int ipv4 show excludedportrange protocol=tcpI have Hyper-V and WSL2 enabled with a running Docker container and working without issue.
Do you have anything different from a new install? Additional Av/Firewall, DNS server, VPN... it looks like something is being blocked and insists in reserving ports.
Edit: Found user with same problem and a workaround
https://stackoverflow.com/a/62061654/6682245
Humberd commentedon May 31, 2020
I have absolutely no idea why I had this problem. I just reinstalled Windows and now all works fine
onomatopellan commentedon Jun 13, 2020
A faulty Windows upgrade is the reason for the problems with reserved tcp ports.
See docker/desktop-feedback#783 (comment).
With this the problem should be fixed:
netsh int ipv4 set dynamic tcp start=49152 num=16384That would explain why a clean install fixes these type of problems.
nij4t commentedon May 21, 2021
If that happens again, try this:
therealkenc commentedon May 21, 2021
/dupe docker/for-win#5514
DanteMarshal commentedon Sep 18, 2021
I had the same problem and my 1080 port was reserved so I couldn't run my local socks5 service.
This fixed my problem, Thank you.
You can run
netsh int ipv4 show dynamic protocol=tcpbefore to make sure that is your case (that the port you have problems with in this range)elianbarci commentedon Jun 13, 2022
In my case I solve this issue knowing which port my application needs (25340) and knowing what ranges are reserved by
netsh int ipv4 show excludedportrange protocol=tcpwhich gives me this output:
As you can see, this command tells me that from 25313 to 25412 those ports are reserved, so I simply change the port of my app and now all is working fine.
EntityinArray commentedon May 1, 2024
how about fix?