OSPF · · 2 min read

OSPF Redistribution: How to Inject Routes from Other Protocols

OSPF Redistribution: How to Inject Routes from Other Protocols

Basic Redistribution

Redistribute Static Routes

router ospf 1
 redistribute static subnets

Without subnets: Only classful networks redistributed


Redistribute Connected Interfaces

router ospf 1
 redistribute connected subnets

Redistribute from Another Protocol (EIGRP)

router ospf 1
 redistribute eigrp 1 subnets

E1 vs E2 External Routes

Type Metric Calculation Use When
E2 (default) Fixed external cost Single exit point
E1 External + internal cost Multiple exit points

Set metric type:

router ospf 1
 redistribute static subnets metric-type 1

Setting the Metric

Default metric: 20 (except BGP = 1)

Set custom metric:

router ospf 1
 redistribute static subnets metric 50

Route Tagging (Loop Prevention)

Tag routes during redistribution:

router ospf 1
 redistribute eigrp 1 subnets tag 100

Filter tagged routes:

route-map FILTER deny 10
 match tag 100
route-map FILTER permit 20

router ospf 1
 distribute-list route-map FILTER in

Complete Example

R1 (ASBR redistributing static)

ip route 172.16.50.0 255.255.255.0 Null0
ip route 172.16.51.0 255.255.255.0 Null0

router ospf 1
 router-id 1.1.1.1
 network 10.0.0.0 0.0.255.255 area 0
 redistribute static subnets metric 50 metric-type 1

Verification (Other Routers)

R2# show ip route ospf
O E1 172.16.50.0/24 [110/51] via 10.1.1.1
O E1 172.16.51.0/24 [110/51] via 10.1.1.1

O E1 = External Type 1
Metric 51 = 50 (external) + 1 (internal cost)


Best Practices

1. Always Use subnets Keyword

redistribute static subnets  ← Include this

2. Set Explicit Metrics

redistribute eigrp 1 subnets metric 100

3. Use Route Maps for Control

route-map REDIS permit 10
 match ip address prefix-list ALLOWED

router ospf 1
 redistribute static route-map REDIS subnets

4. Tag Redistributed Routes

Prevents routing loops in mutual redistribution scenarios


Summary

Redistribute command — Inject routes from other sources
subnets keyword — Always include for subnet routes
E1 vs E2 — Choose based on exit point count
Metric — Set explicitly for control
Route tagging — Prevent loops

Series Complete! Review Design Best Practices (Article 30)


Internal Links:

Read next

© 2025 Ping Labz. All rights reserved.