< Home

import-route (OSPF)

Function

The import-route command imports routes that are learned from other protocols.

The undo import-route command removes the imported external routes.

By default, no route is imported from other protocols.

Format

import-route { limit limit-number | { bgp [ permit-ibgp ] | direct | unr | rip [ process-id-rip ] | static | isis [ process-id-isis ] | ospf [ process-id-ospf ] } [ cost cost | type type | tag tag | route-policy route-policy-name ] * }

undo import-route { limit | bgp | direct | unr | rip [ process-id-rip ] | static | isis [ process-id-isis ] | ospf [ process-id-ospf ] }

Parameters

Parameter Description Value

limit limit-number

The maximum number of external routers that can be imported into an OSPF process.

The value is an integer that ranges from 1 to 4294967295.

bgp

Specifies the imported source routing protocol as bgp.

NOTE:

The parameter can only import EBGP routes but not IBGP routes.

-

permit-ibgp

IBGP routes that are permitted to be imported.

NOTICE:

The import of IBGP routes may cause route loops. Therefore, this command must not be configured unless it is necessary.

-

direct

Specifies the imported source routing protocol as direct.

-

unr

Specifies the imported source routing protocol as unr.

User Network Route (UNR) is allocated if dynamic routing protocols cannot be used when users are getting online.

-

rip

Specifies the imported source routing protocol as rip.

-

process-id-rip

Specifies the process ID of the imported RIP routing protocol

The value is an integer ranging from 1 to 65535. By default, it is 1.

static

Specifies the imported source routing protocol as static.

NOTE:

The parameter can only active static routes are imported.

-

isis

Specifies the imported source routing protocol as isis.

-

process-id-isis

Specifies the process ID of the imported IS-IS routing protocol

The value is an integer ranging from 1 to 65535. By default, it is 1.

ospf

Specifies the imported source routing protocol as ospf.

-

process-id-ospf

Specifies the process ID of the imported OSPF routing protocol

The value is an integer ranging from 1 to 65535. By default, it is 1.

cost cost

The cost of a route.

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

type type

The type of a route.

The value is an integer ranging from 1 to 2.

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

By default, it is 2.

tag tag

External tag in the external LSAs.

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

route-policy route-policy-name

Only the routes that match the specific routing policy are imported.

The value must be the name of an existing routing policy.

Views

OSPF view

Default Level

2: Configuration level

Usage Guidelines

Usage Scenario

You can enrich OSPF routing information using the import-route command to import routes discovered by other routing protocols.

When OSPF imports external routes, you can set default values for some additional parameters using the import-route command, such as metric, route tag, and route type. A route tag is used to identify protocol-related information. For example, it can be used to differentiate AS numbers carried in BGP routes imported by OSPF.

By default, the cost of the external routes imported by OSPF is 1; the type of the imported external routes is Type 2; the default tag value of the imported routes is 1.

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 preferences 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 preference of OSPF ASE routes lower than that of IBGP routes (preference value of OSPF ASE routes larger than that of IBGP routes).

Prerequisites

If you need to select external routes using routing policies, the routing policies have been created using the route-policy command before you configure the route-policy parameters.

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.

Follow-up Procedure

  • Configure OSPF to filter the imported routes and advertise them.

    Set conditions to filter the imported routes using the filter-policy import command. Only the routes that meet the conditions can be advertised.

  • Configure default parameters for imported external parameters.

    Configure the default parameters for imported external routes using the default command. The parameters include metric, route tags, and route types (Type 1 or Type 2) of the imported external routes.

Precautions

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.

Creating a route-policy before it is referenced is recommended. By default, nonexistent route-policies cannot be referenced using the command. If the route-policy nonexistent-config-check disable command is run in the system view and a nonexistent route-policy is referenced using the current command, all the routes learned by the specified protocol are imported to the OSPF routing table.

Example

# Specify the imported RIP route as the route of Type-2, with the tag as 33 and the metric as 50.

<sysname> system-view
[sysname] ospf 100
[sysname-ospf-100] import-route rip 40 type 2 tag 33 cost 50
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >