Wednesday, January 30, 2013

BGP terminologies - Part 1

1. BGP neighborship states

Before a BGP peer forming neighborship with a remote BGP peer, it must pass through several states:
  • Idle
  • Connect
  • Active
  • OpenSent
  • OpenConfirm
  • Established
 Before enabling BGP process, both R1 and R2 in Idle state and ignore all incoming requests. When R1 enables BGP process, it sends TCP request to R2 and waits for reply. At this time, R1 goes to Connect state. If connection establishes, R1 will send an Open message to R2 and goes to OpenSent state. If fails, R1 transitions to Active state.
To view the state of local router, use command:


In Active state, R1 is trying to send TCP request to R2, if connection establishes successfully, R1 will send Open message and transitions to OpenSent state.


When R1 reaches OpenSent state, it will send to R2 Open message, if valid Open message received, Keepalive message will be sent to negotiate session parameters and R1 goes to OpenConfirm state.
In OpenConfirm state, R1 keeps sending Keepalive message, and when it received Keepalive from R2, final state Established reached.


2. BGP Attributes

BGP choose route highily based on the values of path attributes. This post considers some well-known attributes which router must regconize.
  • Origin: this attribute states out the originally of route, maybe the route from IGP - i, or EGP - e, or undetermined - ?. i < e < ? and lower value is prefered.
  • AS Path: lists all traversed AS, used to choose the best route and prevents routing loop. This value is only changed when advertised through eBGP. 
  • Next hop: next hop address, only modified when received from an eBGP peer. Must appear in routing table.
  • Multiple Exit Discriminator (MED): optional, nontransitive, eBGP advertises to iBGPs to help choosing route when multiple routes exist. iBGP does not readvertise to eBGP.
  • Local Preference: locally value, never advertised to eBGP. This value is used to consider routes in the same AS. Higher value is prefered.
3. Route selection process

The route selection process depends on each vendor. For Cisco, it is:
  • Weight - highest (Cisco proprietary)
  • Local preference - highest
  • locally originated
  • AS Path - shortest
  • Origin (i
  • MED - lowest
  • eBGP>iBGP
  • IGP metric - lowest
  • oldest route
  • neighbor with lowest RID
  • neighbor with lowest IP address.
For Juniper:
  • Highest Local preference
  • AS Path - shortest
  • Origin - smallest
  • MED - smallest
  • eBGP > iBGP
  • IGP metric - smallest

No comments:

Post a Comment