惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog
V
Vulnerabilities – Threatpost
Apple Machine Learning Research
Apple Machine Learning Research
V
V2EX
博客园 - 叶小钗
阮一峰的网络日志
阮一峰的网络日志
人人都是产品经理
人人都是产品经理
Latest news
Latest news
博客园 - 三生石上(FineUI控件)
美团技术团队
aimingoo的专栏
aimingoo的专栏
Google Online Security Blog
Google Online Security Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
T
Threatpost
Y
Y Combinator Blog
T
Tailwind CSS Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
A
Arctic Wolf
C
Cyber Attacks, Cyber Crime and Cyber Security
小众软件
小众软件
Recent Commits to openclaw:main
Recent Commits to openclaw:main
T
Tenable Blog
W
WeLiveSecurity
L
LINUX DO - 热门话题
D
Docker
Cyberwarzone
Cyberwarzone
量子位
A
About on SuperTechFans
The Last Watchdog
The Last Watchdog
雷峰网
雷峰网
C
CERT Recently Published Vulnerability Notes
P
Palo Alto Networks Blog
The Hacker News
The Hacker News
Blog — PlanetScale
Blog — PlanetScale
P
Proofpoint News Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
F
Full Disclosure
The Cloudflare Blog
T
The Blog of Author Tim Ferriss
T
The Exploit Database - CXSecurity.com
Engineering at Meta
Engineering at Meta
O
OpenAI News
Hacker News - Newest:
Hacker News - Newest: "LLM"
Scott Helme
Scott Helme
IT之家
IT之家
S
Secure Thoughts
MongoDB | Blog
MongoDB | Blog
L
Lohrmann on Cybersecurity
博客园 - 司徒正美
Google DeepMind News
Google DeepMind News

Cyberia

《C(金钱掌控)》观后感 - Cyberia C#在Windows UI开发中的衰落 - Cyberia 存储退潮 字体padding计算器 开源已死 如何写出优雅完整的音频元数据 自动化EAC音频抓取 起夜级家庭网络正在变得越来越重要 优化Powershell的启动时间 无JavaScript其实没有很重要 你不需要一个电纸书阅读器 文件分享的难题 为什么我不敢看都市 某科学的 SSH 算号指南 时代的辉夜姬 为什么 Pixi 是神 关于神椿的过去,当下以及未来,我的一点看法 Tahoe 的图标令人难评 The EVE of PUSHING LIMITS 在 Word 中通过制表符实现居中对齐等操作 编码之殇:前 Unicode 时代的 WAV 处理 sHELL 即地狱 WR1800K AX NAND 路由器刷入 Immortalwrt 一个 PWM 的世界 沉痛悼念复选框同志 字体焕新 独立博客自省问卷15题 答一答 解决 Visual Studio Code 内终端启动报错问题 (1) 简评《鱿鱼游戏》 Sword Art Online,以及它带来了什么 解决 Visual Studio Code 内终端启动报错问题 2024 年度总结 轻小说重度依赖 铃音之后 计算机科学中最困难的事:居中 宿舍场景下多人共用路由器下流量分流实践 Extra Decal Pre Processor 自动化处理 Amazon Music 文件 MD5 不一致问题 解决 MultiMC 无 Forge 版本的 Optifine 安装问题
解决部分应用在 Windows 平台下端口被随机占用的问题
Nullpinter · 2024-09-03 · via Cyberia

English Version: Solving the issue of ports being randomly occupied by some applications on the Windows platform

太长不看#

  1. 进入管理员终端,PowerShell 或者 CMD 都可以。
  2. 键入 netsh int ipv4 show dynamicport tcp 查看起始端口号是否为 1024,如果是,恭喜你遇到了和我一样的问题,不是则自求多福。
  3. 键入 netsh int ipv4 set dynamic tcp start=49152 num=16384netsh int ipv6 set dynamic tcp start=49152 num=16384 重设起始端口号。
  4. 重启电脑

原因#

Windows 可能在某次更新中会意外的重设动态端口范围至 1024,这其实和 Hyper-V 无关,但是!Hyper-V会随机占用在这个范围内的几千个端口作为保留服务,你还不能通过 netstat -ano 发现这一点。正常的动态端口范围应是 49152-6553512

显然,很多 APP 都会使用地位端口,比如 VBAN 默认使用的 6980,如果这个端口极为幸运的被 Hyper-V 所使用,其他应用就不能使用了。如果你的代理或者其他下载软件出现了这个问题,可以尝试使用 netsh int ipv4 show excludedportrange protocol=tcp 来检查是否被占用。

English#

TL;DR#

  1. Open an administrator terminal (PowerShell or CMD).
  2. Type netsh int ipv4 show dynamicport tcp to check if the starting port number is 1024. If it is, you’ve encountered the same issue as me. If not, you’re on your own.
  3. Type netsh int ipv4 set dynamic tcp start=49152 num=16384 and netsh int ipv6 set dynamic tcp start=49152 num=16384 to reset the starting port number.
  4. Restart your computer.

Reason#

Windows may accidentally reset the dynamic port range to 1024 during an update. This is actually unrelated to Hyper-V, but Hyper-V will randomly occupy several thousand ports within this range as reserved services, and you can’t even detect this using netstat -ano. The normal dynamic port range should be 49152-6553512.

Obviously, many apps use lower ports, such as VBAN which defaults to 6980. If this port is unluckily used by Hyper-V, other applications won’t be able to use it. If your proxy or other download software encounters this problem, you can try using netsh int ipv4 show excludedportrange protocol=tcp to check if it’s being occupied.

  1. https://learn.microsoft.com/en-us/troubleshoot/windows-server/networking/default-dynamic-port-range-tcpip-chang ↩ ↩2

  2. https://www.techtarget.com/searchnetworking/definition/dynamic-port-numbers ↩ ↩2