Forum Discussion
Calculating available ephemeral ports
There are 65,535 possible tcp and udp ports
Perhaps you mean 65,535 per server for TCP connections across all NICs/IPs and including connections on 127.0.0.1.
And once you hit that you need to start adding more servers?
- Dave PatrickSep 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-EvSep 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.