A BGP router can advertise or receive updates from its BGP peer only if it has achieved the Established state with its neighbor. A router running BGP will advertise only a preﬁx to other neighbors that it is going to use in its routing table. Such a preﬁx is called the best path. A rule similar to the split-horizon works in BGP as well. A preﬁx learned from a neighbor will not be advertised back to that neighbor if that was the best route.
Cisco IOS Software offers multiple ways to advertise preﬁxes in BGP. One rule that BGP follows when advertising preﬁxes to other neighbors is that the preﬁx being advertised must exist in the routing table of the advertising router.
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 installs into the BGP Loc-RIB table. Not every route in the Loc-RIB is advertised to a BGP peer.
There are three ways to advertise the preﬁx:
- Using the network statement: network must exist in the routing table.
- Using the redistribute command:
- redistribute connected – all the connected routes are advertised.
- no auto-summary – by default BGP advertises redistributed routes to their natural Classful mask.
- Using the aggregate statement: prefixes are aggregated or summarized to reduce the number of prefixes announcements and reduce the size of the routing table. Aggregation or summarization of subnets can happen only if those subnet exist in the BGP table.
All routes in the Loc-RIB use the following steps for advertisement to BGP peers:
Step 1 Verify Next-Hop Reachability
- 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.
Step 2 Set BGP PAs
The following BGP PAs are set dependent upon the location of the route in the local RIB:
- Connected Network: Next-hop PA set to 0.0.0.0, Origin set to i (IGP), Weight 32,768
- Static Route or Routing Protocol: Next-hop set to the next-hop IP address in the RIB, Origin set to i (IGP), Weight to 32,768 and MED set to IGP metric.
- Redistribution: Next-hop set to the next-hop IP address in RIB, Origin set to ? (incomplete), Weight to 32,768 and MED set to IGP metric.
Step 3 Identify the BGP Best Path
- In BGP, route advertisements consist of the NLRI and the PAs.
- A BGP route may contain multiple paths to the same destination.
- Every path attributes impact the desirability of the route when a router selects the best path.
- A BGP router only advertises the best path to neighboring routers.
- Inside the BGP Loc-RIB table, all routes and their PAs are maintained with the best path calculated.
- The best path is then installed in the RIB.
- In the event the best path is no longer available, the router can use the existing paths to quickly identify a NEW best path.
BGP recalculates the best path for a prefix upon four possible events:
- BGP Next-Hop reachability change
- Failure of an interface connected to an eBGP peer
- Redistribution change
- Reception of new paths for a route
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.
Step 4 Process Outbound Neighbor Route Policies
- The NLRI is processed through any specific outbound neighbor route policies.
- After processing, if the route wasn’t denied by the outbound policies, the route is stored in the Adj-RIB-Out table for later reference.
Step 5 Advertise the NLRI to BGP Peers
- The router advertises the NLRI to BGP peer.
- If the NLRI’s next-hop PA is 0.0.0.0, then the next-hop address is changed to the IP address of the BGP session.