OSPF Route Intra-Area Route Filtering

OSPF routers in a given area should have identical databases for their given area that they are a member of. While not a best practice, it is still possible to filter routes from making it into the RIB/FIB by using a distribute list.

One possible scenario for requiring this type of configuration would be when you are using OSPF totally stubby areas in a hub and spoke topologies where all spoke routers are in the same area and you only want a default route and not other routes beside connected and static in your RIB.

Given the following topology:

OSPF-Topology

Routers 2,3 and 4 all have their gi 0/1 interfaces as part of the ospf area 234. All are configured as stub areas. The despite the spoke routers being totally stubby and having no direct physical or logical connections to the other spoke routers, they must still maintain the same LSDB as the other routers in the area. But we can influence the routing table by using a distribute list (in direction). A distribute list was applied to R2 to limit the learned OSPF routes to only the default route.

HUB R1


R1#sh run | sec net0/[1-3]$
interface GigabitEthernet0/1
 no ip address
 shutdown
 duplex auto
 speed auto
 media-type rj45
interface GigabitEthernet0/2
 ip address 12.1.1.1 255.255.255.0
 ip ospf network point-to-point
 ip ospf 1 area 234
 duplex auto
 speed auto
 media-type rj45
interface GigabitEthernet0/3
 ip address 13.1.1.1 255.255.255.0
 ip ospf network point-to-point
 ip ospf 1 area 234
 duplex auto
 speed auto
 media-type rj45

 !!!!

 router ospf 1
 area 234 stub no-summary

Example Spoke with NO filtering R4

router ospf 1
 area 234 stub no-summary

 interface GigabitEthernet0/1
 ip address 14.1.1.4 255.255.255.0
 ip ospf network point-to-point
 ip ospf 1 area 234
 duplex auto
 speed auto
 media-type rj45

 R4#sh ip route ospf | i net0/1
O*IA  0.0.0.0/0 [110/2] via 14.1.1.1, 05:56:58, GigabitEthernet0/1
O     2.0.0.0/8 [110/3] via 14.1.1.1, 05:55:54, GigabitEthernet0/1
O     3.0.0.0/8 [110/3] via 14.1.1.1, 05:56:42, GigabitEthernet0/1
O        12.1.1.0 [110/2] via 14.1.1.1, 05:56:58, GigabitEthernet0/1
O        13.1.1.0 [110/2] via 14.1.1.1, 05:56:58, GigabitEthernet0/1

R4#sh ip ospf database

            OSPF Router with ID (4.4.4.4) (Process ID 1)

		Router Link States (Area 234)

Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         1679        0x8000000F 0x007114 6
3.3.3.3         3.3.3.3         1514        0x8000000E 0x0018AE 3
4.4.4.4         4.4.4.4         1541        0x8000000D 0x002596 3
200.2.2.2       200.2.2.2       1797        0x8000000D 0x00F94C 3

		Summary Net Link States (Area 234)

Link ID         ADV Router      Age         Seq#       Checksum
0.0.0.0         1.1.1.1         1933        0x8000000B 0x007FB0

R2 Router with distribute list filtering applied

router ospf 1
 area 234 stub no-summary
 distribute-list route-map default-only in

interface GigabitEthernet0/1
 ip address 12.1.1.2 255.255.255.0
 ip ospf network point-to-point
 ip ospf 1 area 234
 duplex auto
 speed auto
 media-type rj45

 R2#sh ip route | i net0/1
O*IA  0.0.0.0/0 [110/2] via 12.1.1.1, 05:57:02, GigabitEthernet0/1
C        12.1.1.0/24 is directly connected, GigabitEthernet0/1
L        12.1.1.2/32 is directly connected, GigabitEthernet0/1

R2#sh ip ospf database

            OSPF Router with ID (200.2.2.2) (Process ID 1)

		Router Link States (Area 2)

Link ID         ADV Router      Age         Seq#       Checksum Link count
200.2.2.2       200.2.2.2       263         0x8000000E 0x00F3A6 0

		Router Link States (Area 234)

Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         1903        0x8000000F 0x007114 6
3.3.3.3         3.3.3.3         1737        0x8000000E 0x0018AE 3
4.4.4.4         4.4.4.4         1766        0x8000000D 0x002596 3
200.2.2.2       200.2.2.2       2019        0x8000000D 0x00F94C 3

		Summary Net Link States (Area 234)

Link ID         ADV Router      Age         Seq#       Checksum
0.0.0.0         1.1.1.1         147         0x8000000C 0x007DB1