According to BGP best Path Selection process, here is the order of BGP preference:
- Prefers the highest weight
- Prefer the Highest local preference
- Prefer Locally Originated routes
- Prefer the shortest AS path
- Prefer the lowest Origin Code
- Prefer the Lowest MED value
- Prefer the routes learned by EBGP over the routes learned by IBGP
- Prefer the routes learned with the lowest router ID
- Keep in Mind the “Weight” attributes is locally significant and is Cisco proprietary, the default value for locally originated routes are 32678
- The default Local preference attribute value for all learned routes is 100 “IF is not modified”
- The default Origin Code is “IGP” if learned and advertised by Network Statement, while “Incomplete” If the route is redistributed into BGP
- The default MED value for all learned route is 0 “Unless modified”, bear in mind MED is compared by default from routed learned from the Same AS number
Configuring Border Gateway Protocol (BGP) can be quite onerous, particularly with large numbers of peering sessions that must be configured manually. In fact, in a large network, the full-mesh requirement for IBGP can be a provisioning nightmare.
BGP’s answer to the IBGP pairing configuration nightmare that is the full mesh is called route reflection. Route reflection allows sharing of routing information among a group of routers without having to send the exact same information to each of them individually. It’s sort of like giving information to one person and having them distribute it to all their peers.
IBGP comes with a significant restriction: IBGP peers should not re-advertise IBGP-learned routes to other IBGP speakers, which is why they all need to be fully meshed. If you can’t re-advertise IBGP routes, you must be directly connected to the originator of the route, hence the full mesh requirement. Remember, IBGP has no dedicated loop prevention mechanism, and this is why you need route reflectors for large networks.
The concept of route reflection allows you to designate one or more of your routers as route reflectors. BGP relaxes the re-advertising restriction on these route reflectors, allowing them to accept and propagate IBGP routes to their clients.
Because of the IBGP full-mesh requirement, this topology would require 15 IBGP peering sessions per router, or 120 distinct IBGP sessions within the network. However, if you designate router 4 as a route reflector, you can start to minimize this requirement. For example, look at what happens in with the routers directly connected to router 4.
In this part of the topology, router 4 has three directly-connected routers. If just this part of the topology is running IBGP, you have to configure a full mesh between the 4 routers. However, if you designate router 4 as a route reflector, BGP only requires that every route reflector client have an IBGP connection to the route reflector (not to each other).
With the new configuration, the IBGP routes from routers 1, 2, and 3 are sent to the route reflector. Router 4, acting as the route reflector, re-advertises these routes to all of its clients.
In this way, router 1 and router 2 are connected via IBGP, through their shared route reflector, router 4. This group of routers is called a cluster, and each cluster is uniquely identified by its cluster ID (a 32-bit number similar to an IP address).
Looking back at the original 16-router network, if you make similar route reflectors with routers 8, 12, and 16, you can create four route reflectors and reduce the number of IBGP sessions.
The 16-router fully meshed route reflector network
However, all 16 routers are still in the same AS, which means that IBGP has to fully connect all 16 routers. How do you do this?
Ultimately, you must have connectivity somewhere. That connectivity occurs at the route reflector level. The route reflectors must be fully meshed, meaning that you must have IBGP peering sessions between each of the four route reflectors.
Essentially, you have drastically reduced the number of IBGP sessions in your network. Where you previously needed 120 sessions to fully mesh your network, you now need only three sessions from each route reflector to its clients and an additional six sessions to fully mesh the route reflectors (for a total of 18 IBGP sessions).
- AS path
- Local Preference
- Multi-Exit Discriminator (MED)
AS path: An ordered list of all the autonomous systems through which this update has passed. Well-known, mandatory.
Origin: How BGP learned of this network. i = by network command, e = from EGP, ? = redistributed from other source. Well-known, mandatory.
Local Preference: A value telling IBGP peers which path to select for traffic leaving the AS. Default value is 100. Well-known, discretionary.
Multi-Exit Discriminator (MED): Suggests to a neighboring autonomous system which of multiple paths to select for traffic bound into your autonomous system. Lowest MED is preferred. Optional, non-transitive.
Weight: Cisco proprietary, to tell a router which of multiple local paths to select for traffic leaving the AS. Highest weight is preferred. Only has local significance.
IGPs, such as EIGRP or OSPF, choose routes based on lowest metric. They attempt to find the shortest, fastest way to get traffic to its destination. BGP, however, has a different way of route selection. It assigns various attributes to each path; these attributes can be administratively manipulated to control the path that is selected. It then examines the value of these attributes in an ordered fashion until it can narrow all the possible routes down to one path.
BGP chooses a route to a network based on the attributes of its path. Four categories of attributes exist as follows:
Well-known mandatory: Must be recognized by all BGP routers, present in all BGP updates, and passed on to other BGP routers. For example, AS path, origin, and next hop
Well-known discretionary: Must be recognized by all BGP routers and passed on to other BGP routers but need not be present in an update, for example, local preference.
Optional transitive: Might or might not be recognized by a BGP router but is passed on to other BGP routers. If not recognized, it is marked as partial, for example, aggregator, community.
Optional non-transitive: Might or might not be recognized by a BGP router and is not passed on to other routers, for example, Multi-Exit Discriminator (MED), originator ID.