# BGP Aggregate AS-SET

**URL:** <https://forum.networklessons.com/t/bgp-aggregate-as-set/3248>\
**Category:** Lessons Discussion\
**Created:** [March 20, 2018, 11:50am UTC](https://forum.networklessons.com/t/bgp-aggregate-as-set/3248 "2018-03-20T11:50:15Z")\
**Posts on this page:** 1\
**Showing post:** 19

<div class="post-metadata">

**Author:** ![lagapidis](https://cdn-forum.networklessons.com/user_avatar/forum.networklessons.com/lagapidis/32/4949_2.png) [@lagapidis](https://forum.networklessons.com/u/lagapidis)\
**Post date:** [September 24, 2021, 4:55am UTC](https://forum.networklessons.com/t/bgp-aggregate-as-set/3248/19 "2021-09-24T04:55:09Z")

</div>

Hello Narad

According to [RFC4271](https://datatracker.ietf.org/doc/html/rfc4271#page-18), the AS\_PATH is an attribute that is composed of a sequence of AS path segments. Found within the update packet, there are the following fields:

- path segment type - This can be a value of 1 which indicates AS\_SET or 2 which indicates AS\_SEQUENCE
- path segment length - contains the number of ASes in the path segment value field
- path segment value - one or more AS numbers, each encoded as a 2 octet length field.

So, sometimes the AS\_SET is used, sometimes the AS\_SEQUENCE is used. What’s the difference and when is each one used? Well, again according to the RFC:

- AS\_SET: unordered set of ASes a route in the UPDATE message has traversed
- AS\_SEQUENCE: ordered set of ASes a route in the UPDATE message has traversed

When is each type used? Well, under “normal” circumstances, AS\_SEQUENCE is used, because it is useful and often necessary to know the order in which the ASes have been traversed. However, in the event you are using the `aggregate-address` command as is the case here in this lesson, then the ASes cannot and should not be displayed in order. They require an “unordered” format. This is further described in the [5.1.2 AS\_PATH section](https://datatracker.ietf.org/doc/html/rfc4271#section-5.1.2) of the RFC.

> [@narad](#):
>
> Lets say that,In your diagram R2 sending 3 times AS-Path-prepend to the upstream for the prefix 172.16.2.0/24 to R1 and once R1 will do the summarization for this prefix to 172.16.0.0/16 then how that prepend attribute is going to behave ??

In this case, it will behave in the same manner as seen in the lesson. For example, if R2 sends an AS\_PATH of 2 2 2, then the resulting BGP table of R4 would be:

```auto
R4#show ip bgp 
BGP table version is 11, local router ID is 192.168.14.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, 
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, 
              x best-external, a additional-path, c RIB-compressed, 
              t secondary path, 
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network Next Hop Metric LocPrf Weight Path
 *> 172.16.0.0 192.168.14.1 0 0 1 {2 2 2,3} i

```

I hope this has been helpful!

Laz

---

_[View the full topic](https://forum.networklessons.com/t/bgp-aggregate-as-set/3248)._
