import-route (OSPF view)

Function

The import-route command imports routes learned by other protocols.

The undo import-route command cancels the configuration.

By default, routes learned by other protocols are not imported.

Format

import-route { direct | static | bgp [ permit-ibgp ] } [ cost cost | { route-policy route-policy-name | route-filter route-filter-name } | tag tag | type type ] *

import-route { ospf | isis | rip } [ process-id-rip ] [ cost cost | { route-policy route-policy-name | route-filter route-filter-name } | tag tag | type type ] *

import-route unr [ cost cost | { route-policy route-policy-name | route-filter route-filter-name } | tag tag | type type ] *

undo import-route { direct | static | bgp }

undo import-route { ospf | isis | rip } [ process-id-rip ]

undo import-route { unr }

Parameters

Parameter Description Value
direct

Imports direct routes.

-

static

Imports static routes.

After the parameter is specified, only active static routes can be imported.

-

bgp

Imports BGP routes.

For an OSPF process that is not bound to a VPN instance or is bound to a VPN instance but the vpn-instance-capability simple command is run, the parameter imports only EBGP routes.

-

permit-ibgp

Imports IBGP routes.

NOTICE:

For an OSPF process that is not bound to a VPN instance or is bound to a VPN instance but the vpn-instance-capability simple command is run, importing IBGP routes may cause routing loops. Therefore, exercise caution when using this parameter.

-

cost cost

Specifies a route cost.

The value is an integer ranging from 0 to 16777214. The default value is 1.

route-policy route-policy-name

Specifies the name of a route-policy.

The name is a string of 1 to 200 case-sensitive characters, with spaces not supported. When double quotation marks are used around the string, spaces are allowed in the string.

route-filter route-filter-name

Specifies the name of a route filter policy.

The value is a string of 1 to 200 case-sensitive characters, spaces not supported. If parameters are included in the referenced route-filter, specify values for them in the format of (var1, var2, ...var8) behind the route-filter name. A maximum of eight parameters can be specified, and each value ranges from 1 to 200 characters.

tag tag

Specifies the tag of an external LSA.

The value is an integer ranging from 0 to 4294967295. The default value is 1.

type type

Specifies the type of the external routes.

The value is 1 or 2.

  • 1: Type 1 external route
  • 2: Type 2 external route

The default value is 2.

ospf

Imports OSPF routes.

-

isis

Imports IS-IS routes.

-

rip

Imports RIP routes.

-

process-id-rip

Specifies the process ID of the protocol whose routes are imported.

The value is an integer ranging from 1 to 4294967295. The default value is 1.

unr

Imports UNR routes.

-

Views

OSPF view

Default Level

2: Configuration level

Task Name and Operations

Task Name Operations
ospf write

Usage Guidelines

Usage Scenario

Importing the routes discovered by other routing protocols can enrich OSPF routing information.

OSPF routes are classified into the following types in the descending order of priorities:

  • Intra-area routes: refer to the routes in an area within an AS.
  • Inter-area routes: refer to the routes between areas of the same AS. Intra-area routes and area external routes are internal routes of an AS.
  • Type 1 external routes: When the cost of external routes is almost the same as that of AS internal routes and can be compared with the cost of OSPF routes, these external routes have a high reliability and can be configured as Type 1 external routes.
  • Type 2 external routes: When the cost of the routes from an ASBR to the destination outside an AS is much greater than the cost of the internal routes to the ASBR, these external routes have a low reliability and can be configured as Type 2 external routes.

    For an OSPF process that is not bound to a VPN instance or is bound to a VPN instance but the vpn-instance-capability simple command is run, only EBGP routes are imported after the import-route bgp command is configured. IBGP routes are also imported after the import-route bgp permit-ibgp command is configured. If IBGP routes are imported, routing loops may occur. In this case, run the preference (OSPF) and preference (BGP) commands to prevent loops by specifying priorities of OSPF and BGP routes. If IBGP routes need to be imported, configure the import-route bgp permit-ibgp command, and run the preference (OSPF) and preference (BGP) commands to set the priority of OSPF ASE routes lower than that of IBGP routes (priority value of OSPF ASE routes larger than that of IBGP routes).

    For an OSPF process that is bound to a VPN instance and the vpn-instance-capability simple command is not run, configuring the import-route bgp command imports both EBGP routes and IBGP routes, no matter whether the import-route bgp permit-ibgp command is configured.

Prerequisites

A route-policy has been created using the route-policy command.

Procedure

The costs of a Type 1 external route and a Type 2 external route are as follows:

  • The cost of a Type 1 external route equals the cost for the OSPF device to reach an ASBR plus the cost of the route from the ASBR to the destination.
  • The cost of a Type 2 external route equals the cost of the route from an ASBR to the destination.

Implementation Procedure

The costs of a Type 1 external route and a Type 2 external route are as follows:

  • The cost of a Type 1 external route equals the cost for the OSPF device to reach an ASBR plus the cost of the route from the ASBR to the destination.
  • The cost of a Type 2 external route equals the cost of the route from an ASBR to the destination.

Configuration Impact

OSPF cannot prevent external routing loops. Therefore, avoid the loops caused by manual configurations when configuring OSPF to import external routes.

After you configure the policy for importing routes using the route-policy parameters, the OSPF process imports only the routes of the network segments that match the requirements to filter unwanted routes.

Precautions

You can use the default (OSPF) command to configure default parameters for OSPF to import external routes, including the cost, type (Type 1 or Type 2), tag, and number of routes.

The import-route (OSPF) command cannot import the default route of an external protocol. To enable a router to advertise the default route of an external protocol it learns when updating the OSPF routing table to other routers within the area, run the default-route-advertise (OSPF) command.

A segment routing-capable device can import OSPF routes. If labels have been assigned to these routes, the labels are imported to a local process by default and advertised using LSAs, regardless of whether the labels are active.

A segment routing-capable device can import labeled IS-IS routes into the OSPF routing table and use the routes to compute SR LSPs.

Example

# Import Type 2 OSPF routes, with tag 33 and cost 50.
<HUAWEI> system-view
[~HUAWEI] ospf 100
[*HUAWEI-ospf-100] import-route isis 1 type 2 tag 33 cost 50
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >