Gateway(网关)使用与排错(SOP)
目标:确保 Gateway 能稳定运行;出问题时能快速定位是“启动/网络/鉴权/配置”。
1) 先看状态(第一优先级)
bash
openclaw gateway status你重点看:
- 是否 Running
- 监听地址/端口(bind/host/port)
- 是否提示需要 token / 未配置
2) 启停/重启(最常用)
bash
openclaw gateway start
openclaw gateway stop
openclaw gateway restart建议:
- 配置改动后优先
restart - 如果你在排障,重启后立刻跟随日志(见下一节)
3) 跟随日志(最重要)
bash
openclaw logs --follow经验:
- Gateway 问题 80% 直接在日志第一屏就能看到原因
- 把“报错前后 20 行”贴出来,基本就能定位
4) 探测(probe)与连通性
bash
openclaw gateway probe适用:
- “能启动但 UI/渠道连不上”
- “怀疑端口/绑定地址/防火墙问题”
5) 常见问题与处理
现象 A:网关不启动 / 启动就退出
先做:
openclaw logs --followopenclaw status --deep
常见原因:
- 配置未完成(安全策略要求)
- 端口占用
- Node/依赖环境异常
临时开发/临时启动(谨慎使用):
bash
openclaw gateway --allow-unconfigured提醒:这适合“临时验证能跑”,不建议长期生产使用。
现象 B:能启动但 Control UI 连不上 / unauthorized
排查顺序:
openclaw gateway status看端口/绑定- 访问 URL 是否带 token:
http://127.0.0.1:18789/?token=<gateway.auth.token>
openclaw logs --follow看是否有鉴权/跨域/连接错误
相关参考:
现象 C:只在远程机器上能跑,本机访问不到
可能原因:
- bind=loopback(只监听 127.0.0.1)
- 防火墙/端口未放行
处理:
- 先确认
gateway status的 bind - 再决定是否需要暴露到局域网/公网(公网务必加访问控制)
6) 验收清单(判断 Gateway 正常)
- [ ]
openclaw gateway status显示 Running - [ ]
openclaw logs --follow无持续报错 - [ ] Control UI 可打开并能对话
- [ ] (如有渠道)channels status 正常