Skip navigation
Cisco Learning Home > Certifications > Service Provider (CCIP) Retired > Discussions

_Communities

This Question is Answered 1 Helpful Answer available (2 pts)
943 Views 11 Replies Latest reply: Mar 20, 2012 11:14 PM by Paul Hayes RSS

Currently Being Moderated

BGP Route Selection Doubt

Feb 1, 2012 8:25 PM

Abhinash 3 posts since
Nov 5, 2011

Hi Experts,

 

I would like to have your eyes on this question.

 

I'm having Mulihoming BGP. For a particular route, this is what i get from my ISPs

 

SG-RT-FONTANA#sh ip bgp 31.25.192.133

BGP routing table entry for 31.25.192.0/24, version 528322

Paths: (2 available, best #2, table Default-IP-Routing-Table)

  Not advertised to any peer

  4657 3549 56565 (Starhub ISP)

    203.116.8.41 from X.X.X.X  (X.X.X.X )

      Origin IGP, localpref 100, valid, external

  3491 3549 56565 (PCCW ISP)

    63.218.213.77 from X.X.X.X (X.X.X.X )

      Origin IGP, localpref 100, valid, external, best

      Community: 228788176 228788185 228789725 232591791 232619090

 

When I shut down the PCCW ISP, router will select the Starhub ISP as best route but when I switched back the PCCW ISP, BGP router still consider Starhub ISP as best route

 

Thank You

Abhinash

  • Brian 2,971 posts since
    Aug 17, 2009
    Currently Being Moderated
    1. Feb 2, 2012 3:01 AM (in response to Abhinash)
    Re: BGP Route Selection Doubt

    This is normal BGP behavior to prevent route flapping.  Based on the BGP Best Path Algorithm and your two routes, step 10 is the deciding factor.  See below:

     

    10) When both paths are external, prefer the path that was received first (the oldest one).

    This step minimizes route−flap because a newer path does not displace an older one, even if the newer
    path would be the preferred route based on the next decision criteria (Steps 11, 12, and 13).

    Skip this step if any of these items is true:

    a) You have enabled the bgp best path compare−routerid command.

    Note: Cisco IOS Software Releases 12.0.11S, 12.0.11SC, 12.0.11S3, 12.1.3, 12.1.3AA,
    12.1.3.T, and 12.1.3.E introduced this command.

    b) The router ID is the same for multiple paths because the routes were received from the same
    router.

    c) There is no current best path.

    The current best path can be lost when, for example, the neighbor that offers the path goes
    down.

     

    To fix this issue, you can prepend your AS to the route learned via Starhub ISP.  That way when PCCW ISP goes down the Starhub ISP takes over.  Then when PCCW ISP comes back up it will again be the "Best" path due to the shortest AS path (Step 4) in the BGP Best Path Algorithm.

     

    Hope this helps.

     

    Brian

  • Brian 2,971 posts since
    Aug 17, 2009
    Currently Being Moderated
    4. Feb 2, 2012 7:13 AM (in response to Abhinash)
    Re: BGP Route Selection Doubt

    Yes it is very appropriate.  The AS-Path will influence the incoming path to your AS.  You would use Weight or LP to influence the traffic path leaving your AS.

     

    Brian

  • Paul Hayes 32 posts since
    Sep 23, 2009
    Currently Being Moderated
    5. Mar 19, 2012 9:04 AM (in response to Brian)
    Re: BGP Route Selection Doubt

    AS-Path prepending will influence the routes that you advertise to neighbors. These are incoming routes that he's trying to influence, not his own. Weight or LP would be more appropriate.

     

  • Brian 2,971 posts since
    Aug 17, 2009
    Currently Being Moderated
    6. Mar 19, 2012 12:03 PM (in response to Paul Hayes)
    Re: BGP Route Selection Doubt

    As I said if he wishes to influence outbound traffic use weight or LP.  If you wish to influence inbound traffic use AS-Path.

     

    Simple solution, is use AS-Path prepending as he advertises to his ISPs so that PCCW is the preferred path in (shorter AS-Path).  Use Weight or LP to influence outbound traffic to always use PCCW.

     

    If you do not make one of the ISPs preferred (inbound) over the other than you will create asymmetric routing behavior.  Trying to reach the destination 31.25.192.0/24 will use PCCW outbound, but traffic inbound would use Starhub.  As he noted in the opening post.

     

    "When I shut down the PCCW ISP, router will select the Starhub ISP as best route but when I switched back the PCCW ISP, BGP router still consider Starhub ISP as best route"

     

    This is why he needs to use both methods if he wants traffic to/from his AS to the destination 31.25.192.0/24, to use PCCW.

     

    Brian

  • Paul Hayes 32 posts since
    Sep 23, 2009
    Currently Being Moderated
    7. Mar 19, 2012 1:16 PM (in response to Brian)
    Re: BGP Route Selection Doubt

    Sorry, my mistake. I thought you had indicated AS path prepending is the solution to address the route flapping issue.

  • Brian 2,971 posts since
    Aug 17, 2009
    Currently Being Moderated
    8. Mar 20, 2012 5:53 PM (in response to Paul Hayes)
    Re: BGP Route Selection Doubt

    The route was not flapping.  As he stated in the opening post,

     

    "When I shut down the PCCW ISP, router will select the Starhub ISP as best route but when I switched back the PCCW ISP, BGP router still consider Starhub ISP as best route"

     

    The reason it did not switch back to PCCW, is to prevent route flapping.  Starthub remains the best path because the BGP path attributes between the two routes are the same up to Step #10 of the BEST Path Algorithm.  Step #10 being the "oldest" path wins.  One way to make sure that PCCW is again the BEST Path, is to prepend the "local AS" to the BGP route advertisements sent to Starhub, such that the AS-Path is longer.  That way Step#10 is not used to break the tie, but Step #4 the shorest AS-Path.

     

    Attached is the BGP Best Path Algorithm.

     

    Brian

    Attachments:
  • Paul Hayes 32 posts since
    Sep 23, 2009
    Currently Being Moderated
    9. Mar 20, 2012 6:40 PM (in response to Brian)
    Re: BGP Route Selection Doubt

    The prefix in the output will not be affected by as path prepending. It's a prefix that was received on sg-rt-fontana from 2 external AS's. You would use prepending to affect inbound traffic by modifying outbound prefix advertisements. There is nothing to show that there were any paths advertised to starhub or pccw. As shown, this should be handled by weight/LP as it is an inbound prefix which will be used for outbound traffic.

  • Brian 2,971 posts since
    Aug 17, 2009
    Currently Being Moderated
    10. Mar 20, 2012 8:50 PM (in response to Paul Hayes)
    Re: BGP Route Selection Doubt

    Yes, if you apply the AS-Path prepending in the correct direction   Perhaps a little example is in order.

     

    Here is an example topology for Abhinash's problem.  I have used private IP addresses and private AS for his router (R1 in my topology).  His network is lets say 10.10.10.0/24 represented on loopback 0 of R1.  The destination network 31.25.192.0/24 is the loopback 0 on R5.  Based on the output he provided, you can concluded (based on the AS path list) he connects to two unique routers, lets call them R2 (Starhub) and R3 (PCCW) and then these connect to the same router, lets call it R4, which in turn connects to the destination network 31.25.192.0/24 on R5.  Below is the sample topology.

     

    Screenshot.png

     

    Now, his first issue was that when he shuts down the link to R3 (PCCW), R2 (Starhub) takes over.  This is what we would expect to have happen.  But when he brings R3 (PCCW) back up, R3 (PCCW) does not resume the "BEST" path.  Instead R2 (Starhub) remains as the "BEST" path.  I am saying this is correct behavior based on the BGP Best Path Algorithm.  See below:

     

    R1#sh ip bgp 31.25.192.0

    BGP routing table entry for 31.25.192.0/24, version 3

    Paths: (2 available, best #2, table Default-IP-Routing-Table)

    Flag: 0x820

      Advertised to update-groups:

         1        

      4657 3549 56565

        192.168.12.2 from 192.168.12.2 (192.168.24.2)

          Origin IGP, localpref 100, valid, external, best

      3491 3549 56565

        192.168.13.2 from 192.168.13.2 (192.168.34.2)

          Origin IGP, localpref 100, valid, external

    R1#

     

    One way to fix this is to prepend your "OWN" AS to the advertisements received from R2 (Starhub).  This will cause the BGP Best Path Algorithm to break the tie at Step #4 the shortest AS-Path.  You may recall that AS-Path can be used to influence both inbound and outbound path selection.

     

    Therefore, you can create a simple route-map to prepend your OWN AS to the advertisements sent to and received from R2 (Starhuib), thus making R3 (PCCW) the prefered path for both inbound and outbound traffic.  See below:

     

    route-map ADD-OWN-AS permit 10

    set as-path prepend 65001 65001

     

    we apply this to out neighbotship with R2 under the BGP process.

     

    neighbor 192.168.12.2 route-map ADD-OWN-AS in

    neighbor 192.168.12.2 route-map ADD-OWN-AS out

     

    Now look at the output of R1's bgp table for the destination.

     

    R1#sh ip bgp 31.25.192.0

    BGP routing table entry for 31.25.192.0/24, version 2

    Paths: (2 available, best #1, table Default-IP-Routing-Table)

    Flag: 0x820

      Advertised to update-groups:

         2        

      3491 3549 56565     <--- AS-Path is 3

        192.168.13.2 from 192.168.13.2 (192.168.34.2)

          Origin IGP, localpref 100, valid, external, best     <-- will always be the BEST path based on shortest AS-Path

      65001 65001 4657 3549 56565     <--- AS-Path is 5

        192.168.12.2 from 192.168.12.2 (192.168.24.2)

          Origin IGP, localpref 100, valid, external

    R1#

     

    Again, using Weight or LP will only influence the path the outbound traffic will take to reach the destination.  However, it will NOT influence how the traffic will return or inbound to R1.  For this we still would need to prepend our OWN AS outbound to R2 so that the path through R3 is preferred inbound.

     

    So, you can simply use AS-Path prepending inbound and outbound OR use AS-Path prepending inbound and weight or LP outbound.  two possible ways to achieve the same goal.

     

    Hope this helps.

     

    Brian

  • Paul Hayes 32 posts since
    Sep 23, 2009
    Currently Being Moderated
    11. Mar 20, 2012 11:14 PM (in response to Brian)
    Re: BGP Route Selection Doubt

    OK, that helped. Had to make you work for it!

     

    I appreciate the clarification on the as-path prepending in both directions. I think that might've been all that was missing.

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)