#!/bin/bash # 隧道挂了(Cloudflare Error 1033)—— 全套体检 set -u echo "════════ 1. 服务状态 ════════" for svc in lanremote-tunnel lanremote-relay lanremote-nettune; do printf " %-22s %s\n" "$svc" "$(systemctl is-active $svc 2>&1)" done echo echo "════════ 2. cloudflared 进程 ════════" ps aux 2>/dev/null | grep '[c]loudflared' | head -3 | sed 's/^/ /' echo " 进程数: $(ps aux 2>/dev/null | grep -c '[c]loudflared')" echo echo "════════ 3. 隧道 unit 的当前配置 ════════" grep -E 'ExecStart|Restart' /etc/systemd/system/lanremote-tunnel.service 2>/dev/null | sed 's/^/ /' echo echo "════════ 4. 最近的隧道日志(关键行)════════" tail -60 /root/lanremote-relay/tunnel.log 2>/dev/null \ | grep -E 'ERR|WRN|Registered|Initial protocol|error|failed|timeout' \ | tail -14 | sed 's/^/ /' echo echo "════════ 5. 日志最后 8 行(不分类型)════════" tail -8 /root/lanremote-relay/tunnel.log 2>/dev/null | sed 's/^/ /' echo echo "════════ 6. /etc/hosts 有没有被我改坏 ════════" echo " argotunnel 条目数: $(grep -c argotunnel /etc/hosts 2>/dev/null || echo 0)" echo " hosts 总行数: $(wc -l < /etc/hosts)" echo " hosts 内容:" cat /etc/hosts | sed 's/^/ /' echo echo "════════ 7. 隧道凭证文件还在吗 ════════" ls -la /root/.cloudflared/ 2>/dev/null | sed 's/^/ /' echo echo "════════ 8. 本机 relay 还活着吗 ════════" curl -s -o /dev/null -w ' relay 本机 HTTP %{http_code}\n' --max-time 8 http://127.0.0.1:8080/v1/health echo echo "════════ 9. 拨测公网 ════════" curl -s -o /dev/null -w ' 公网 HTTP %{http_code}\n' --max-time 25 \ -H 'User-Agent: LanRemote/1.4.0' https://relay.xxmxxs.top/v1/health echo echo "════════ 10. cloudflared 版本和 metrics ════════" cloudflared --version 2>&1 | sed 's/^/ /' curl -s --max-time 5 http://127.0.0.1:20241/metrics 2>/dev/null \ | grep -E '^cloudflared_tunnel_(ha_connections|request_errors|total_requests)' | sed 's/^/ /'