The apply cost-type command sets the cost type of the route.
The undo apply cost-type command cancels the configuration.
By default, no cost type of the route is set.
| Parameter | Description | Value |
|---|---|---|
external |
Sets the cost type of IS-IS external routes. |
- |
internal |
Sets the cost type of IS-IS internal routes or sets the MED value of BGP routes as the IGP cost of the next hop. |
- |
type-1 |
Sets Type 1 external routes of OSPF. |
- |
type-2 |
Sets Type 2 external routes of OSPF. |
- |
Usage Scenario
When the cost-style of an IS-IS device is wide, compatible, or wide-compatible, the cost types of external or internal are classified. When the cost-style of an IS-IS device is narrow or narrow-compatible, the imported route classifies the cost type of external or internal. In other words, the apply cost-type command is valid on IS-IS devices only in the narrow or narrow-compatible modes.
The apply cost-type { type-1 | type-2 } command modifies the type of OSPF routes. During route import, OSPF modifies the type but not the cost value of the original route. When OSPF advertises the imported route with the cost and type information to a peer, the peer device will recalculate the cost value of the imported route based on the received information.
When the filtering conditions specified by if-match clauses are met, you can change the cost type of routes to set the imported external routes all to Type-1 or all to Type-2 by using the apply cost-type command. After the cost type of the routes that match the route-policy is set, the cost type of the routes that are imported by using the route-policy is the set cost type.
Prerequisites
Before running the apply cost-type command, you need to configure a route-policy.
Configuration Impact
After routes match the route-policy, the cost type of the routes is changed.
Precautions
When the apply cost-type internal command is applied to IS-IS routes:
Routes are configured as IS-IS internal routes.
When the apply cost-type internal command is applied to BGP routes:
When a router advertises a route learned from an IBGP peer to an EBGP peer, if the apply cost-type internal command is run, the router sets the MED value of the route to be advertised to the EBGP peer as the IGP cost of the next hop of the route.
For the same Route-Policy node, you cannot run the apply cost-type { type-1 | type-2 } command and the apply cost-type { external | internal } command at the same time. This is because the latest configuration overrides the previous configuration.