- 查看动态端口范围
netsh int ipv4 show dynamicport tcp
netsh int ipv4 show dynamicport udp
netsh int ipv6 show dynamicport tcp
netsh int ipv6 show dynamicport udp
- 设定动态范围(排除 1000-1500 端口)
netsh int ipv4 set dynamicport tcp start=10000 num=50000
netsh int ipv4 set dynamicport udp start=10000 num=50000
netsh int ipv6 set dynamicport tcp start=10000 num=50000
netsh int ipv6 set dynamicport udp start=10000 num=50000
- 查看系统预留端口
netsh interface ipv4 show excludedportrange protocol=tcp
netsh interface ipv6 show excludedportrange protocol=tcp
- 添加系统预留端口(1000-1500 端口)
netsh int ipv4 add excludedportrange protocol=tcp startport=1000 numberofports=500
参考文章:
- https://learn.microsoft.com/zh-cn/troubleshoot/windows-client/networking/tcp-ip-port-exhaustion-troubleshooting
- https://www.cnblogs.com/xwgli/p/13609041.html
- https://zhuanlan.zhihu.com/p/474392069