import-route (OSPF view)
Use import-route to redistribute AS-external routes from another routing protocol.
Use undo import-route to disable route redistribution from another routing protocol.
Syntax
import-route protocol [ as-number ] [ process-id | all-processes | allow-ibgp ] [ allow-direct | cost cost-value | nssa-only | route-policy route-policy-name | tag tag | type type ] *
undo import-route protocol [ process-id | all-processes ]
Default
OSPF does not redistribute AS-external routes from any other routing protocol.
Views
OSPF view
Predefined user roles
network-admin
Parameters
protocol: Redistributes routes from the specified protocol.
as-number: Redistributes routes in an AS specified by its number in the range of 1 to 4294967295. This argument applies only to the BGP protocol. If you do not specify this argument, this command redistributes all IPv4 EBGP routes. As a best practice, specify an AS number to prevent the system from redistributing excessive IPv4 EBGP routes.
process-id: Specifies a process by its ID in the range of 1 to 65535. The default is 1.
all-processes: Redistributes routes from all the processes of the specified routing protocol. This keyword is available only when the protocol argument is rip, ospf, or isis.
allow-ibgp: Redistributes IBGP routes. This keyword is available only when the protocol argument is bgp.
allow-direct: Redistributes the networks of the local interfaces enabled with the specified routing protocol. This keyword is available only when the protocol argument is rip, ospf, or isis. If you do not specify this keyword, the networks of the local interfaces are not redistributed. If you specify both the allow-direct keyword and the route-policy route-policy-name option, make sure the if-match rule defined in the routing policy does not conflict with the allow-direct keyword. For example, if you specify the allow-direct keyword, do not configure the if-match route-type rule for the routing policy. Otherwise, the allow-direct keyword does not take effect.
cost cost-value: Specifies a route cost in the range of 0 to 16777214. The default is 1.
nssa-only: Limits the route advertisement to the NSSA area by setting the P-bit of Type-7 LSAs to 0. If you do not specify this keyword, the P-bit of Type-7 LSAs is set to 1. If the router acts as both an ASBR and an ABR and FULL state neighbors exist in the backbone area, the P-bit is set to 0. This keyword applies to NSSA routers.
route-policy route-policy-name: Specifies a routing policy to filter redistributed routes. The route-policy-name argument is a case-sensitive string of 1 to 63 characters.
tag tag: Specifies a tag for external LSAs, in the range of 0 to 4294967295. The default is 1.
type type: Specifies a cost type, 1 or 2. The default is 2.
Usage guidelines
This command redistributes routes destined for other ASs from another protocol. AS external routes include the following types:
Type-1 external routes—Have high credibility. The cost of Type-1 external routes is comparable with the cost of OSPF internal routes. The cost of a Type-1 external route equals the cost from the router to the ASBR plus the cost from the ASBR to the external route's destination.
Type-2 external routes—Have low credibility. OSPF considers the cost from the ASBR to the destination of a Type-2 external route is much bigger than the cost from the ASBR to an OSPF internal router. The cost of a Type-2 external route equals the cost from the ASBR to the Type-2 external route's destination.
The import-route command redistributes only active routes. To display information about active routes, use the display ip routing-table protocol command. The import-route command cannot redistribute default external routes.
The import-route bgp command redistributes only EBGP routes. Because the import-route bgp allow-ibgp command redistributes both EBGP and IBGP routes and might cause routing loops, use it with caution.
The import-route nssa-only command redistributes AS-external routes in Type-7 LSAs only into the NSSA area.
The undo import-route protocol all-processes command removes only the configuration made by the import-route protocol all-processes command, instead of the configuration made by the import-route protocol process-id command.
Examples
# Redistribute routes from RIP process 40 and specify the type, tag, and cost as 2, 33, and 50 for redistributed routes.
<Sysname> system-view [Sysname] ospf 100 [Sysname-ospf-100] import-route rip 40 type 2 tag 33 cost 50
Related commands
default-route-advertise (OSPF view)