BGP Prefix Advertisement Flashcards
BGP Tables
BGP uses three tables for maintaining the network prefix and path attributes (PA) for a route.
Adj-RIB-in: Contains the Network Layer Reachability Information (NLRI) (network prefix and prefix-length) and BGP PAs in the original form that they are received from a BGP peer. The Adj-RIB-in table is purged after all route policies are processed to save memory.
# show ip bgp neighbor x.x.x.x received-routes
Loc-RIB: Contains all the NLRIs that originated locally or that came from the Adj-RIB-in table after passing any inbound route policy processing. Note that BGP PAs in the Loc-RIB might have been modified by the router’s inbound route policies for a specific neighbor.
After NLRIs pass the validity and next-hop reachability check, the BGP best path algorithm selects the best NLRI for a specific prefix.
# show ip bgp
Adj-RIB-out: Contains the NLRIs after outbound route policies have been processed. Different outbound route policies could exist between neighbors, so the Adj-RIB-out keeps track of the neighbors and the NLRIs for each neighbor.
# show ip bgp neighbor x.x.x.x advertised-routes
The network command
The BGP network statements do not enable BGP for a specific interface; instead, they
identify a specific network prefix to be installed into the Loc-RIB table.
After configuring a BGP network statement, the BGP process searches the global RIB for an exact network prefix match. The network prefix can be a connected network, secondary connected network, or any route from a routing protocol.
After verifying that the network statement matches a prefix in the global RIB, the prefix is installed into the Loc-RIB table.
An exact route must exist in the router’s RIB (routing table) for the route to be installed
into the BGP table so that it can be advertised to BGP neighbors.
Prefix Advertisement Process
Not every route in the Loc-RIB table is advertised to a BGP peer.
All routes in the Loc-RIB table follow this process for advertisement to BGP peers:
- Verify next-hop reachability
- Set BGP path attributes
- Identify the BGP best path
- Process outbound neighbor route policies
- Advertise the NLRI to BGP peers
Verify next-hop reachability
Step 1
Confirm that the next-hop address is resolvable in the global RIB.
If the next-hop address is not resolvable in the RIB, the NLRI remains but does not process further.
The next-hop address must be resolvable for the BGP best path process to occur.
Set BGP path attributes
Step 2
The following BGP PAs are set dependent upon the location of the route in the local RIB:
- Connected network: next-hop set to 0.0.0.0, origin set to i (for IGP) and weight to 32,768.
- Static route or routing protocol: next-hop is set to the next-hop IP address in the RIB, origin set to i (for IGP), weight set to 32,768 and MED set to the IGP metric.
- Redistribution: next-hop is set to the next-hop IP address in the RIB, origin set to ? (incomplete), weight set to 32,768 and MED set to the IGP metric.
Identify the BGP best path
Step 3
In BGP, route advertisements consist of the NLRI and the path attributes (PAs).
A BGP route may contain multiple paths to the same destination network.
Every path’s attributes impact the desirability of the route when a router selects the best path.
A BGP router only advertises the best path to the neighboring routers.
Inside the Loc-RIB table, all the routes and their path attributes are maintained with the
best path calculated. The best path is then installed into the RIB table.
The BGP best path selection algorithm influences how traffic enters or leaves an AS.
Changing of BGP PA can influence traffic flow into, out of, and around an AS.
Process outbound neighbor route policies
Step 4
The NLRI is processed through any specific o_utbound neighbor route policies_.
After processing, if the route was not denied by the outbound policies, the route is stored
in the Adj-RIB-Out table for later reference.
Advertise the NLRI to BGP peers
Step 5
The router advertises the NLRI to BGP peers.
If the NLRI’s next-hop BGP PA is 0.0.0.0, then the next-hop address is changed
to the IP address of the BGP session.
Localized Prefix Advertisement Flow
Multiple BGP Sources
All the routes in R1’s routing table can be advertised into BGP, regardless of the source routing protocol.
Redistributing routes learned from an IGP into BGP is completely safe; however, redistributing routes learned from BGP should be done with caution.
BGP can handle 800,000+ prefixes, IGP could have stability problems with fewer than 20K routes.
Note
BGP only advertises the best path to other BGP peers, regardless of the number of routes (NLRI routes) in the Loc-RIB table.