Three tables are used in BGP for maintaining network prefixes and path attributes.
The Adj-RIB-In contains the Network Layer Reachability Information (NLRIs) in their original form before any inbound routing policies were applied. This table is purged once all route policies have been processed to save memory.
The Loc-RIB contains all the Network Layer Reachability Information data that were generated locally or originated from other BGP peers. Once NLRI have passed the next-hop reachability check and are deemed valid, the BGP algorithm selects the best NLRI. The Loc-RIB table is used when it comes to presenting routes to the routers routing table.
The Adj-RIB-Out table contains network layer reachability information after the route policies have been processed.
Not every route will be injected into the routing table, or advertised out to other peers. BGP performs a process when it comes to route processing:
The route will initially be stored in the Adj-RIB-In table in its original state, and any inbound route policies will be applied if applicable for that neighbour.
Once processing on the Adj-RIB-In table is complete, the route will be moved to the Loc-RIB table with the processing result attached.
If the newly added route in the Loc-RIB table is valid and the next hop address is resolvable in the routers routing information base (RIB), it will be good to be processed further. The process stops here and the route remains in the Loc-RIB if these two checks fail.
Out of all the routes that passed the checks, the best path and its attributes are passed on to the final step.
The best path is installed in the routers RIB/routing table, any outbound routes as a result of this are processed by policy, and non discarded routes are copied into the Adj-RIB-Out table for advertisement to peers.
Displaying Database Contents
To show database contents in BGP, the command
show bgp ipv4 unicast can be used. Adding
detail to the end of the command will show the entire BGP table will all path attributes.
|Network||List of network prefixes processed by BGP. If multiple NLRIs existed for the same prefix, only the first one is identified and others are blank. The best path is selected with a > and valid paths are displayed with a *|
|Next Hop||The next hop for that specific NLRI|
|Metric||The MED, multi exit discriminator, for that specific NLRI|
|LocPrf||Used in BGP best-path algorithm for that specific NLRI|
|Weight||Locally significant Cisco attribute used in BGP best-path algorithm|
|Path and Origin||AS_Path: Used for loop preventation and used in BGP best-path algorithm|
Origin: Used in best-path algorithm. i means IGP, e means EGP, and ? means redistributed into BGP.
Running the command s
how bgp ipv4 unicast 192.168.1.0 will show all the paths for the specific route 192.168.1.0
The Adj-RIB-Out can be viewed with the command
show ip bgp ipv4 unicast neighbour 192.168.1.2 advertised routes to display the contents of the Adj-RIB-Out table for that peer.