← Back to library

IPv6 环境 Telegram 网络失败:为 channel 显式固定 IPv4 family

问题/场景:在 IPv6 可用但到 Telegram IPv6 路径不可达的主机上,telegram send/delete/setMyCommands 频繁 network failed。前置条件:Node22 默认 autoSelectFamily=true,OpenClaw Telegram channel 已启用。实施步骤:先确认错误栈与 network log 指向 autoSelectFamily 路径 → 临时关闭系统 IPv6 验证症状关联 → 在 channel 配置 networkOptions.family=4 固化走 IPv4 → 重启并回归发送/接收。关键配置:channels.telegram.networkOptions.family=4。验证:发送、命令注册、回包均恢复。风险:强制 IPv4 可能掩盖上游 IPv6 路由问题。来源:Issue #21043。

GITHUBDiscovered 2026-02-20Author zeming27
Prerequisites
  • Host has dual-stack or partial IPv6 and Telegram API IPv6 route may be unstable/unreachable.
  • You can edit OpenClaw gateway config and restart service safely.
Steps
  1. Collect telegram network errors and confirm repeated request failures on command APIs.
  2. Optionally disable host IPv6 temporarily to verify issue correlation.
  3. Set `channels.telegram.networkOptions.family = 4` in config to force IPv4 path.
  4. Restart gateway and run send/receive plus command registration smoke tests.
Commands
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
openclaw gateway restart
openclaw gateway status
Verify

Telegram sendMessage/deleteMyCommands/setMyCommands succeed consistently after IPv4 pinning.

Caveats
  • System-wide IPv6 disable is only for diagnosis; prefer per-channel networkOptions fix in production.
  • Some VPS providers rotate network behavior; monitor after kernel/provider updates(需验证).
Source attribution

This tip is aggregated from community/public sources and preserved with attribution.

Open original source ↗
Visit original post