Tuesday, August 19, 2014

Lab 16 - BGP Best path selection - AS-Path Ignore

    The BGP Best path selection algorithm for BGP looks at several path attributes and evaluates them in the following order of preference:

    1. Highest Weight
    2. Highest Local preference
    3. Locally originated
    4. Shortest AS_Path
    5. Origin; prefer IGP, before EGP, before Incomplete
    6. Lowest MED
    7. eBGP paths over iBGP paths
    8. Lowest IGP metric to the next hop
    9. For eBGP prefixes prefer first received route
    10. Lowest router ID
    11. Shortest cluster list length
    12. Lowest neighbor address

    In this lab we will look at how to use a hidden command to modify the best path algorithms order of preference in order to change the pathing decision for a given BGP speaker. In this example we will stop BGP from using the AS_Path attribute when evaluating the best path to a given prefix.

    Tasks:
    -BGP peering has been configured for you
    -loopback network have been configured for you.
    -Modifying the BGP configuration on R1 only, ensure traffic from AS 10 prefers
    the path to R2 for traffic destined for networks originating in AS 30
    -Do not modify any configuration on R2, R3, or R4 to accomplish this
    -Do not modify the weight or local-preference attributes on R1 to accomplish this
    -Do not use redistribution or route-maps to accomplish this

    Topology



    GNS3 files: Link

    Solution

    As the lab states the peering configuration has already been configured for us which makes our work much easier. The lab asks us to modify the path decision made by R1 by only modify R1's configuration. We cannot change the other routers configuration. We also cannot modify the weight or local preference attributes or use static routes or a route-map. Well the limits our options quite a bit.

    So let's look first at how R1 RIB table looks.

    R1#s ip bgp
    BGP table version is 5, local router ID is 1.1.1.1
    Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
                             r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
                             x best-external, a additional-path, c RIB-compressed,
    Origin codes: i - IGP, e - EGP, ? - incomplete
    RPKI validation codes: V valid, I invalid, N Not found

         Network            Next Hop                       Metric        LocPrf    Weight    Path
     *>  1.1.1.0/24       0.0.0.0                                     0                         32768    i
     *>  4.4.4.0/24       192.168.13.3                                                              0    20 30 ?
     *                              192.168.12.2                   1000                                  0    20 30 30 i


    It's important to understand what the various flags mean when looking at the show ip BGP command. This provides a wealth of information and for us tells us how BGP decided on the best path.

    A couple of things stand our here. First the path to R2 has a metric of 1000. According to the best path selection order of preference the lower metric is preferred.  Also, the origin for R3 is incomplete which is the least preferred compared to IGP for R2. Third the path for R2 is shorter, less autonomous systems listed, then R2. So the order of preference to evaluate equal cost paths is AS_PATH, then Origin, then MED. Given the AS_PATH for R3 is shortest its selected as the best path.

    But the labs asks us to make R2 the preferred path but without modifying any attributes. This might seem a challenging task but for this example its actually quite straight forward.

    There is a hidden locally significant command that can be enabled which will tell BGP not to include the AS_PATH attribute in its best path algorithm. If you look closely at the show ip bgp output you will see that if AS_PATH is not compared the next attribute to be evaluated is the origin and as it turns out IGP is preferred over incomplete. So by simply adding the hidden command bgp bestpath as-path ignore and then clearing the bgp process which should see R2 become the new best path

    R1(config)#router bgp 10
    R1(config-router)#bgp bestpath as-path ignore

    R1#clear ip bgp * soft

    R1#sh ip bgp
    BGP table version is 7, local router ID is 1.1.1.1
    Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
                                                      r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
                                                      x best-external, a additional-path, c RIB-compressed,
    Origin codes: i - IGP, e - EGP, ? - incomplete
    RPKI validation codes: V valid, I invalid, N Not found

         Network          Next Hop               Metric   LocPrf Weight  Path
     *>  1.1.1.0/24       0.0.0.0                          0                  32768  i
     *   4.4.4.0/24       192.168.13.3                                             0  20 30 ?
     *>                          192.168.12.2          1000                          0  20 30 30 i

    Now we have achieved our objective, the path through R2 is now the preferred path due to the origin of IGP being preferred over incomplete from R3. Also, keep in mind this is not a command that you would normally configure in a production environment unless you fully understood the implications and impact. The only time that it might be necessary to use this command is when evaluating eBGP routes that have the AS_CONFED attribute.

    Sources





No comments:

Post a Comment