[宽带症候群] 迁移 quagga-ripd 到 bird2 的配置实例分享

多年前分享了一些帖子主要是多个 LAN 通过 n2n/tinc 等 P2P 技术组网后再通过 quagga-ripd 进行动态路由建立连接,如 /t/791392 等,但在新版本的 openwrt 上 quagga 已经不再官方库中提供了,一个比较简便的方便以及直接使用 frr 进行替换,frr 是...
[宽带症候群] 迁移 quagga-ripd 到 bird2 的配置实例分享
[宽带症候群] 迁移 quagga-ripd 到 bird2 的配置实例分享

多年前分享了一些帖子主要是多个 LAN 通过 n2n/tinc 等 P2P 技术组网后再通过 quagga-ripd 进行动态路由建立连接,如/t/791392等,但在新版本的 openwrt 上  quagga 已经不再官方库中提供了,一个比较简便的方便以及直接使用 frr 进行替换,frr 是 quagga 的分支,配置基本能够通用,配置方法也是接近一致,经过测试是能够正常工作的。

但是一个更好的/更现代的方案就是通过 bird2 做动态路由管理,但是 bird2 和 quagga 的配置差异比较大,而且官方文档其它没有很好的介绍配置的具体作用,要想正常建立一下配置还是挺多坑的,特别是要兼容旧的用 quagga 建立的 rip 路由。

以下分享一下具体配置的迁移实例供参考:

The Migration Example

Let’s look at a concrete scenario. Suppose you have an OpenWrt router acting as a node in a mesh network connected via Tinc VPN (tincn0) and serving a local LAN (br-lan).

The Old Quagga Configuration (/etc/quagga/ripd.conf)

In Quagga, the configuration relied on VTY lines for local access security and network network-fuzzing statements:

password zebra
!
router rip
 network 10.193.111.0/24
 route 10.193.99.0/24
!
access-list vty permit 127.0.0.0/8
access-list vty deny any
!
line vty
 access-class vty

The New Equivalent BIRD2 Configuration (/etc/bird.conf)

In BIRD2, there is no need for local VTY passwords because administration is safely handled via a local Unix Domain Socket (/var/run/bird.ctl).

Instead of network network-fuzzing statements, BIRD2 maps explicitly to kernel interfaces and uses an Export Filter to control exactly what routes get broadcasted:

# 1. Standard Production Log Levels
log syslog { info, warning, error, fatal };

# 2. Unique Router Identifier
router id 10.193.111.99;

# Core Protocol: Synchronizes BIRD routing table with the Linux Kernel
protocol kernel {
    ipv4 {
        import all;
        export all; # Push routes learned via RIP straight to OpenWrt kernel
    };
}

# Core Protocol: Monitors interface link states (Up/Down)
protocol device {
}

# Core Protocol: Imports local directly-connected interfaces into BIRD's memory
protocol direct {
    ipv4;
    interface "br-lan", "tincn0";
}

# RIP Dynamic Routing Protocol Instance
protocol rip my_rip {
    ipv4 {
        import all;    # Accept all RIP routes sent by neighbors
        export filter {
            # Equivalent to Quagga's 'network' and 'route' statements.
            # Only announce these specific local prefixes to neighbors.
            if net ~ [ 10.193.111.0/24, 10.193.99.0/24 ] then accept;
            reject;
        };
    };

    # Run RIPv2 Multicast over the Tinc VPN Interface
    interface "tincn0" {
        version 2;
        mode multicast;
        update time 30;
    };

    # Run RIPv2 Multicast over the Local LAN Interface
    interface "br-lan" {
        version 2;
        mode multicast;
        update time 30;
    };
}

以上,供参考。

来源: v2ex查看原文