Posted on Wednesday, 8th June 2005 by sean

BGP Path attributes describe a prefix being advertised. A previous article mentioned AS-Path, which is an ordered list of the autonomous systems to the destination network. There are many more attributes that describe a route, letting downstream people make informed decisions about how to route a packet.

Path attributes are sent in an UPDATE message, and fall into one of four classes:

  • Well-known mandatory
  • Well-known discretionary
  • Optional transitive
  • Optional non-transitive

A further flag, “partial”, is used to denote an attribute that has been attached by someone downstream (ie not the originator).

Attributes that are well-known must be understood by all BGP-4 speakers, and passed along to other peers (though according to the RFC, it is permitted to modify the contents). A mandatory attribute must be present in an update, a discretionary doesn’t have to.

Optional attributes, by contrast, don’t have to be supported. These types of attributes can be either transitive or non-transitive. If a BGP speaker does not understand an optional attribute, it is to be passed along to peers if it is transitive, or removed in the case of non-transitive attributes. In this case it would set the partial bit if it weren’t already set.

So, let’s go through some of the major path attributes, using the same example network from before:

Origin

Well known, mandatory: The origin of the route tells us if the route is internal to the originating AS. The legal values are:

  • i – Internal/IGP
  • e – External/EGP
  • ? – incomplete

Note that this attribute refers to the originating router which is the router that advertised the route into BGP, and not the router receiving the route. That is, most routes will be internal since they will have been advertised by the normal means of a network statement:

r2:
router bgp 3
 network 10.2.2.0 mask 255.255.255.0

On r0, we see this network as:

r0#show ip bgp 10.2.2.0
BGP routing table entry for 10.2.2.0/24, version 3
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Not advertised to any peer
  3
    192.168.3.6 from 10.50.0.2 (10.3.3.1)
      Origin IGP, metric 0, localpref 100, valid, internal, best

If this is changed to

r2:
router bgp 3
 redistribute connected

we see

r0#show ip bgp 10.2.2.0
BGP routing table entry for 10.2.2.0/24, version 12
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Not advertised to any peer
  3
    192.168.3.6 from 10.50.0.2 (10.3.3.1)
      Origin incomplete, metric 0, localpref 100, valid, internal, best

Since the route has been redistributed from another routing protocol (ie connected) before getting into BGP, the origin is considered incomplete.

Origin is used in the BGP decision process, which we’ll look at later.

AS-Path

Well known, mandatory: This is the advertised path for a route.

r3#show ip bgp
BGP table version is 5, local router ID is 10.3.3.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 10.1.1.0/24      192.168.3.2              0             0 2 i
*> 10.2.2.0/24      192.168.3.6              0             0 3 i
*                   192.168.3.2                            0 2 3 i
*> 10.3.3.0/24      0.0.0.0                  0         32768 i

The final column, Path, shows the AS-Path for the route.

Each EBGP peer prepends their own AS to each route before sending it out. This has two implications:

  1. The AS-Path, when read left to right is the path the packet will take from the sender to the receiver, with the destination AS being the rightmost value
  2. Since the AS is prepended at the EBGP peer, the AS-path of a route within an AS won’t contain the AS itself.

This last one is more interesting. For example, look at the AS-path for routes from the perspective of r0:

r0>show ip b
   Network          Next Hop            Metric LocPrf Weight Path
*>i10.1.1.0/24      192.168.3.2              0    100      0 2 i
*>i10.2.2.0/24      192.168.3.6              0    100      0 3 i
*>i10.3.3.0/24      10.50.0.2                0    100      0 i

The path from AS1 to 10.1.1.0 is via AS2 (r1). However the path to 10.3.3.0 has no AS-path, because it’s local to the AS. Indeed, looking at the detailed information on the route shows this:

r0>show ip bgp 10.3.3.0
BGP routing table entry for 10.3.3.0/24, version 5
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Not advertised to any peer
  Local
    10.50.0.2 from 10.50.0.2 (10.3.3.1)
      Origin IGP, metric 0, localpref 100, valid, internal, best

Next Hop

This well known mandatory attribute seems simple, but there are a few rules governing its use. For a route within the AS (iBGP route), it is the internal router originating the route. For eBGP routes, it is the address of the external peer.

Back to our example, anything coming from AS 2 will have R1′s’s address as the next hop. From r0 (AS1)

r0>show ip bgp regexp _2$
BGP table version is 12, local router ID is 10.0.0.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*>i10.1.1.0/24      192.168.3.2              0    100      0 2 i

This is on r0! Therefore, all internal routers must have a route entry to get to all other peers, or the next hop will be unreachable, and the route won’t get placed into the ip routing table. Indeed, r0 has such a route:

r0>show ip route 192.168.3.2
Routing entry for 192.168.3.0/24
  Known via "static", distance 1, metric 0
  Routing Descriptor Blocks:
  * 10.50.0.2
      Route metric is 0, traffic share count is 1

Take that away, and no external routes will be shown, unless the next hop is changed to something reachable.

If we change the r0-r3 relationship somewhat on r3:

router bgp 1
  neighbor 10.50.0.1 next-hop-self

this tells r3 to change the next hop attribute to be itself, rather than the EBGP peer:

r0>show ip bgp regexp _2$
BGP table version is 21, local router ID is 10.0.0.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*>i10.1.1.0/24      10.50.0.2                0    100      0 2 i

To be continued in the next article…

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

Posted in Routing | Comments (1)

One Response to “BGP Path Attributes”

  1. Pandian Says:

    If the “?” symbol comes, where is d problem occur in BGP. I have configured that BGP with different AS. But for me its not show any thing for the below command

    #sh ip route bgp – Kindly guide to resolve the issue.

Leave a Reply