Windows Sandbox 无法联网

2022 年 5 月 8 日
 nishuoshenme
使用 Clash for Windows 的时候打开 Windows Sandbox 会使其无法连网,关闭 cfw 又可以了,有什么办法可以在开着 cfw 的情况下让 Windows Sandbox 正常连网吗?
6017 次点击
所在节点    Windows
9 条回复
Thymolblue
2022 年 5 月 8 日
下个 fiddler 允许应用通过就行了
windows 老问题了
ncepuzs
2022 年 5 月 8 日
如果是楼上所说的问题,那直接在 Clash for Windows 通用设置 UWP Loopback 中操作就行
Tumblr
2022 年 5 月 8 日
其实不需要什么乌七八糟的工具,Windows 本来就有提供 CheckNetIsolation.exe ,添加到例外里就 OK 了。
我没用过 CfW ,不知道有什么工具,不过如果有自带的,参考 @ncepuzs #2 的建议可能操作会方便一些。

另外,@Thymolblue #1 这不是个问题( problem ),这是 by design 的。😅为了安全考虑,不给走本地回环的代理。
Thymolblue
2022 年 5 月 8 日
@Tumblr
@ncepuzs
学到了 thx
EricXuu
2022 年 5 月 9 日
sandbox 会继承宿主机的代理设置,cfw 不要开系统代理。
SpecterShell
2022 年 5 月 9 日
Windows 沙盒 使用宿主机的系统代理设置,但 IP 地址又和宿主机不一样。
Clash for Windows 开启系统代理会将沙盒内外的代理地址都设置为 127.0.0.1 ,宿主机会将其识别为宿主机本地地址,而沙盒会将其识别为沙盒本地地址,不断尝试连接沙盒内不存在的端口,自然无法联网了。
想要让 Windows 沙盒走代理,要不就在 CFW 或系统设置中将代理地址设置为网关地址,要不就关闭 CFW 的系统代理,使用 TUN 或 TAP 。
nishuoshenme
2022 年 5 月 10 日
@SpecterShell #6 学到了,感谢
firefoxwang
2024 年 4 月 23 日
刚搜了一圈,就是把 windows 系统代理设置中修改为 clash 提供的 http 代理地址( clash for windows 选择 Allow LAN ),ip 是本机的内网地址,比如 192.1.68.1.x 啥的。这样就能让 windows 沙盒走 cfw 的代理了。
Need4more
2 月 6 日
1. 添加启动脚本:setproxy.bat

@echo off
setlocal enabledelayedexpansion

for /f "tokens=2 delims=:" %%i in ('cmd /c "ipconfig | findstr /i /c:"默认网关" /c:"Default Gateway" | findstr /r "[0-9]\.[0-9]""') do (
set GATEWAY_IP=%%i
)

set "GATEWAY_IP=%GATEWAY_IP: =%"

:proxy_set
if not defined GATEWAY_IP (
echo 错误:未找到有效的网关 IP 地址
pause
exit /b 1
)

netsh interface portproxy add v4tov4 listenaddress=127.0.0.1 listenport=7890 connectaddress=%GATEWAY_IP% connectport=7890 protocol=tcp
echo 端口转发成功 TCP !GATEWAY_IP!:7890 -^> 127.0.0.1:7890

echo 正在设置代理为 127.0.0.1:7890
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d "127.0.0.1:7890" /f >nul
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f >nul

echo 代理设置成功!
echo 代理地址: 127.0.0.1:7890


2. wsb 文件配置:
<LogonCommand>
<Command>C:\temp\setup.bat</Command>
</LogonCommand>

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://v2ex.xtra.eu.org/t/851581

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX