Configuring route redistribution to OSPF
Configure a redistribute entry to announce certain routes into the OSPF domain, including DvR host routes, static routes, direct routes, Routing Information Protocol (RIP) routes, OSPF routes, IS-IS routes or Border Gateway Protocol (BGP) routes. Optionally, use a route policy to control the redistribution of routes.
Before you begin
-
Enable OSPF globally.
-
Ensure that a route policy exists.
-
Ensure that you set OSPF as the boundary router.
Note
The route policies treat permit and deny rules differently for inbound and outbound traffic.
-
For an in-policy (RIP, BGP) or an accept policy (OSPF) using a route-map, if a particular route is not explicitly denied in the accept policy or in-policy with the route-map, then the route is implicitly allowed.
-
For an out-policy (RIP, BGP) or a redistribute policy (RIP, OSPF, BGP) using a route-map, even if a particular route is not explicitly allowed in the redistribution policy or out-policy with the route-map, then the route is implicitly denied.
-
In order to permit or deny only explicit routes, configure a policy with additional sequences, where, the last sequence permits all routes that are not explicitly permitted or denied.
Procedure
Example
Example 1:
Redistribute static routes from the GRT to OSPF.
Create the redistribution instance, apply a route policy, enable redistribution, and apply the redistribution.
Switch:1>enable Switch:1#configure terminal Switch:1(config)#router ospf Switch:1(config-ospf)#redistribute static WARNING: Routes will not be injected until apply command is issued after enable command Switch:1(config-ospf)#redistribute static route-map policy1 Switch:1(config-ospf)#redistribute static enable Switch:1(config-ospf)#exit Switch:1(config)#ip ospf apply redistribute static Switch:1(config)#show ip ospf redistribute ==================================================================================== OSPF Redistribute List - GlobalRouter ==================================================================================== SRC-VRF SRC MET MTYPE SUBNET ENABLE RPOLICY ------------------------------------------------------------------------------------ GlobalRouter STAT 0 type2 allow TRUE policy1 GlobalRouter DVR 0 type2 allow FALSE
Example 2:
Redistribute DvR host routes from the GRT to OSPF:
Switch:1>enable Switch:1#configure terminal Switch:1(config)#router ospf Switch:1(config-ospf)#redistribute dvr Switch:1(config-ospf)#redistribute dvr enable Switch:1(config-ospf)#exit Switch:1(config)#ip ospf apply redistribute dvr Switch:1(config)#show ip ospf redistribute ============================================================== OSPF Redistribute List - GlobalRouter ============================================================== SRC-VRF SRC MET MTYPE SUBNET ENABLE RPOLICY -------------------------------------------------------------- GlobalRouter DVR 0 type2 allow TRUE test1
Example 3:
Redistribute DvR host routes to OSPF for a specific VRF vrf1:
Switch:1>enable Switch:1#configure terminal Switch:1(config)#router vrf vrf1 Switch:1(router-vrf)#ip ospf redistribute dvr Switch:1(router-vrf)#ip ospf redistribute dvr enable Switch:1(router-vrf)#exit Switch:1(config)#ip ospf apply redistribute dvr vrf vrf1
View the DvR host routes that are distributed into OSPF:
Switch:1(config)#show ip ospf lsdb vrf vrf1 ==================================================================================================== OSPF LSDB - VRF vrf1 ==================================================================================================== Router Lsas in Area 0.0.0.0 LSTYPE LINKSTATEID ADV_ROUTER AGE SEQ_NBR CSUM ---------------------------------------------------------------------------------------------------- Router 192.0.2.1 192.0.2.1 1603 0x8000002d 0xf226 Router 203.0.113.1 203.0.113.1 1608 0x8000002a 0x4104 Network Lsas in Area 0.0.0.0 LSTYPE LINKSTATEID ADV_ROUTER AGE SEQ_NBR CSUM ---------------------------------------------------------------------------------------------------- Network 14.1.1.11 192.0.2.1 1635 0x80000003 0x4909 Summary Lsas in Area 0.0.0.0 LSTYPE LINKSTATEID ADV_ROUTER AGE SEQ_NBR CSUM ---------------------------------------------------------------------------------------------------- AsSummary Lsas in Area 0.0.0.0 LSTYPE LINKSTATEID ADV_ROUTER AGE SEQ_NBR CSUM ---------------------------------------------------------------------------------------------------- NSSA Lsas in Area 0.0.0.0 LSTYPE LINKSTATEID ADV_ROUTER AGE SEQ_NBR CSUM ---------------------------------------------------------------------------------------------------- Opaque-Loc Lsas in Area 0.0.0.0 LSTYPE LINKSTATEID ADV_ROUTER AGE SEQ_NBR CSUM ---------------------------------------------------------------------------------------------------- ==================================================================================================== AsExternal Lsas ==================================================================================================== LSTYPE LINKSTATEID ADV_ROUTER ETYPE METRIC ASE_FWD_ADDR AGE SEQ_NBR CSUM ---------------------------------------------------------------------------------------------------- AsExternal 101.1.1.3 203.0.113.1 2 1 0.0.0.0 1563 0x80000003 0xe7a7 AsExternal 101.1.1.4 203.0.113.1 2 1 0.0.0.0 1477 0x80000003 0xddb0 AsExternal 102.1.1.3 203.0.113.1 2 1 0.0.0.0 1528 0x80000003 0xdab3 AsExternal 102.1.1.4 203.0.113.1 2 1 0.0.0.0 1480 0x80000003 0xd0bc AsExternal 103.1.1.3 203.0.113.1 2 1 0.0.0.0 1531 0x80000003 0xcdbf ... ... ...
Variable definitions
The following table defines parameters for the redistribute command.
Variable |
Value |
---|---|
enable |
Enables the OSPF route redistribution instance. |
metric <0–65535> |
Configures the metric to apply to redistributed routes. |
metric-type <type1|type2> |
Specifies a type 1 or a type 2 metric. For metric type 1, the cost of the external routes is equal to the sum of all internal costs and the external cost. For metric type 2, the cost of the external routes is equal to the external cost alone. |
route-map WORD<0-64> |
Configures the route policy to apply to redistributed routes. |
subnets <allow|suppress> |
Allows or suppresses external subnet route advertisements when routes are redistributed into an OSPF domain. |
vrf-src WORD<1-16> |
Specifies the optional source VRF instance. You can use this variable with the other command variables. |
<bgp|direct|isis|ospf|rip|static|dvr> |
Specifies the type of routes to redistribute (the protocol source). Valid options are bgp, isis, direct, rip, ospf, dvr or static. |
The following table defines parameters for the ip ospf apply redistribute command.
Variable |
Value |
---|---|
vrf WORD<1-16> |
Specifies the VRF instance. |
vrf-src WORD<1-16> |
Specifies the source VRF instance. You do not need to configure this parameter for redistribution within the same VRF. |
WORD<0–32> |
Specifies the type of routes to redistribute (the protocol source). Valid options are bgp, isis, direct, rip, ospf, or static. |