RIB Component
The RIB component receives routes from each routing protocol and stores them in the RIB. For each network prefix the 'best' route is sent to the dataplane for use when forwarding packets. By default, flock uses the Linux kernel as dataplane, but it can be configured to use other dataplanes.
Operational State
Stats
flock@r70:~$ flockc rib vrf default stats
{"total":15,"total_v4":12,"total_v6":3, ...}
Longest Prefix Match (LPM) for destination
-
fib_ip_nhsare the resolved next hops taken from the 'best' protocolflock@r70:~$ flockc rib vrf default lpm 70.0.70.1 {"prefix":"70.0.70.0/24","route":{"fib_ip_nhs":[{"ConnectedNh":{"intf_id":125675, ...,"table_id":{"afi":"ipv4-unicast","vrf_id":254}}}], ...,"protos":[{"admin_dist":0, ...,"origin":"Connected", ...,"ip_nhs":[{"ConnectedNh":{...}}], ...}]}}
Single RIB prefix entry
flock@r70:~$ flockc -f json-pretty rib vrf default lookup 70.0.0.0/8
{
"protos": [
{
"admin_dist": 1,
"origin": {
"Static": "Conf"
},
...
"ip_nhs": [
{
"SpecialNh": {
"table_id": {
"vrf_id": 254,
"afi": "ipv4-unicast"
},
"special_nh_type": "Discard",
...
}
}
],
...
}
],
"fib_ip_nhs": [
{
"SpecialNh": {
...
"special_nh_type": "Discard",
...
}
}
],
...
}
All prefix entries in the RIB
Walk starts at <root> and returns all prefixes within. Use 0.0.0.0/0 or ::/0 for the full IPv4 / IPv6 table. Only the 'best' origin protocol is shown per prefix.
flock@r70:~$ flockc rib vrf default walk 0.0.0.0/0
[["50.0.0.0/8",{"protos":[{"admin_dist":20,"origin":"Bgp", ...,"ip_nhs":[{"RecursiveNh":{ ...,"ip_addr":"90.0.93.61", ...}}], ...}],"fib_ip_nhs":[{"AttachedNh":{ ...,"ip_addr":"90.0.93.61", ...}}], ...}],["70.0.0.0/8",{"protos":[{"admin_dist":1,"origin":{"Static":"Conf"}, ...}], ...}],["70.0.70.0/24",{"protos":[{"admin_dist":0,"origin":"Connected", ...}], ...}], ...]
Connected routes
Connected routes installed by the system interface layer can be looked up or walked independently via the connected subcommand:
flockc rib vrf <vrf-name> connected lookup <ip-network>
flockc rib vrf <vrf-name> connected walk [--af ipv4 | ipv6]
RIB Operation
Help
flockc rib --help
RIB stats
flockc rib vrf <vrf-name> stats
RIB prefix lookup
flockc rib vrf <vrf-name> lookup <ip-network>
RIB walk
flockc rib vrf <vrf-name> walk <root> [--start-from <prefix>] [--max-entries <N>]
Longest Prefix Match (LPM)
flockc rib vrf <vrf-name> lpm <ip-address>
Connected route lookup / walk
flockc rib vrf <vrf-name> connected lookup <ip-network>
flockc rib vrf <vrf-name> connected walk [--af ipv4 | ipv6]
Label RIB (LRIB)
The Label RIB manages MPLS label bindings programmed by protocols such as BGP and OSPF Segment Routing.
LRIB stats
flockc lrib stats
LRIB label lookup
flockc lrib lookup <label>
LRIB walk
flockc lrib walk