从零开始的 DN42(Day 1):IGP Babel 与 IBGP RR 路由反射器

本文介绍如何在 DN42 网络中使用 Babel 作为 IGP,并配置 IBGP 的 Route Reflector(RR)以简化路由管理。

背景介绍

我(AS4242423374)开始搭建 DN42 网络时,选择了 Babel 作为内部网关协议(IGP),因为它在动态环境中表现良好且易于配置。同时,为了简化 iBGP 的路由管理,我决定使用 Route Reflector(RR)架构。

此外,由于我的网络节点分布在多个位置,我使用 ZeroTier 作为底层的连接方式(并不是因为我懒的起 WireGuard Tunnel)

Babel 作为 IGP 的配置

安装 ZeroTier

需要注意的是,并不需要在 ZeroTier 中配置 DN42 IPv4 和 IPv6 ULA 地址,而是由 ZeroTier 分配私有 IPv6 地址用于节点间的连接。

由于一些原因,我额外分配了 198.18.0.0/15 作为 ZeroTier 网络的 IPv4 地址段,以避免与 DN42 的地址冲突。

配置 Bird2 使用 Babel

在 Bird2 的配置文件中,添加 Babel 协议的配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
protocol direct {
ipv4;
ipv6;
interface "dummy"; # dummy 网卡上应当已经配置了 DN42 的 IPv4 和 IPv6 地址
};

protocol babel int_babel {
ipv4 {
import all;
export where source != RTS_BGP && is_babel_net();
};
ipv6 {
import all;
export where source != RTS_BGP && is_babel_net_v6();
};
interface "ztqu3gq4gl" {
rtt cost 200;
rtt min 10 ms;
rtt max 300 ms;
rtt decay 200;
};
};

interface "ztqu3gq4gl" 需要替换为实际的 ZeroTier 虚拟网卡名称。

此处的 rtt costrtt minrtt maxrtt decay 参数应当根据实际网络情况进行调整,以优化路由选择,参考 Babel’s RTT options,这些参数在 2.14 及以上版本的 Bird2 支持。

IBGP Route Reflector 的配置

Route Reflector 的配置参考如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
template bgp ibgp_rr {
local as OWNAS;
rr cluster id 172.20.154.227;
ipv4 {
import all;
export where source = RTS_BGP && is_valid_network() && !is_self_net();
next hop keep ibgp;
next hop self ebgp;
};
ipv6 {
import all;
export where source = RTS_BGP && is_valid_network_v6() && !is_self_net_v6();
next hop keep ibgp;
next hop self ebgp;
};
graceful restart;
multihop;
}

# RR 之间连接

protocol bgp dn42_node2_rr from ibgp_rr {
neighbor 172.20.0.2 internal;
rr client;
}

# 客户端连接

protocol bgp dn42_node_03 from ibgp_rr {
neighbor 172.20.0.3 internal;
rr client;
}

客户端节点的配置类似,参考如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
template bgp ibgp_rr {
local as OWNAS;
ipv4 {
import all;
export where source = RTS_BGP && is_valid_network() && !is_self_net();
next hop self ebgp;
};
ipv6 {
import all;
export where source = RTS_BGP && is_valid_network_v6() && !is_self_net_v6();
next hop self ebgp;
};
graceful restart;
multihop;
}

protocol bgp dn42_node_01 from ibgp_rr {
neighbor 172.20.0.1 internal;
}

protocol bgp dn42_node_02 from ibgp_rr {
neighbor 172.20.0.2 internal;
}

总结

通过上述配置,我成功地在 DN42 网络中使用 Babel 作为 IGP,并配置了 IBGP 的 Route Reflector(RR),实现了高效的路由管理和动态路由更新。这种架构不仅简化了配置,还提高了网络的可扩展性和稳定性。

此外,感谢 DN42 社群的成员们提供的帮助和建议,使我能够顺利完成这一配置过程。

由于我对于 Bird 和 BGP 的了解还较为浅显,若有错误或改进建议,欢迎在评论区提出。


从零开始的 DN42(Day 1):IGP Babel 与 IBGP RR 路由反射器
https://blog.byteloid.one/2026/01/01/dn42-day1-igp-babel-and-ibgp-rr/
作者
bingxin666
发布于
2026年1月2日
许可协议