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.
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 }
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.
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. |
- |
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: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:Implementation Procedure
The costs of a Type 1 external route and a Type 2 external route are as follows:
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.