< Home

apply cost

Function

The apply cost command sets the action for changing the cost of routes in a routing policy.

The undo apply cost command restores the default setting.

By default, the action for changing the cost of routes is not set in a routing policy.

Format

apply cost [ + | - ] cost

undo apply cost

Parameters

Parameter Description Value

+

Increases the route cost.

If the MED of BGP routes or cost of non-BGP routes is greater than the maximum value (4294967295) after the adjustment, 4294967295 takes effect.

-

Reduces the route cost.

If the MED of BGP routes or cost of non-BGP routes is less than the minimum value (0) after the adjustment, 0 takes effect.

cost

Specifies the route cost. To control route selection, you can adjust the route cost to prevent routing loops.

The value is an integer ranging from 0 to 4294967295.

Views

Route-Policy view

Default Level

2: Configuration level

Usage Guidelines

Usage Scenario

When the filtering conditions specified by if-match clauses are met, you can run the apply cost command to change the route MED or cost to control route selection. After setting the MED or cost, the MED or cost of the routes that are imported using the route-policy is changed accordingly.

Prerequisites

A route-policy has been configured by route-policy.

Configuration Impact

The costs of routes that match the route-policy are changed. BGP routes do not have costs, and instead, they have MEDs. If the apply cost command is run to configure an apply clause for a route-policy that is designed for BGP routes, the MEDs of BGP routes that match the route-policy are changed.

Precautions

The MEDs or costs of imported routes are independent of the route-policy after the undo apply cost command is used to cancel the route MED or cost.

Example

# Define an apply clause to set the route cost to 120.

<HUAWEI> system-view
[HUAWEI] route-policy policy permit node 10
[HUAWEI-route-policy] apply cost 120
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >