zebra-rs:Rust 路由协议栈
用 Rust 从零编写的 BGP、OSPF、IS-IS 路由栈,支持 SRv6、EVPN,并内置 MCP server。
- 浏览
- 16
- 访问
- 0
- 下载
- 0
- Stars
- 81
- 版本
- v26.11.4
详细介绍
项目简介
zebra-rs 是一个用 Rust 从零编写的路由协议栈,覆盖 BGP、OSPF 和 IS-IS,并提供 SRv6、SR-MPLS、L3VPN、EVPN 等扩展。项目强调内存安全、全异步设计、幂等性,并称是首个自带原生 MCP server、可供 AI agent 使用的路由守护进程。项目主页为 http://zebra.rs/。
主要功能
- BGP、OSPF、IS-IS 路由协议实现
- SRv6、SR-MPLS、L3VPN、EVPN 扩展
- 内置原生 MCP server,面向 AI agent 场景
- 采用 candidate/running 配置模型的 CLI 配置方式
- BGP RIB 分片(
rib-sharding)等可调能力
安装与使用
目前只为以下 Ubuntu 版本提供预编译 .deb 包,其他发行版或版本需从源码构建:
| Ubuntu release | Code name | Architectures |
|---|---|---|
| 22.04 | jammy | x86_64, ARM64 |
| 24.04 | noble | x86_64, ARM64 |
| 26.04 | resolute | x86_64, ARM64 |
最快的安装方式是运行安装脚本,它会识别发行版与 CPU 架构,从 GitHub releases 下载匹配的预编译包并用 apt 安装,自动拉取运行时依赖:
curl -fsSL https://zebra.rs/install.sh | bash
安装步骤需要 sudo 权限。把远程脚本直接管道给 bash 会以你的权限执行,建议先阅读 https://zebra.rs/install.sh 再运行。
完整文档位于 https://zebra.rs/docs.html,涵盖:
- Install — nightly 包与支持的发行版矩阵
- Building — 从源码构建、
packaging/setup-build-env.sh构建环境脚本、Debian 包构建 - Configuration — candidate/running 配置模型、CLI 以及各协议与特性的配置说明
注意事项
- 预编译包目前仅覆盖上表中的 Ubuntu 版本,其他环境需自行从源码构建。
- 项目使用 AGPL-3.0 许可证。
- 从 v26.11.2 起,保存的配置若包含已移除的
system dhcp将无法加载;VRF 名称default保留给全局表,vrf default在提交时会被拒绝。
本作品整理自 GitHub 开源项目 zebra-rs/zebra-rs,原作者 @zebra-rs,许可证 AGPL-3.0。中文介绍由 AI 根据项目 README 整理,以原仓库为准。
更新记录
- v26.11.4当前版本
### Upgrade notes * The vty admin role (from `enable`, or from `configure` for a `zebra-rs` group member or with the root password) now lasts the 15 idle minutes it promises: the idle-session sweep used to take it at about 10 * When the role lapses, `vty` leaves configure mode by itself with a one-line notice. `exit` and `help` in configure mode no longer need the role; an abbreviation of `configure` (`conf`) now needs it, as the whole word always did * `vtyhelper` exits 3 when it cannot reach zebra-rs (with a one-line warning on stderr) and 4 when a command needs the admin role the session does not hold; both used to be 1 with nothing printed * `show bgp summary`: the State column is one character wider, to fit `Idle (PfxCt)` * A BGP peer with no remote-as or no address is no longer dialed: a neighbor whose inherited remote-as went away was redialed for ever
- v26.11.3
### Upgrade notes * `interface <if> ipv4 address dhcp` now runs zebra-rs's own DHCP client, with or without `--feature insomnia`. Under the feature the value used to be accepted and do nothing * Name servers learned on an interface (a DHCPv4 or DHCPv6 lease, Router Advertisements) become the host's through systemd-resolved by default. `no-name-server` under `ipv4 dhcp-options`, `ipv6 dhcpv6-options` or `ipv6 ra-options` keeps them back * One interface address per `set` command, IPv4 and IPv6, and addresses keep the order they were set in. JSON and YAML output writes an address as `{"address": …}`; files with the old plain list still load. `ipv4 address dhcp` beside a static IPv4 address on the same interface is refused at commit; a startup configuration is only warned about * `system hostname` is checked at commit on every router: at most 64 characters, in labels of letters, digits and hyphens. With `--feature insomnia` (and so with the insomnia package) a c
- v26.11.2
移除未发布的 system dhcp 配置树,DHCP 改到 service 下;VRF 名称 default 保留给全局表;修复 BGP RIB 分片下 maximum-paths 等参数未下发到分片池、RFC 8950 IPv6 下一跳路由残留、show bgp ipv4 最优与多路径标记缺失等问题。
评论