OSPF prefix suppression
Transit links exist so routers can talk across a cable, yet by default OSPF advertises every one of their prefixes into every table. Prefix suppression hides them: ip ospf prefix-suppression per interface, or prefix-suppression for the whole process. The paths survive, because SPF builds its tree from routers and links and hangs addresses on afterwards. Loopbacks, secondaries and passive interfaces are exempt.
By Arif, founder of Daveth · Updated
The full 5 min walkthrough is in Daveth Pro (Network). See what the plan opens
What this page answers
What does OSPF prefix suppression do?
It stops OSPF advertising the IP prefixes of transit links while keeping the links themselves in the database, so the transit subnets leave the routing tables and every path is unchanged. Read it in “Why the path survived”
Which prefixes does the OSPF prefix-suppression command not suppress?
Under router ospf, prefix-suppression hides all IP prefixes except those associated with loopbacks, secondary IP addresses and passive interfaces. Read it in “What is exempt, and from which command”
Why do routes still work after OSPF prefix suppression?
The link was never the prefix. SPF builds its tree from routers and the links between them; addresses are attached afterwards, so removing a transit address leaves every computed path in place. Read it in “Why the path survived”
Six prefixes, and four of them are only for the routers
Four routers in a square, a PC at each end. Count the IPv4 prefixes: two LANs, where the PCs live, and four transit links between the routers, 10.1.12.0/24, 10.1.13.0/24, 10.1.24.0/24 and 10.1.34.0/24.
Now ask the blunt question. Does anybody ever send a packet to a transit address? Almost never. Those subnets exist so two routers can talk across a cable. Nothing is hosted there. And by default every one of them is in every router's table:
By default, OSPF advertises all the LSAs that include the transit link LSAs.
There is something faintly absurd about a network in which two-thirds of the routing table is addresses nobody will ever send a packet to, and every router keeps a careful copy.
Recall from 1.4.e.i: OSPF floods the topology (which routers connect to which, at what cost) and every router runs SPF on that same picture. Hold on to that, because it is the whole reason the next section is safe.
Hiding the transit prefixes
This feature enables Open Shortest Path First version 3 (OSPFv3) to hide the IPv4 and IPv6 prefixes of connected networks from link-state advertisements (LSAs).
That sentence is from the OSPFv3 guide. The OSPFv2 command does the same job, and the tech note uses it one interface at a time: both transit interfaces on all four routers:
Configuration: R1's two transit interfaces; R2, R3 and R4 get the same on theirs, in the form the cited pages give.
R1# configure terminal R1(config)# interface Ethernet0/2 R1(config-if)# ip ospf prefix-suppression R1(config-if)# interface Ethernet0/3 R1(config-if)# ip ospf prefix-suppression R1(config-if)# end
Before you read on, if no router advertises the transit subnets any more, what happens to R1's route to PC2's LAN, 10.2.2.0/24?
Reproduced line for line: the tech note's R1 before suppression, from Gateway of last resort to the prompt.
R1# sh ip route Gateway of last resort is not set 10.0.0.0/8 is variably subnetted, 9 subnets, 2 masks C 10.1.1.0/24 is directly connected, Ethernet0/1 L 10.1.1.254/32 is directly connected, Ethernet0/1 C 10.1.12.0/24 is directly connected, Ethernet0/2 L 10.1.12.1/32 is directly connected, Ethernet0/2 C 10.1.13.0/24 is directly connected, Ethernet0/3 L 10.1.13.1/32 is directly connected, Ethernet0/3 O 10.1.24.0/24 [110/20] via 10.1.12.2, 00:02:29, Ethernet0/2 O 10.1.34.0/24 [110/20] via 10.1.13.3, 00:02:12, Ethernet0/3 O 10.2.2.0/24 [110/30] via 10.1.13.3, 00:04:22, Ethernet0/3 [110/30] via 10.1.12.2, 00:04:22, Ethernet0/2
Reproduced line for line, and after.
R1# sh ip route Gateway of last resort is not set 10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks C 10.1.1.0/24 is directly connected, Ethernet0/1 L 10.1.1.254/32 is directly connected, Ethernet0/1 C 10.1.12.0/24 is directly connected, Ethernet0/2 L 10.1.12.1/32 is directly connected, Ethernet0/2 C 10.1.13.0/24 is directly connected, Ethernet0/3 L 10.1.13.1/32 is directly connected, Ethernet0/3 O 10.2.2.0/24 [110/30] via 10.1.13.3, 00:07:38, Ethernet0/3 [110/30] via 10.1.12.2, 00:07:38, Ethernet0/2
Read the last two lines of each. 10.2.2.0/24 [110/30] through 10.1.13.3 and through 10.1.12.2, before and after. The route did not move, its cost did not move, and both paths are still there. What went is the two transit /24s R1 used to learn: nine subnets became seven. The note puts it this way:
Please note that now we see only one OSPF route on Router1 and Router4.
One OSPF prefix, reached by two paths: read the output rather than the summary.
Proves: which prefixes are in R1's table and through which next hops: the transit /24s gone, and 10.2.2.0/24 still at [110/30] through both R2 and R3. Does not prove: that the links are still in the database, which is a different command, nor that anything can reach a transit address: the table only shows what R1 itself can route to.
Why the path survived
The link was never the prefix. SPF builds its tree from routers and the links between them; addresses are hung on that tree afterwards. Suppression takes an address off and leaves the link, so the tree, and every path computed from it, is unchanged.
You can see OSPFv2 do it. So are the links still in the database, or did they leave with their prefixes? The tech note lists the network LSAs, one per transit link, before and after:
Reproduced line for line: R1's network LSAs before, filtered as the tech note filtered them.
R1# show ip ospf database network | i Mask|Attached Router|State ID Link State ID: 10.1.12.2 (address of Designated Router) Network Mask: /24 Attached Router: 10.1.24.2 Attached Router: 10.1.13.1 Link State ID: 10.1.13.3 (address of Designated Router) Network Mask: /24 Attached Router: 10.1.34.3 Attached Router: 10.1.13.1 Link State ID: 10.1.24.4 (address of Designated Router) Network Mask: /24 Attached Router: 10.2.2.254 Attached Router: 10.1.24.2 Link State ID: 10.1.34.4 (address of Designated Router) Network Mask: /24 Attached Router: 10.2.2.254 Attached Router: 10.1.34.3
Reproduced line for line, and after.
R1# show ip ospf database network | i Mask|Attached Router|State ID Link State ID: 10.1.12.1 (address of Designated Router) Network Mask: /32 Attached Router: 10.1.13.1 Attached Router: 10.1.24.2 Link State ID: 10.1.13.1 (address of Designated Router) Network Mask: /32 Attached Router: 10.1.13.1 Attached Router: 10.1.34.3 Link State ID: 10.1.24.2 (address of Designated Router) Network Mask: /32 Attached Router: 10.1.24.2 Attached Router: 10.2.2.254 Link State ID: 10.1.34.4 (address of Designated Router) Network Mask: /32 Attached Router: 10.2.2.254 Attached Router: 10.1.34.3
Count them: four before, four after, with the same pair of routers attached to each. The links are all still in the database. What changed is Network Mask, from /24 to /32: the LSA no longer describes a subnet anyone could route to.
Now compare that with the note's own summary, which is looser than its output:
OSPF prefix-suppression feature helps to overcome this behavior and reduces the number of Type 1(router) and Type 2(network) LSAs advertised.
The output shows the same number of network LSAs with a different mask. Trust the output.
Proves: that every transit link is still described in the database, with the same routers attached, and that what changed is the mask. Does not prove: which routes any router put in its table from those LSAs, and why the designated router differs between the two samples: the tech note does not say, and this page does not guess.
OSPFv3 does it more simply, and the reason is how it was designed. Its topology LSAs never carried addresses:
This means that Router-LSAs and network-LSAs no longer contain network addresses, but simply express topology information. The process of hiding prefixes is simpler in OSPFv3 and suppressed prefixes are simply removed from the intra-area-prefix-LSA.
So in OSPFv3 there is nothing to change in the topology at all: the prefix is simply not in the LSA that carries prefixes. One more reach and one limit:
Prefixes are also filtered from link LSAs. A device only filters locally configured prefixes, not prefixes learnt via link LSAs.
And one boundary that holds for both: suppression is about the routers' own connected prefixes inside an area.
OSPF Type 3, Type 4, Type 5, or Type 7 LSAs are not suppressed.
What is exempt, and from which command
The tech note suppressed eight interfaces one by one. There is a single command that does the whole router:
To prevent Open Shortest Path First (OSPF) from advertising all IP prefixes except prefixes that are associated with loopbacks, secondary IP addresses, and passive interfaces for a specific OSPF process, use the prefix-suppression command in router configuration mode. All IP prefixes are advertised.
Read the reason attached to the exemptions, because it makes the list derivable:
Prefixes that are associated with loopbacks, secondary IP addresses, and passive interfaces are not suppressed by the router mode or the address-family configuration commands because typical network designs require prefixes to remain reachable.
Loopbacks are where router IDs, management and peering live. Passive interfaces face hosts. Secondary addresses are something somebody added on purpose. What is left over is transit links: exactly the target.
Now the incident. A colleague tidies R4, swapping its two per-interface lines for the one router command. Minutes later PC1 cannot reach PC2, and no link is down.
Configuration: what went in, in the form the cited pages give.
R4# configure terminal R4(config)# router ospf 1 R4(config-router)# prefix-suppression R4(config-router)# end
So what does R1's table hold now? Look for 10.2.2.0/24.
Computed from the state: R1's IPv4 routes after the router command on R4, in this course's own layout. No router printed it.
C 10.1.1.0/24 Ethernet0/1 L 10.1.1.254/32 Ethernet0/1 C 10.1.12.0/24 Ethernet0/2 L 10.1.12.1/32 Ethernet0/2 C 10.1.13.0/24 Ethernet0/3 L 10.1.13.1/32 Ethernet0/3
Work it before reading on. R4's LAN interface, Ethernet0/1, runs OSPF and has no neighbour on it, but nobody made it passive. It is not a loopback and has no secondary address. So it is not exempt, and the router command suppressed 10.2.2.0/24 along with everything else. R1, R2 and R3 each lost the route to PC2's LAN; only R4, which is attached to it, still has it.
Continue the lesson
The whole lesson, with its drawings and its questions. The rest of this section and 5 more after it.

