Tuesday, August 20, 2013

BGP path selection

Best AS path Algorithm


BGP protocol is designed to scale large networks with hundreds thousands of IP prefixes. As this is an useful information BGP protocol is ideal for the Internet. As this protocol is rich in attributes one must know all of them and try to understand how to manipulate these settings in order to get optimal Control Plane and Routing performance in a production environment.
Primary reason for network engineers to take into consider the BGP attribute paths is that all of the paths that are present in the FIB will not be choosen for the best path. Best paths after evaulation of the BGP proccess will then be advertised via global routing table to other BGP speakers.

There are couple of things to consider before the route gets a valid promotion:

  • The route must be synchronized with an IGP (not if the sync is turned off, in most cases this done)
  • The route must appear in the routing table
  • NEXT_HOP address must be reachable (this is one of the reasons we use an IGP like OSPF)
  • Any filtering routing policy must allow a certain route prefix.

As BGP paths come in the router RIB the must pass a check list of rich attributes to break the tie which one shall be used in the global routing table. The attributes are used in following order:
  1. WEIGHT attribute is a Cisco proprietary, and the routers prefer the path with a highest weight
  2. LOCAL PREFERENCE is commonly used to manipulate the traffic leaving your AS, path with a higher preference is prefered. Default is 100.
  3. LOCALY ORIGINATED will apply to paths that will be used with locally originated routes using the network or aggregate command under the BGP process 
  4. AS-PATH with shorter list of vector path AS-es will be used as a preferred path
  5. ORIGIN IGP < EGP < INCOMPLETE. In this attribute EGP is not used anymore and we can see IGP and incomplete route attribute. Incomplete origin occurs after redistribution of routes into BGP.
  6. MED is often used to manipulate incoming traffic in ISP scenarios. Paths with the lower MEDs are used in the global table.
  7. Preferred eBGP over iBGP paths.
  8. Path with the lowest IGP metric is preferred one.
  9. If both path are external BGP protocol preferres the oldest one.
  10. BGP speaking router with a lowest Router ID is preferred as a better path.
Attributes can be easily seen using any BGP looking glass site with the show ip bgp command.

BGP routing table entry for 8.8.8.0/24, version 79984510
Paths: (2 available, best #1, table Default-IP-Routing-Table)
  Not advertised to any peer
  18398 15169
    121.101.139.51 (metric 5) from 121.101.139.12 (121.101.139.12)
      Origin IGP, localpref 160, valid, internal, best
      Community: 24130:1003 (Peer) 24130:2201 (Sydney)
      Originator: 121.101.139.51, Cluster list: 121.101.139.12, 121.101.139.10
  18398 15169
    121.101.139.52 (metric 6) from 121.101.139.13 (121.101.139.13)
      Origin IGP, localpref 160, valid, internal
      Community: 24130:1003 (Peer) 24130:2201 (Sydney)
      Originator: 121.101.139.52, Cluster list: 121.101.139.12, 121.101.139.10

In this route that is used to reach google DNS server we can see an additional attribute called cluster list. This will be further discussed in future blogs.

Feel free to comment.

P.S. BGP looking glass server I used.


No comments:

Post a Comment