The Border Gateway Protocol (BGP) advertisement uses a network statement that specifies the network prefixes to be installed into the BGP Local Routing Information Base (Loc-RIB) table.
BGP searches the global RIB for a network prefix match after configuring a BGP network statement. The prefix is added to the BGP Loc-RIB table if there is a match. The following BGP Path Attributes (PAs) are then established, depending on the RIB prefix type:
- Connected Network
- Next-hop BGP attribute – 0.0.0.0
- BGP origin attribute – IGP (i)
- BGP weight – 32,768.
- Static Route/Routing Protocol
- Next-hop BGP attribute – next-hop IP address in the RIB
- BGP origin attribute – IGP (i)
- BGP weight – 32,768
- Multi Exit Discriminator (MED) – IGP metric
Advertising BGP Routes
All the routes in the Loc-RIB table are advertised to BGP peers using the following steps:
- Pass the validity check to ensure that the Network Layer Reachability Information (NLRI) is valid and the next-hop address can be resolved in the global RIB. If the NLRI fails, it stays but does not continue processing.
- Process outbound neighbor route policies. If the outbound policies don’t deny a route after processing, it is saved in the Adj-RIB-Out table.
- Advertise NLRI to BGP peers. If the next-hop BGP PA of the NLRI is 0.0.0.0, the next-hop address is set to the BGP session’s IP address.
BGP maintains the network prefix and PAs for a route using the following tables:
- Adj-RIB-In – stores the NLRIs in their original form before processing inbound route policies. The table is cleared after all route policies are processed.
- Loc-RIB – contains all local and received NLRIs from BGP peers. The BGP best-path algorithm determines the best NLRI for a particular prefix after the NLRIs pass the validity and next-hop reachability checks. It is also used to present routes to the IP routing table.
- Adj-RIB-Out – consists of NLRIs after processing outbound route policies.
Not all prefixes in the Loc-RIB table are advertised to the BGP peer or installed into the global RIB. BGP carries out the route processing actions:
- Keep the route in its original state in the Adj-RIB-In table and implement the inbound BGP routing policy based on the neighbor that sent the route.
- Update the Loc-RIB with the most recent entry. The Adj-RIB-In table is cleared to conserve memory.
- Pass a validity check to ensure the route is correct and the next-hop address can be resolved in the global RIB. If the route fails, it stays in the Loc-RIB table but is not further processed.
- Figure out the best BGP path and only use that path.
- Add the best-path route into the global RIB, implement the outbound route policy, save the non-discarded routes in the Adj-RIB-Out table, and advertise to peers.
BGP Network Configuration
The BGP network statement is configured using the ‘network <network> mask <subnet-mask>’ command. The topology below shows two BGP routers already configured. However, the loopback interfaces still need to be advertised using BGP.
The network command for BGP route advertisement configuration is entered on the BGP router configuration mode.
Router1(config)#router bgp 1 Router1(config-router)#network 220.127.116.11 mask 255.255.255.0
Router2(config)#router bgp 2 Router2(config-router)#network 18.104.22.168 mask 255.255.255.0
BGP Routing Table Verification
To view the BGP Loc-RIB database, the command is ‘show bgp <afi> <safi>’. AFI stands for Address Family Indicator (IPv4, IPv6) and SAFI is the Subsequent Address Family Indicator (Unicast, Multicast). The BGP Loc-RIB table entries can have multiple paths for the same network prefix.
Router1#show bgp ipv4 unicast BGP table version is 1, local router ID is 22.214.171.124 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path * 126.96.36.199/24 0.0.0.0 0 32768 i
The following are the BGP table fields:
- Network: The network prefixes installed in BGP. Only the first prefix is identified if there are multiple NLRIs for the same prefix. Valid NLRIs have an asterisk ‘*’, and the best path is indicated by an angle bracket ‘>’.
- Next Hop: Defines the next hop IP address for that specific NLRI.
- Metric (MED): Non-transitive optional BGP PA for the specific NLRI.
- LocPrf (Local Preference): It is used in the BGP best-path algorithm for the specific NLRI.
- Weight: Locally significant Cisco attribute used in the BGP best-path algorithm for that specific NLRI.
- Path (AS_Path): It is used for loop prevention and in the BGP best-path algorithm for the specific NLRI.
- Origin: It’s used in the BGP best-path algorithm. ‘i’ is IGP, ‘e’ is EGP, and ‘?’ indicates redistributed route into BGP.
The command ‘show bgp <afi> <safi> neighbors <ip-address> advertised routes’ shows the Adj-RIB-Out table content for a certain BGP neighbor. The local router is reflected in the next hop address, which will update when the route advertises to the peer.
Router1#show bgp ipv4 unicast neighbors 192.168.10.2 advertised-routes BGP table version is 3, local router ID is 188.8.131.52 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale Origin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight Path *> 184.108.40.206/24 0.0.0.0 0 32768 i Total number of prefixes 1
Other commands that can be used to verify BGP configuration are ‘show ip bgp’ and ‘show bgp ipv4 unicast summary’ to check the exchange of NLRIs between nodes, and ‘show bgp <afi> <safi> <network>’ to view all the paths and the BGP PAs for a specific route.
The BGP routes in the global RIB are shown using the following command:
Router1#show ip route bgp 220.127.116.11/24 is subnetted, 1 subnets B 18.104.22.168 [20/0] via 192.168.10.2, 00:07:51
Download our Free CCNA Study Guide PDF for complete notes on all the CCNA 200-301 exam topics in one book.
We recommend the Cisco CCNA Gold Bootcamp as your main CCNA training course. It’s the highest rated Cisco course online with an average rating of 4.8 from over 30,000 public reviews and is the gold standard in CCNA training: