40

解决 Clash for windows 端口为 0 导致无法使用

 3 years ago
source link: https://blog.frytea.com/archives/564/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

解决 Clash for windows 端口为 0 导致无法使用

August 30, 2021 • Read: 83 • 技术价值

本文首发于: https://blog.frytea.com/archives/564/

今天更新完 Windows 重启后发现上不了网了,检查 clash for windows 发现监听端口为 0

https://imagehost-cdn.frytea.com/images/2021/08/30/20210830095030627b1fa801f19241.png

这就不正常了,检查了一下 C:\Users\<username>\.config\clash\logs 的日志,发现这行报错:

level=error msg="Start Mixed(http and socks) server error: listen tcp 127.0.0.1:7890: bind: An attempt was made to access a socket in a way forbidden by its access permissions."

貌似是端口无法被正常绑定,网上找了一下原因,发现遇到该问题的人不少,大致这样解决:

CMD 执行这行指令 netsh int ipv4 show dynamicport tcp 发现起始端口变成了 1024。

管理员身份运行 CMD 执行这些命令:

# 这两条命令来自博客 https://blog.csdn.net/tian2342/article/details/108934646
netsh int ipv4 set dynamicport tcp start=49152 num=16383
netsh int ipv4 set dynamicport udp start=49152 num=16383
# 这条命令来自 https://github.com/Fndroid/clash_for_windows_pkg/issues/671
netsh int ipv4 set dynamic tcp start=49152 num=16384

然后检查结果

netsh int ipv4 show dynamicport tcp

端口正常后重启计算机,恢复正常

---------------------
Author: Frytea
Title: 解决 Clash for windows 端口为 0 导致无法使用
Link: https://blog.frytea.com/archives/564/
Copyright: This work by TL-Song is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK