BGP AS_PATH Attribute



BGP AS_PATH is a well-known mandatory attribute. This attribute identifies the autonomous systems (ASes) through which the UPDATE message has passed. It lists in reverse order the ASes traversed by a prefix, with the last AS placed at the beginning of the list. The primary purpose of AS_PATH is to provide loop-prevention during inter-AS routing.

Four types of AS segments are supported within the AS_PATH in Cisco IOS-

  1. AS_SET - Unordered set of ASes a prefix in the UPDATE message has traversed
  2. AS_SEQUENCE - Ordered set of ASes a prefix in the UPDATE message has traversed
  3. AS_CONFED_SET - Unordered set of Member AS numbers in the local confederation that the UPDATE message has traversed
  4. AS_CONFED_SEQUENCE - Ordered set of Member AS numbers in the local confederation that the UPDATE message has traversed

When a BGP speaker advertises a prefix it learned from another BGP speaker, it modifies the prefix's AS_PATH attribute based on location of BGP peer to which the prefix will be sent i.e. iBGP or eBGP peer-
  • The AS_PATH attribute is not modified when a prefix is advertised to an iBGP peer
  • The AS_PATH attribute is modified as follows when a prefix is advertised to an eBGP peer-
    • if the first path segment of the AS_PATH is of type AS_SEQUENCE, the local system prepends its own AS number as the last element of the sequence.
    • if the first path segment of the AS_PATH is of type AS_SET, the local system prepends a new path segment of type AS_SEQUENCE to the AS_PATH, including its own AS number in that segment
    • if the AS_PATH is empty, the local system creates a path segment of type AS_SEQUENCE, places its own AS into that segment, and places that segment into the AS_PATH.
When a BGP speaker originates a prefix then-
  • the originating BGP speaker includes its own AS number in the path segment of type AS_SEQUENCE in the AS_PATH attribute of all UPDATE messages sent to eBGP peers. The AS_PATH list will have only one AS number in the path segment, and this path segment will be the only path segment in the AS_PATH attribute.
  • the originating BGP speaker includes an empty AS_PATH attribute in all UPDATE messages sent to iBGP peers.

Network topology:



PE1 router receives 192.168.1.0/24, 192.168.2.0/24, 192.168.3.0/24, 192.168.4.0/24 and 192.168.5.0/24 prefixes from BGP AS 10. PE2 router receives 192.168.6.0/24 and 192.168.7.0/24 from BGP AS 20. Both routers advertise these prefixes to PE3 in BGP AS 300 via eBGP.

PE1 router appends its own AS 100 to the AS_PATH list while advertising the prefixes to PE3 router. Similarly, PE2 router appends its own AS 200 to the AS_PATH list while advertising the prefixes to PE3 router.

So, PE3 router uses [100, 10] ASes to reach prefixes in AS 10, while it uses [200, 20] ASes to reach prefixes in AS 20. This is the AS_SEQUENCE path segment type.

BGP table on PE3

PE3# show ip bgp
BGP table version is 8, local router ID is 3.3.3.3
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
*> 192.168.1.0      13.1.1.1                               0 100 10 i
*> 192.168.2.0      13.1.1.1                               0 100 10 i
*> 192.168.3.0      13.1.1.1                               0 100 10 i
*> 192.168.4.0      13.1.1.1                               0 100 10 i
*> 192.168.5.0      13.1.1.1                               0 100 10 i
*> 192.168.6.0      23.1.1.1                               0 200 20 i
*> 192.168.7.0      23.1.1.1                               0 200 20 i

When PE3 router advertises these prefixes to PE4 router in BGP AS 400 via eBGP, it prepends its own AS 300 for all the prefixes.

BGP table on PE4

PE4# show ip bgp
BGP table version is 8, local router ID is 4.4.4.4
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
*> 192.168.1.0      34.1.1.1                               0 300 100 10 i
*> 192.168.2.0      34.1.1.1                               0 300 100 10 i
*> 192.168.3.0      34.1.1.1                               0 300 100 10 i
*> 192.168.4.0      34.1.1.1                               0 300 100 10 i
*> 192.168.5.0      34.1.1.1                               0 300 100 10 i
*> 192.168.6.0      34.1.1.1                               0 300 200 20 i
*> 192.168.7.0      34.1.1.1                               0 300 200 20 i


Aggregation to 192.168.0.0/16 at PE3:

PE3 router implements aggregation for all prefixes to a supernet 192.168.0.0/16. By default, it will also advertise all the more specific prefixes along with the aggregated prefix.

Aggregation-only on PE3

router bgp 300
 aggregate-address 192.168.0.0 255.255.0.0
!

BGP table on PE3

PE3# show ip bgp
BGP table version is 9, local router ID is 3.3.3.3
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
*> 192.168.0.0/16   0.0.0.0                            32768 i
*> 192.168.1.0      13.1.1.1                               0 100 10 i
*> 192.168.2.0      13.1.1.1                               0 100 10 i
*> 192.168.3.0      13.1.1.1                               0 100 10 i
*> 192.168.4.0      13.1.1.1                               0 100 10 i
*> 192.168.5.0      13.1.1.1                               0 100 10 i
*> 192.168.6.0      23.1.1.1                               0 200 20 i
*> 192.168.7.0      23.1.1.1                               0 200 20 i

