OSPF

OSPF Redistribution: How to Inject Routes from Other Protocols

Redistributing static, connected, or EIGRP routes into OSPF creates Type 5 externals. Here is the syntax, E1 vs E2 metric types, and tag-based loop prevention.
OSPF Redistribution: How to Inject Routes from Other Protocols
Table of Contents
In: OSPF

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

Fixed external cost
TypeE2 (default)
Use WhenSingle exit point
External + internal cost
TypeE1
Use WhenMultiple 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:

Written by
More from Ping Labz
Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to Ping Labz.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.