< Home

apply cost

Function

The apply cost command sets the MED value for BGP routes or cost value for routes of other protocols.

The undo apply cost command cancels the configuration.

By default, no MED value is set for BGP routes nor cost value is set for routes of other protocols.

Format

apply cost [ + | - ] cost

undo apply cost

Parameters

Parameter Description Value
+

Increases the MED or cost value.

-
-

Decreases the MED or cost value.

-
cost

Specifies the MED value for BGP routes or cost value for routes of other protocols.

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.

Configuration Impact

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

# Configure an apply clause to set the route MED or cost to 120.

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