The apply as-path command replaces the original AS_Path list or add the specified AS number to the original AS_Path list when BGP route selection is adjusted.
The undo apply as-path command cancels the configuration.
By default, the original AS_Path list is not replaced and no AS number is added to the original AS_Path list.
apply as-path { { as-number-plain | as-number-dot } &<1-10> { additive | overwrite } | none overwrite }
undo apply as-path
| Parameter | Description | Value |
|---|---|---|
| as-number-plain | Integral AS number | The value is an integer ranging from 1 to 4294967295. |
| as-number-dot | AS number in dotted notation | The value is in the format of x.y, where x and y are integers that range from 1 to 65535 and from 0 to 65535, respectively. |
| additive | Adds the specified AS number to the AS_Path list. | - |
| overwrite | Replaces the AS_Path list with the specified AS number. | - |
| none | Clears the AS_Path list. | - |
Usage Scenario
The AS_Path attribute is private BGP attribute. The apply as-path command takes effect only on BGP routes. The AS-Path list records all ASs that a route passes through from the local to the destination in the distance-vector (DV) order. Using the AS_Path attribute prevents routing loops and controls route selection. If multiple routes are destined for the same destination, BGP compares the AS_Path lists of these routes and considers the route with the shortest AS_Path list as the optimal route.
You can use a route-policy to change AS_Path lists to control BGP route selection and determine the data forwarding path. If routes meet the filtering conditions specified by if-match clauses and the matching mode is set to permit, you can use the apply as-path command to set the AS_Path lists of the routes.
Prerequisites
Before running the apply as-path command, you need to configure a route-policy.
Configuration Effects
Precautions
Configuring the apply as-path command directly affects the path that the traffic passes through and may lead to a loop or a route selection error. Exercise caution when using this command.