Wednesday, May 30, 2012

BGP's Origin Attribute and What It Means to You

In BGP all prefix's are advertised via Network Layer Reachability Information (NLRI) and are assigned an Origin Attribute, one of the many BGP attributes, but it can be confusing as to what the Origin Attribute means and where it comes from.

The Origin Attribute gives a clue into how the route was generated by the BGP speaker originating the NLRI for a prefix.  Hence the name of 'Origin Attribute'.  It is a well know mandatory attribute that should not be changed by any other BGP speaking router. The Origin Attribute has three different values, which are IGP, EGP, or Incomplete.  In Cisco's BGP RIB, origin values are represented by the following  'i', 'e', or '?' respectively and RFC 4271 assigns them values of 0, 1 , or 2.  But you may wonder where or how the router decides which origin value to advertise in the NLRI.

When the origin attribute of IGP is advertised by a BGP speaker, this means that it originates from an AS's IGP directly. One BGP speaker directly advertises the NLRI through a network statement that has an exact match with a prefix that already exists in the FIB (Forwarding Information Base).  EGP is learned from exactly that, an Exterior Gateway Protocol, such as a predecessor protocol to the BGP protocol.  And finally, the Incomplete Origin is learned and advertised by a BGP speaker from routes redistributed from another protocol such as OSPF, EIGRP, static, etc.  The point of an Incomplete origin value is to let you know that BGP does not know how the prefix was originated.

Now when we are talking about aggregating many prefixes together in BGP some additional rules apply.  If there is at at least one route that has an incomplete origin, the entire aggregated prefix's NLRI will also be marked with an Incomplete origin value.  Same rule is applied if EGP and IGP prefix's are aggregated, if one prefix has an EGP origin the entire aggregate prefix will be advertised as an EGP origin value.  And finally, aggregated prefix's that have all IGP origins will be advertised with IGP value.

This is important in the BGP decision making process, because when an AS Path is the same to a destination prefix, the prefix with the lowest origin attribute value is preferred. As already stated, you cannot change the Origin Attribute of learn prefixes (unless you do some things ISPs do that are against the RFC); so therefore, if you need adjust the BGP RIB through an input policy that changes a different attribute such as AS Path, or local preference.

No comments:

Post a Comment