Redistribution
Import only the intended external prefix and verify that another static stays private.
Understand
Redistribution imports reachability from another routing source. The importing router becomes an ASBR and originates external LSAs in a normal area. Native OSPF interface activation is preferable for internal connected networks; do not redistribute everything connected just to enable OSPF.
Define the ownership boundary first: permitted prefixes, source protocols, metric type, seed metric and loop-prevention policy. Use an allowlist with implicit deny and retain subnets in this command syntax. Multiple mutual redistribution points can feed routes back into their source domain. Tags help only when an explicit policy matches and rejects them.
A source route must be eligible in the local routing table. Redistributing a static Null0 route advertises reachability while discarding packets at the ASBR; it is a deliberate control-plane test here, not a real service exit.
Lab setup
Use a fresh lab for this lesson; changes from other lessons are not cumulative. All outputs are illustrative excerpts, not recorded router tests. Transit cost is explicitly 10 and Loopback0 cost is 1. Interface names may vary by image.
| Router | Interface | IPv4 address | Area |
|---|---|---|---|
| R1 | Gi1 | 192.0.2.1/30 | 0 |
| R2 | Gi1 | 192.0.2.2/30 | 0 |
| R2 | Gi2 | 192.0.2.5/30 | 1 |
| R3 | Gi1 | 192.0.2.6/30 | 1 |
Loopback0 is 10.255.0.<router number>/32; area assignments: R1: area 0, R2: area 0, R3: area 1.
Complete baseline configurations
R1
configure terminal
hostname R1
router ospf 1
router-id 10.255.0.1
passive-interface Loopback0
exit
interface Loopback0
ip address 10.255.0.1 255.255.255.255
ip ospf 1 area 0
ip ospf cost 1
exit
interface GigabitEthernet1
ip address 192.0.2.1 255.255.255.252
ip ospf network point-to-point
ip ospf cost 10
ip ospf 1 area 0
no shutdown
exit
endR2
configure terminal
hostname R2
router ospf 1
router-id 10.255.0.2
passive-interface Loopback0
exit
interface Loopback0
ip address 10.255.0.2 255.255.255.255
ip ospf 1 area 0
ip ospf cost 1
exit
interface GigabitEthernet1
ip address 192.0.2.2 255.255.255.252
ip ospf network point-to-point
ip ospf cost 10
ip ospf 1 area 0
no shutdown
exit
interface GigabitEthernet2
ip address 192.0.2.5 255.255.255.252
ip ospf network point-to-point
ip ospf cost 10
ip ospf 1 area 1
no shutdown
exit
endR3
configure terminal
hostname R3
router ospf 1
router-id 10.255.0.3
passive-interface Loopback0
exit
interface Loopback0
ip address 10.255.0.3 255.255.255.255
ip ospf 1 area 1
ip ospf cost 1
exit
interface GigabitEthernet1
ip address 192.0.2.6 255.255.255.252
ip ospf network point-to-point
ip ospf cost 10
ip ospf 1 area 1
no shutdown
exit
endApply
Use the border baseline with all areas normal. R1 owns the import. Add two discard statics but allow only 198.51.100.0/24; 203.0.113.0/24 is the negative test.
R1
configure terminal
ip route 198.51.100.0 255.255.255.0 Null0
ip route 203.0.113.0 255.255.255.0 Null0
ip prefix-list OSPF-IMPORT seq 5 permit 198.51.100.0/24
route-map STATIC-IN permit 10
match ip address prefix-list OSPF-IMPORT
set tag 100
exit
router ospf 1
redistribute static subnets metric 20 metric-type 1 route-map STATIC-IN
endVerify and interpret
R3# show ip route ospf | include 198.51.
O E1 198.51.100.0/24 [110/40] via 192.0.2.5, GigabitEthernet1
R3# show ip route 203.0.113.0
% Network not in table
R3# show ip ospf database external 198.51.100.0
Advertising Router: 10.255.0.1
Network Mask: /24
Metric Type: 1
Metric: 20
Forward Address: 0.0.0.0
External Route Tag: 100The permitted E1 metric is 20 internal + 20 external = 40. The second static is deliberately excluded. With forwarding address zero, the path resolves toward the ASBR.
Remove the permitted source static, then confirm the LSA and route withdraw after convergence. Restore it and verify the permitted route returns. Do not widen the allowlist to fix an unrelated adjacency failure.
R1 · withdraw then restore in separate steps
configure terminal
no ip route 198.51.100.0 255.255.255.0 Null0
endR1 · restore
configure terminal
ip route 198.51.100.0 255.255.255.0 Null0
endTechnical references
OSPFv2 standard · Router configuration guide · Redistribution guidance
Key Takeaways
- Redistribution creates external reachability at an ASBR.
- Prefer native activation for internal connected prefixes.
- Allowlist source prefixes and set metric policy explicitly.
- Verify denied routes as well as permitted routes.
- Tags prevent feedback only when a policy enforces them.