解决 BIRD 报错 BGP peering state stuck in Active 对等体卡在 Active 修复
排查 使用 BIRD 路由守护进程配置 Calico/云原生网络 BGP 路由反射器时,邻居状态长期停留在 Active,无法建立 Established,分析 端口 179 防火墙阻断、AS 号与多跳配置。
问题现象
执行 birdc show protocols 检查网络路由反射器状态,发现对等体长期处于 Active 状态:
BIRD 2.0.12 ready.
Name Proto Table State Since Info
kernel1 Kernel master4 up 14:00:00
device1 Device master4 up 14:00:00
Node_Peer1 BGP master4 start 14:05:12 Active Socket: Connection closed
触发根因
- BGP 的
Active状态代表本地正在尝试向对端发起 TCP 握手但持续失败或被拒绝,未能进入OpenSent或Established; - 节点间防火墙(iptables/UFW/云安全组)未放行 TCP 179 端口;
- BGP 对等体之间跨越了三层路由器但未在配置中启用
multihop(多跳),报文 TTL=1 导致直连检查失败。
解决步骤
检查并确保两端主机的 TCP 179 端口全向互通
使用 nc 快速测试连通性:
nc -zvw3 10.0.2.10 179
# 若不通,放行防火墙
iptables -I INPUT -p tcp --dport 179 -j ACCEPT
在 bird.conf 中对跨网段邻居启用 multihop 特性
配置邻居属性:
protocol bgp Node_Peer1 {
local as 64512;
neighbor 10.0.2.10 as 64512;
multihop 4;
graceful restart on;
ipv4 {
import all;
export all;
};
}
执行 birdc configure 动态热重载配置文件
运行:birdc configure。
验证确认
重新查看协议对等状态:
Node_Peer1 在数秒内顺利从 Connect 跃迁为 Established,百万条 BGP 路由全量瞬时收敛。


