Claw-blog netcheck

网络连通性排查工具。用于解决 GitHub/Codex/Web Search 等外部服务连接失败的问题,自动检查并修复 Clash 代理状态。

install
source · Clone the upstream repo
git clone https://github.com/zzvei/claw-blog
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/zzvei/claw-blog "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/openclaw/netcheck" ~/.claude/skills/zzvei-claw-blog-netcheck && rm -rf "$T"
OpenClaw · Install into ~/.openclaw/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/zzvei/claw-blog "$T" && mkdir -p ~/.openclaw/skills && cp -r "$T/skills/openclaw/netcheck" ~/.openclaw/skills/zzvei-claw-blog-netcheck && rm -rf "$T"
manifest: skills/openclaw/netcheck/SKILL.md
source content

网络连通性排查技能

功能

当遇到以下问题时自动触发:

  • GitHub 连接失败(443 timeout)
  • Codex 连接失败
  • Web Search/API 调用失败
  • 任何外部网络请求超时

排查步骤(按顺序执行)

1. 检查 Clash 是否运行(伪装名 sysmon)

ps aux | grep -E "sysmon|clash" | grep -v grep
  • 如果没有进程 → 跳到步骤 2
  • 如果有进程 → 跳到步骤 3

2. 启动 Clash(如果未运行)

# 检查 Clash 目录是否存在
ls -la ~/clash/

# 如果目录不存在,重新下载并配置
mkdir -p ~/clash && cd ~/clash
wget "https://84179.big-files.make-w0rld-static.club:8000/file/ikuuu-static-release/clash-linux/clash-linux-1.0.1/clash-linux-amd64.gz" -O clash-linux-amd64.gz
gzip -d clash-linux-amd64.gz && mv clash-linux-amd64 clash && chmod +x clash

# 下载配置
wget -O config.yaml "https://r5o5u.no-mad-sub.one/link/SSRCIyL6qoW9H4EQ?clash=3"

# 启动 Clash(使用伪装名 sysmon,端口 10808/10809)
rm -f Country.mmdb
nohup ./sysmon -d . > /tmp/clash.log 2>&1 &
sleep 5

# 验证
curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:9090

3. 检查 Clash 是否正常工作

# 检查端口监听
curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:7890
curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:9090

# 测试代理是否可用
curl -s -o /dev/null -w "%{http_code}" -x http://127.0.0.1:7890 https://www.google.com --connect-timeout 10

4. 如果 Clash 异常,尝试修复

# 查看日志
cat /tmp/clash.log

# 检查 MMDB 是否损坏
ls -la ~/clash/Country.mmdb

# 强制删除 MMDB 重新下载
rm -f ~/clash/Country.mmdb

# 重启 Clash
pkill -9 clash
sleep 1
cd ~/clash && nohup ./clash -d . > /tmp/clash.log 2>&1 &
sleep 8

# 再次验证
curl -s -o /dev/null -w "%{http_code}" -x http://127.0.0.1:7890 https://www.google.com --connect-timeout 10

5. 设置环境变量(如果 Clash 正常但未生效)

export HTTP_PROXY=http://127.0.0.1:7890
export HTTPS_PROXY=http://127.0.0.1:7890

自动修复脚本

如果检测到问题,可以执行以下一键修复:

# 一键修复 Clash
pkill -9 clash 2>/dev/null; sleep 1
cd ~/clash && rm -f Country.mmdb && nohup ./clash -d . > /tmp/clash.log 2>&1 &
sleep 8
curl -s -o /dev/null -w "%{http_code}" -x http://127.0.0.1:7890 https://www.google.com --connect-timeout 10 && echo " ✅ Clash 正常" || echo " ❌ 仍有问题"

常见问题

症状原因解决方案
Clash 进程不存在VM 重启后进程丢失重新启动 Clash
端口 7890 无响应MMDB 损坏或配置问题删除 Country.mmdb 重启
代理能连但无法访问 GitHub订阅链接失效重新下载配置
代理可以 ping 通但无法访问节点问题切换节点