# AIGP Translation

**Topology**: ine-spv4

<figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2FnRK3MUrfr0auAEvlULsL%2Fimage.png?alt=media&#x26;token=d6df7483-aaec-4d2b-b111-7295c22e4553" alt=""><figcaption></figcaption></figure>



Load **bgp.aigp.translation.init.cfg**

```
#IOS-XE
config replace flash:bgp.aigp.translation.init.cfg
 
#IOS-XR
configure
load bootflash:bgp.aigp.translation.init.cfg
commit replace
y
```



BGP and AIGP are fully setup in the topology, except AIGP is not enabled for EBGP peers on the ASBRs. Find another way to signal the AIGP without enabling AIGP on the ASBR’s EBGP peers. The local AS should send routes in such a way that the remote AS will always use the lowest AIGP value, no matter what the remote AS’s policies look like.











































## Answer <a href="#d1b6ea9d-ebda-462a-9d37-1675f2a6274c" id="d1b6ea9d-ebda-462a-9d37-1675f2a6274c"></a>

```
#R3, R4
router bgp 100
 template peer-policy EBGP
  aigp send cost-community 44 poi pre-bestpath transitive
  send-community extended
 template peer-policy IBGP
  send-community extended

#R5, R6
router bgp 200
 template peer-policy EBGP
  aigp send cost-community 44 poi pre-bestpath transitive
  send-community extended
 template peer-policy IBGP
  send-community extended
```



## Explanation <a href="#id-9a57321f-8827-4895-b9ab-f33ff455162b" id="id-9a57321f-8827-4895-b9ab-f33ff455162b"></a>

When configuring AIGP, you have the option to encode the AIGP value as either the MED path attribute, or cost-community extended community. This was used to support routers that did not yet support AIGP but had support for these older attributes (cost-community and MED).



You can simply encode the AIGP as the MED using **aigp send med**. However, this will not be added end-to-end by a receiving router to its nexthop IGP metric, so this does not do us any good. Additionally, the remote AS is free to use LP to override this.



When translating the AIGP into a cost-community, you have two options:

* You can use the IGP-cost POI (point of insertion)
  * This means that the cost-community is considered as a tie-breaker after the IGP metric step and before the lowest RID step.
* You can use the pre-bestpath POI
  * This means that it is the very first path selection step (even before weight). You may be familiar with pre-bestpath cost-community when using EIGRP as a PE-CE protocol for VPNv4.



Translating the AIGP into an IGP-cost POT cost-community doesn’t help us either, as the routers have different IGP metrics to the nexthop. Additionally, the remote AS is free to override this with LP. Our best option is to use the pre-bestpath POI. This is a “big hammer” approach.



It is important to note that encoding the AIGP as a cost-community is the _only_ time that a cost-community can be transitive and be advertised to an eBGP peer.



When using the cost-community we must specify a community ID in the range 0-255. A lower community ID is always preferred among multiple routes with a cost-community attribute. If the community IDs tie, then the value of the cost-community is compared. So we must use the same community ID on at least each ASBR for each AS. It doesn’t matter what number we pick - it is arbitrary.



The configuration is fairly simple. On each ASBR we translate the AIGP value into a pre-bestpath cost-community. The **transitive** keyword is necessary to allow the router to advertise this extcommunity to eBGP peers. Without this, the router will not advertise the attribute to its eBGP peer.

```
#R3, R4
router bgp 100
 template peer-policy EBGP
  aigp send cost-community 44 poi pre-bestpath transitive

#R5, R6
router bgp 200
 template peer-policy EBGP
  aigp send cost-community 44 poi pre-bestpath transitive
```



Then we must send extcommunities to our peers.

```
#R3, R4
router bgp 100
 template peer-policy EBGP
  send-community extended
 template peer-policy IBGP
  send-community extended

#R5, R6
router bgp 200
 template peer-policy EBGP
  send-community extended
 template peer-policy IBGP
  send-community extended
```



## Verification <a href="#f56439a8-6228-4d20-aff9-eb39f9d84764" id="f56439a8-6228-4d20-aff9-eb39f9d84764"></a>

On R1 we should see that the pre-bestpath cost-community is seen on all received routes. R1 will not add this value to its own IGP metric to the nexthop. This is now completely different from true AIGP. Instead, this is a way for AS200 to completely override AS100’s decision on how to route traffic to AS200. In a way it sort of forces AS100 to use the MED. (The pre-bestpath value is the same as the MED, but pre-bestpath is the very first path selection step).

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2FgFvMhbyhi5uRUeanYQJf%2Fimage.png?alt=media&#x26;token=55227370-2da8-4b9c-9016-253824f82769" alt=""><figcaption></figcaption></figure></div>



Likewise on XR2, it is preferring the path that results in the lowest cost within AS100, not the end-to-end lowest IGP path.

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2FSzclmect8vlgtqeWP8eQ%2Fimage.png?alt=media&#x26;token=c228ac1a-7d0e-4bce-9481-80648453b205" alt=""><figcaption></figcaption></figure></div>

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2FUygMhcsObLywqV2wj0AR%2Fimage.png?alt=media&#x26;token=30d7eb72-f6af-4eb8-972f-7d208ecf2a95" alt=""><figcaption></figcaption></figure></div>
