Skip navigation
Login   |   Register
Cisco Learning Home > CCNP R&S Study Group > Discussions
5719 Views 15 Replies Latest reply: Dec 13, 2010 3:46 PM by Kristy RSS 1 2 Previous Next

Currently Being Moderated

BGP path prepending

Dec 11, 2010 8:56 AM

Ciscos 71 posts since
Dec 11, 2010

I've been looking at BGP recently and i've been confused a little by route prioritization when using a multi-homed ISP.

 

Here's the scenario, lets say I have a router with a primary and backup route to the Internet. I would like the traffic being forwarded to my router to always use the primary line. I've read Cisco docs that say I can use the set as-path prepend <as number> command when setting the BGP neighbor, this should be placed on the backup line to set a preference for the primary link. Can anyone expand on how this works in practice, in regards to how the message is propagated through to the other ISP routers. Or point me towards some documents that could clear this up for me? Would both the primary and backup links have to be using the same AS number for this to work?

 

Also while we're at it are there any alternative solutions to the above problem without using path prepending?

 

Any help appreciated.

  • Conwyn 9,667 posts since
    Sep 10, 2008
    Currently Being Moderated
    1. Dec 11, 2010 9:37 AM (in response to Ciscos)
    Re: BGP path prepending

    Hi Jamie

     

    BGP advertises routes by a concatenation of AS Numbers  

     

    So say you are AS 1   you pass the route to the next AS. The AS passes the route on but adds its own AS so people know how to get to your route.

     

    So if we are sitting at the other side of the Internet we receive a route 100.150.200/24   1:2:3:4:5  so we goto to AS 5 then 4 etc

     

    The backup circuit inserts its own AS a couple of times     so when it arrives at the other end 1:1:1:2:3:4:5.

     

    The remote router will always select the shortest AS path 1:2:3:4:5     rather than 1:1:1:2:3:4:5.

     

    When the primary route fails it is removed from BGP and 1:1:2:3:4:5   is chosen

     

    The remote packet arrives at 1 and realises  does not need to go to 1: 1.

     

    This process is called pre-pending.

     

    If you have only one router then obviously the same AS. If you have two routers I have seen both views.

     

    Regards Conwyn

    Join this discussion now: Login / Register
  • Conwyn 9,667 posts since
    Sep 10, 2008
    Currently Being Moderated
    3. Dec 11, 2010 9:57 AM (in response to Ciscos)
    Re: BGP path prepending

    Hi Jamie

     

    Everything is simple when you understand it.

     

    Regards Conwyn

    Join this discussion now: Login / Register
  • Currently Being Moderated
    4. Dec 11, 2010 10:04 AM (in response to Ciscos)
    Re: BGP path prepending

    Jamie, Conwyn provided a good explanation of pre-pending.  AS_PATH is an ordered list of AS vectors which show the path to the NLRI(aka, IP Prefix), which the BGP update relates to.  The more AS #s in an AS_PATH, the less preferred the route.  You have to take into account the entire BGP path selection process, but as far as AS_PATH is concerned, shorter is better.  Path prepending is a straight forward way to increase the "cost" of a route. 

     

     

    As far as accomplishing this without pre-pending, you would need to work out an agreement with your carrier to use MED or perhaps communities to indicate preferred inbound paths. 

    Join this discussion now: Login / Register
  • Martin 13,894 posts since
    Jan 16, 2009
    Currently Being Moderated
    5. Dec 11, 2010 10:10 AM (in response to Conwyn)
    Re: BGP path prepending

    aren't you missing "i" at the end ?  Which means internal, right ?

    this output can be seen with show ip bgp command

    Join this discussion now: Login / Register
  • Conwyn 9,667 posts since
    Sep 10, 2008
    Currently Being Moderated
    6. Dec 11, 2010 10:53 AM (in response to Martin)
    Re: BGP path prepending

    Hi Martin

     

    It was demonstrating a concept not the contents of the AS_PATH vector. I am sure you be pretty lucky to have a sequence of AS numbers 1 2 3 4 5 in reality. As Travis said there is a whole range of methods you can use but I followed the title of the posting.

     

    Regards Conwyn

    Join this discussion now: Login / Register
  • Martin 13,894 posts since
    Jan 16, 2009
    Currently Being Moderated
    7. Dec 11, 2010 11:26 AM (in response to Conwyn)
    Re: BGP path prepending

    Right, I know, but in  "AS numbers 1 2 3 4 5" where is i ? at the end or in front ?

    Join this discussion now: Login / Register
  • Conwyn 9,667 posts since
    Sep 10, 2008
    Currently Being Moderated
    8. Dec 11, 2010 11:38 AM (in response to Martin)
    Re: BGP path prepending

    Hi Martin

     

    Right hand side

     

    Regards Conwyn

    Join this discussion now: Login / Register
  • Martin 13,894 posts since
    Jan 16, 2009
    Currently Being Moderated
    9. Dec 11, 2010 11:43 AM (in response to Conwyn)
    Re: BGP path prepending

    Right, so it sort of Backwards; and could be confusing for some.

    Join this discussion now: Login / Register
  • Conwyn 9,667 posts since
    Sep 10, 2008
    Currently Being Moderated
    10. Dec 11, 2010 12:23 PM (in response to Martin)
    Re: BGP path prepending

    Hi Martin

     

    Not really. In reality as it passes through each AS the AS is prepend so when it arrives at the other end the first AS in the AS_PATH is the nearest node to the destination so the destination takes the first AS and the packet sets off and each time the AS removes the first entry. It has to do it this way otherwise it would need to know the length of the AS_Path to work out the next entry so the order set is 1 2 3 4 5 but is physically stored within the AS_PATH as 5 4 3 2 1.

     

    Regards Conwyn

    Join this discussion now: Login / Register
  • Scott Morris - CCDE/4xCCIE/2xJNCIE 8,426 posts since
    Oct 7, 2008
    Currently Being Moderated
    11. Dec 12, 2010 8:39 PM (in response to Ciscos)
    Re: BGP path prepending

    Prepending your ASN is well and good, but keep in mind what you are trying to do at that point in influence SOMEONE ELSE's decision on how to get back to you.  It has nothing to do with the path you will choose, so hope that's separated in your intent ok!

     

    AS path is always "nearest" ---- "farthest" when reading left to right.  The "?" you talk about is the origin code though, not as ASN.  That means "unknown" or "incomplete".  In the Cisco world that generally means the route was redistributed.  A network command would give an "i" for the origin code.

     

    HTH,

     

    Scott

    Join this discussion now: Login / Register
  • welly 114 posts since
    Oct 29, 2009
    Currently Being Moderated
    Re: BGP path prepending

    Hi Scott/others

     

    From what I have learned that the as-path prepending method is trying/intended to influence incoming traffic towards your AS,

    However I have seen in contrary implementation where this method is used to affect the outbound route-selection.

    Let say if I put the route-map on inbound direction and set as-path prepend instead I use local-pref or weight instead.

    Maybe the implementor had a thought to have a similar method influencing inbound and outbound traffic

    or maybe he also wanted the AS below hub site get this kind of affection too since multiple AS are exist 

     

    Appreciate input from expert

     

    Welly

    Join this discussion now: Login / Register
  • Kristy 118 posts since
    Dec 3, 2008
    Currently Being Moderated
    13. Dec 13, 2010 2:38 PM (in response to welly)
    Re: BGP path prepending

    You're going to want to use community strings if you can.  Check with your ISP.

     

    I have implemented as-path prepending in a multi homed bgp environment in an attempt to influence incoming traffic; it didn't work well at all.  I had circuits from 2 ISPs one was 3Mbps and the other 20Mbps.  Obviously the smaller was easily flooded and I wanted to use it only as a backup.  I set the prepending, the prepending could be seen when I checked the path to my AS on the Internet; but the circuit still flooded.  The ISP for the smaller link was AT&T and they had a community string that I used to prevent incoming traffic; it worked great.  I wish I would have listened to the engineer who tried to warn me away from prepending to influence inbound; it would have saved me a few days of headaches. 

    Join this discussion now: Login / Register

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)