Thursday, August 7, 2014

Lab 13 - Best path selection - Origin

    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

    Today's lab will focus on the Origin attribute and how to use it for traffic engineering purposes.

    Tasks:
    -Establish eBGP peering between R1, R2, R3, and R4
    -Establish iBGP peering between R3 and R2.
    -Advertise the loopbacks on R1 and R4 into BGP
    -Ensure traffic originating from AS 10 destined for AS 40 enters
    AS 20 via R3
    -You can only use the Origin attribute to accomplish this.

    Topology



    GNS3 files: Link


    Solution

    Let's begin by establishing our BGP peering as required by the lab tasks.

    R1(config)#router bgp 10
    R1(config-router)#neighbor 192.168.12.2 remote-as 20
    R1(config-router)#neighbor 192.168.13.3 remote-as 20

    R2(config)#router bgp 20
    R2(config-router)#neighbor 192.168.12.1 remote-as 10
    R2(config-router)#neighbor 192.168.23.3 remote-as 20
    R2(config-router)#neighbor 192.168.24.4 remote-as 30

    R3(config)#router bgp 20
    R3(config-router)#neighbor 192.168.13.1 remote-as 10
    R3(config-router)#neighbor 192.168.34.4 remote-as 30

    R4(config)#router bgp 30
    R4(config-router)#neighbor 192.168.24.2 remote-as 20
    R4(config-router)#neighbor 192.168.34.3 remote-as 20

    R1(config-router)#network 1.1.1.0 mask 255.255.255.0

    R4(config-router)#network 4.4.4.0 mask 255.255.255.0

    Next we want to ensure traffic coming into our AS 20 from AS 10 does so through R3. We must do this using the Origin attribute. The origin attribute is a well-known mandatory as-path attribute. It consist of three possible values listed in the order of preference.

    • iGP
    • eGP
    • Incomplete

    Origin is 5th in the line of attributes evaluated by the best path algorithm. So in order for the origin attribute to influence routing decisions weight, local preference, local origination, and as-path values must be equal. As it turns out this is the case with the prefixes we need to influence. So we can easily modify the origin attribute using a route-map and apply it outbound on a neighbor statement. Since the current origin values are iGP, the highest value, we want to lower the value of the path we do not want traffic to use. We do this using a route-map and apply it outbound to the neighbor statement of the path we want to influence.

    R2(config)#route-map CHANGE_ORIGIN permit
    R2(config-route-map)#set origin incomplete
    R2(config-route-map)#exit

    R2(config)#router bgp 20
    R2(config-router)#neighbor 192.168.12.1 route-map CHANGE_ORIGIN out

    Now let's compare our BGP RIB's before and after applying our route map to verify our solution.

    R1#sh ip bgp
    <snip>
         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 i
     *>                   192.168.12.2                           0 20 30 i

    R1#clear ip bgp * soft

    R1#sh ip bgp
    <snip>
         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 i
     *                    192.168.12.2                           0 20 30 ?

    A quick trace route to confirm traffic is indeed flowing how we want it.

    R1#traceroute 4.4.4.4 source loopback 0
    Type escape sequence to abort.
    Tracing the route to 4.4.4.4
    VRF info: (vrf in name/id, vrf out name/id)
      1 192.168.13.3 24 msec 44 msec 20 msec
      2 192.168.34.4 40 msec *  84 msec

    That’s it! A rather simple solution but this is a simple scenario.


    Souces:




No comments:

Post a Comment