Forum Discussion
Wes-Ev
Sep 24, 2020Copper Contributor
Calculating available ephemeral ports
Hi, I seem to be running short of ephemeral ports for tcp connections on IPv4. This has lead me to try get a solid understand of just how many ephemeral (eph) ports I have available for IPv4 tcp ...
Dave Patrick
Sep 25, 2020MVP
You asked about limits of port space so I was answering that. (65,535)
Generally if a process uses some dynamically assigned range of ports and didn't complete (and close) successfully and is repeatedly being triggered then it may be expected behavior to eventually run out of ports.
netstat -aon
should show the result. The short term fix is to reboot. A long term solution is fixing the problem process or connection issues.
Wes-Ev
Sep 25, 2020Copper Contributor
These are big servers with thousands of users. Netstat outputs about 180K lines, most of the time netstat doesn't complete, same for the PS Get-NetTCPConnection. This doesn't appear to be a process leaving connections open; I think its just a busy box running up against an ephemeral limit which is why I would like to know what the global TCP port space actually is. From that perhaps we could figure if there is anyway to add more ephemeral ports, that is, allow more connections.
- Dave PatrickSep 25, 2020MVP
May depend on the process or service. Some windows services port usage are listed here.
The space is up to 65,535 but of course you'll need to know what's being used by windows and or other processes so as not to cause conflicts.