BGP table on PE4

PE4# show ip bgp
BGP table version is 9, local router ID is 4.4.4.4
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
*> 192.168.0.0/16   34.1.1.1                 0             0 300 i
*> 192.168.1.0      34.1.1.1                               0 300 100 10 i
*> 192.168.2.0      34.1.1.1                               0 300 100 10 i
*> 192.168.3.0      34.1.1.1                               0 300 100 10 i
*> 192.168.4.0      34.1.1.1                               0 300 100 10 i
*> 192.168.5.0      34.1.1.1                               0 300 100 10 i
*> 192.168.6.0      34.1.1.1                               0 300 200 20 i
*> 192.168.7.0      34.1.1.1                               0 300 200 20 i

In order to avoid PE3 router advertising all the more specific prefixes too, the aggregate-address command is applied with summary-only keyword at the end. This causes PE3 router to advertise only summarized prefix 192.168.0.0/16 and suppress all the more specific prefixes. The more specific prefixes are marked with 's' indicating suppressed.

PE3 router uses AGGREGATOR attribute which contains information about the BGP speaker that aggregated the prefix. This attribute contains the BGP ID and AS number that created that aggregated prefix i.e. BGP ID= 3.3.3.3 and AS# 300. This information specifies the source of the less-specific prefixes.

PE3 router also uses ATOMIC_AGGREGATOR attribute to notify downstream BGP peers that the path information for a specific route has been lost. This information is lost when more specific routes are aggregated into a less-specific route. The ATOMIC_AGGREGATOR is just a flag that is set in the BGP UPDATE message.

Summarized route on PE3

PE3# show ip bgp
BGP table version is 16, local router ID is 3.3.3.3
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
*> 192.168.0.0/16   0.0.0.0                            32768 i
s> 192.168.1.0      13.1.1.1                               0 100 10 i
s> 192.168.2.0      13.1.1.1                               0 100 10 i
s> 192.168.3.0      13.1.1.1                               0 100 10 i
s> 192.168.4.0      13.1.1.1                               0 100 10 i
s> 192.168.5.0      13.1.1.1                               0 100 10 i
s> 192.168.6.0      23.1.1.1                               0 200 20 i
s> 192.168.7.0      23.1.1.1                               0 200 20 i

PE3# show ip bgp 192.168.0.0
BGP routing table entry for 192.168.0.0/16, version 18
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Flag: 0x820
  Advertised to update-groups:
     1
  Local, (aggregated by 300 3.3.3.3)
    0.0.0.0 from 0.0.0.0 (3.3.3.3)
      Origin IGP, localpref 100, weight 32768, valid, aggregated, local, atomic-aggregate, best

As seen below, PE4 router receives only the aggregated prefix 192.168.0.0/16 with ATOMIC_AGGREGATOR flag set indicating the path information is lost. The prefix also contains the information of PE3 router performing the aggregation.

BGP table on PE4

PE4# show ip bgp
BGP table version is 2, local router ID is 4.4.4.4
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
*> 192.168.0.0/16   34.1.1.1                 0             0 300 i
PE4# show ip bgp 192.168.0.0
BGP routing table entry for 192.168.0.0/16, version 4
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Flag: 0x820
  Not advertised to any peer
  300, (aggregated by 300 3.3.3.3)
    34.1.1.1 from 34.1.1.1 (3.3.3.3)
      Origin IGP, metric 0, localpref 100, valid, external, atomic-aggregate, best


Aggregation with AS-SET:

To preserve the AS information for the aggregated route when PE3 router in AS 300 aggregates the 192.168.0.0/16 range of addresses, it must use the AS_SET path segment type to list the unordered path list that is used to reach the networks.

Aggregation with AS-SET

router bgp 300
 aggregate-address 192.168.0.0 255.255.0.0 summary-only as-set
!

This causes PE3 router to not set ATOMIC_AGGREGATOR flag, instead, it includes the complete unordered list of AS numbers.

Prefix 192.168.0.0/16 on PE3

PE3# show ip bgp 192.168.0.0
BGP routing table entry for 192.168.0.0/16, version 17
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Advertised to update-groups:
     1
  {100,10,200,20}, (aggregated by 300 3.3.3.3)
    0.0.0.0 from 0.0.0.0 (3.3.3.3)
      Origin IGP, localpref 100, weight 32768, valid, aggregated, local, best

PE4 router receives this prefix with complete path list with AS 300 of PE3 router prepended to AS_SET path segment.

Prefix 192.168.0.0/16 on PE4

PE4# show ip bgp
BGP table version is 3, local router ID is 4.4.4.4
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
*> 192.168.0.0/16   34.1.1.1                 0             0 300 {100,10,200,20} i

PE4# show ip bgp 192.168.0.0
BGP routing table entry for 192.168.0.0/16, version 3
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Flag: 0x820
  Not advertised to any peer
  300 {100,10,200,20}, (aggregated by 300 3.3.3.3)
    34.1.1.1 from 34.1.1.1 (3.3.3.3)
      Origin IGP, metric 0, localpref 100, valid, external, best


Aucun commentaire:

Enregistrer un commentaire