Loading...
Loading...
Compare original and translation side by side
github.comgithub.comenv | grep -i -E '(proxy|PROXY|http_proxy|https_proxy|all_proxy|no_proxy|ALL_PROXY|HTTP_PROXY|HTTPS_PROXY|NO_PROXY)' || echo "[结果] 无代理环境变量"undefinedenv | grep -i -E '(proxy|PROXY|http_proxy|https_proxy|all_proxy|no_proxy|ALL_PROXY|HTTP_PROXY|HTTPS_PROXY|NO_PROXY)' || echo "[Result] No proxy environment variables"undefined
3. **DNS 解析对比**
```bash
TARGET="目标域名"
echo "=== 本地 DNS ==="
nslookup $TARGET 2>&1
echo "=== 外部 DNS (8.8.8.8) ==="
nslookup $TARGET 8.8.8.8 2>&1
echo "=== 外部 DNS (1.1.1.1) ==="
nslookup $TARGET 1.1.1.1 2>&1echo "=== git http.proxy ==="
git config --global --get http.proxy 2>/dev/null || echo "未设置"
echo "=== git https.proxy ==="
git config --global --get https.proxy 2>/dev/null || echo "未设置"for port in 7890 7891 7897 1080 1087 9090 2080; do
result=$(lsof -i :$port -sTCP:LISTEN 2>/dev/null | head -3)
if [ -n "$result" ]; then
echo "[端口 $port] 在监听:"
echo "$result"
fi
done
echo "=== 扫描完成 ==="
3. **DNS Resolution Comparison**
```bash
TARGET="Target Domain"
echo "=== Local DNS ==="
nslookup $TARGET 2>&1
echo "=== External DNS (8.8.8.8) ==="
nslookup $TARGET 8.8.8.8 2>&1
echo "=== External DNS (1.1.1.1) ==="
nslookup $TARGET 1.1.1.1 2>&1echo "=== git http.proxy ==="
git config --global --get http.proxy 2>/dev/null || echo "Not set"
echo "=== git https.proxy ==="
git config --global --get https.proxy 2>/dev/null || echo "Not set"for port in 7890 7891 7897 1080 1087 9090 2080; do
result=$(lsof -i :$port -sTCP:LISTEN 2>/dev/null | head -3)
if [ -n "$result" ]; then
echo "[Port $port] Listening:"
echo "$result"
fi
done
echo "=== Scan Completed ==="TARGET="目标域名"
curl --noproxy '*' --connect-timeout 5 -s -o /dev/null -w "直连: HTTP=%{http_code} 耗时=%{time_total}s IP=%{remote_ip}\n" https://$TARGET 2>&1 || echo "直连: 失败(超时或拒绝)"TARGET="目标域名"TARGET="Target Domain"
curl --noproxy '*' --connect-timeout 5 -s -o /dev/null -w "Direct Connection: HTTP=%{http_code} Time=%{time_total}s IP=%{remote_ip}\n" https://$TARGET 2>&1 || echo "Direct Connection: Failed (timeout or rejected)"TARGET="Target Domain"
3. **Ping 测试**
```bash
TARGET="目标域名"
ping -c 3 -W 3 $TARGET 2>&1curl -s http://127.0.0.1:9090/version 2>/dev/null && echo ""
curl -s http://127.0.0.1:9090/proxies 2>/dev/null | head -c 500
3. **Ping Test**
```bash
TARGET="Target Domain"
ping -c 3 -W 3 $TARGET 2>&1curl -s http://127.0.0.1:9090/version 2>/dev/null && echo ""
curl -s http://127.0.0.1:9090/proxies 2>/dev/null | head -c 500| DNS 结果 | 直连 | 代理 | 系统代理 | 诊断 |
|---|---|---|---|---|
| 198.18.x.x (fake-ip) | 超时 | 正常 | 关闭 | TUN 模式 DNS 劫持生效但流量拦截失败,且系统代理未开启 |
| 198.18.x.x (fake-ip) | 超时 | 超时 | 关闭 | 代理软件整体异常,需要重启 |
| 198.18.x.x (fake-ip) | 正常 | 正常 | 任意 | TUN 模式正常工作 |
| 正常 IP | 超时 | 正常 | 关闭 | 需要开启系统代理或设置环境变量 |
| 正常 IP | 超时 | 超时 | 开启 | 代理节点本身有问题,需要切换节点 |
| 正常 IP | 正常 | - | - | 网络正常,问题可能在浏览器/应用层 |
| DNS Result | Direct Connection | Proxy | System Proxy | Diagnosis |
|---|---|---|---|---|
| 198.18.x.x (fake-ip) | Timeout | Normal | Off | TUN mode DNS hijacking is effective but traffic interception failed, and system proxy is not enabled |
| 198.18.x.x (fake-ip) | Timeout | Timeout | Off | Proxy software is completely abnormal, needs to be restarted |
| 198.18.x.x (fake-ip) | Normal | Normal | Any | TUN mode is working normally |
| Normal IP | Timeout | Normal | Off | Need to enable system proxy or set environment variables |
| Normal IP | Timeout | Timeout | On | Proxy node itself has issues, need to switch nodes |
| Normal IP | Normal | - | - | Network is normal, problem may be at browser/application layer |
198.18.0.0/1528.0.0.0/810.0.0.0/8198.18.0.0/1528.0.0.0/810.0.0.0/8根因:Clash TUN 模式的 DNS 劫持仍在工作(域名被解析为 fake-ip),
但 TUN 虚拟网卡未正确拦截流量,导致连接直接发往 fake-ip 后超时。
解决方案(按优先级):
1. 重启代理软件(Clash Verge / mihomo)
2. 如果重启无效,关闭 TUN 模式,改用系统代理模式
3. 开启 System Proxy(系统代理)开关
4. 如果是 macOS,检查是否需要重新授权网络扩展:
系统设置 → 隐私与安全性 → 网络扩展Root Cause: Clash TUN mode DNS hijacking is still working (domain name is resolved to fake-ip),
but the TUN virtual network card did not intercept traffic correctly, resulting in connection timeout after sending to fake-ip.
Solutions (by priority):
1. Restart the proxy software (Clash Verge / mihomo)
2. If restarting doesn't work, disable TUN mode and switch to system proxy mode
3. Turn on the System Proxy switch
4. If on macOS, check if network extension authorization needs to be re-granted:
System Settings → Privacy & Security → Network Extensions根因:代理软件在运行且代理端口正常,但系统代理未开启,
浏览器等应用不会自动走代理。
解决方案:
1. 在代理客户端中开启「System Proxy / 系统代理」
2. 或手动设置:
networksetup -setwebproxy "Wi-Fi" 127.0.0.1 PORT
networksetup -setsecurewebproxy "Wi-Fi" 127.0.0.1 PORT
networksetup -setwebproxystate "Wi-Fi" on
networksetup -setsecurewebproxystate "Wi-Fi" onRoot Cause: The proxy software is running and the proxy port is normal, but the system proxy is not enabled,
so applications like browsers will not use the proxy automatically.
Solutions:
1. Turn on "System Proxy" in the proxy client
2. Or set manually:
networksetup -setwebproxy "Wi-Fi" 127.0.0.1 PORT
networksetup -setsecurewebproxy "Wi-Fi" 127.0.0.1 PORT
networksetup -setwebproxystate "Wi-Fi" on
networksetup -setsecurewebproxystate "Wi-Fi" on根因:代理软件运行正常,但当前选择的代理节点无法连接。
解决方案:
1. 在 Clash 控制面板中切换到其他节点
2. 测试延迟:在 Clash 中点击「测速」
3. 如果所有节点都不行,检查订阅是否过期Root Cause: The proxy software is running normally, but the currently selected proxy node cannot be connected.
Solutions:
1. Switch to another node in the Clash control panel
2. Test latency: Click "Speed Test" in Clash
3. If all nodes are not working, check if the subscription has expired根因:终端环境没有设置代理变量,命令行工具(git/curl/npm 等)不走代理。
解决方案:
在 shell 配置文件中添加(~/.zshrc 或 ~/.bashrc):
export http_proxy=http://127.0.0.1:PORT
export https_proxy=http://127.0.0.1:PORT
export all_proxy=socks5://127.0.0.1:PORT
或临时设置:
export http_proxy=http://127.0.0.1:PORT https_proxy=http://127.0.0.1:PORTRoot Cause: The terminal environment does not have proxy variables set, so command-line tools (git/curl/npm, etc.) do not use the proxy.
Solutions:
Add to the shell configuration file (~/.zshrc or ~/.bashrc):
export http_proxy=http://127.0.0.1:PORT
export https_proxy=http://127.0.0.1:PORT
export all_proxy=socks5://127.0.0.1:PORT
Or set temporarily:
export http_proxy=http://127.0.0.1:PORT https_proxy=http://127.0.0.1:PORT