FRRouting如何只写RIB不写FIB(内核路由表)实现1C1G轻松收发全表
编辑
7
2025-08-31
以前为了全表或者收发表基本都是bird,或者用gobgp做控制,但是在想用一些功能的时候,还是喜欢FRR(早知道还得原道)
用法1:全部路由都不写入Fib
route-map DENY deny 100
ip protocol bgp route-map DENY
ipv6 protocol bgp route-map DENY
你需要先定义一个拒绝全部的Route-map,应用在protocol即可,当然您可以根据route-map来决定哪些路由写进fib。
如果要在vrf应用,需要在vrf下面敲入这个命令
坑:不能通过BGP Community匹配
一开始我想通过收到的Community匹配那些写Fib,那些不写,但是经过测试(漏了两次之后)发现你在route-map里面匹配community是无效的。
实战案例:客户(下游)写入fib、上游只写入rib、给客户导出全表
ip prefix-list CustomerV4 permit 10.0.0.0/24
ipv6 prefix-list CustomerV6 permit 2400::/48
route-map FIB:Import permit 100
match ip address prefix-list CustomerV4
exit
!
route-map FIB:Import permit 105
match ipv6 address prefix-list CustomerV6
exit
!
route-map ALLOW permit 100
!
route-map UPSTREAM:EXPORT permit 100
match ip address prefix-list CustomerV4
!
route-map UPSTREAM:EXPORT permit 105
match ipv6 address prefix-list CustomerV6
!
router bgp 65525
bgp router-id 11.4.5.14
no bgp default ipv4-unicast
neighbor 10.0.0.1 remote-as 65526
neighbor 10.0.0.1 description "UPStream Full Table"
neighbor 11.0.0.1 remote-as 65526
neighbor 11.0.0.1 description "Downstream Full Table"
neighbor 2400::1 remote-as 65526
neighbor 2400::1 description "UPStream Full Table"
!
address-family ipv4 unicast
network 11.4.5.14/32
neighbor 10.0.0.1 activate
neighbor 10.0.0.1 soft-reconfiguration inbound
neighbor 10.0.0.1 route-map ALLOW in
neighbor 10.0.0.1 route-map UPSTREAM:EXPORT out
neighbor 11.0.0.1 activate
neighbor 11.0.0.1 soft-reconfiguration inbound
neighbor 11.0.0.1 route-map ALLOW in
neighbor 11.0.0.1 route-map ALLOW out
address-family ipv6 unicast
neighbor 2400::1 activate
neighbor 2400::1 soft-reconfiguration inbound
neighbor 2400::1 route-map ALLOW in
neighbor 2400::1 route-map UPSTREAM:EXPORT out
只是作为最小案例配置且单上游环境、环境变更请自行修改
- 0
- 0
-
分享