Now i will post about ospf route filtering with filter-list and distribute-list. See the topology below and lets configureūüėÄ

i will share to you about all of routers configuration, this is a configuration without filtering. We will compare before and after route filtering happened. Ceck this out..

DATACENTER#sh run

output omitted

interface Loopback0
 ip address 10.16.11.1 255.255.255.255
!
interface Loopback1
 ip address 10.16.12.1 255.255.255.255
!
interface Loopback2
 ip address 10.16.13.1 255.255.255.255
!
interface Ethernet0
 description TO R1
 ip address 10.11.1.1 255.255.255.252
 full-duplex
!
interface FastEthernet0
 description TO R2
 ip address 10.11.2.1 255.255.255.252
 speed auto
!
router ospf 100
 router-id 100.100.100.0
 log-adjacency-changes
 network 10.11.1.0 0.0.0.3 area 0
 network 10.11.2.0 0.0.0.3 area 0
 network 10.16.11.0 0.0.0.255 area 0
 network 10.16.12.0 0.0.0.255 area 0
 network 10.16.13.0 0.0.0.255 area 0
!
end

DATACENTER#

R1#sh run

Output Omitted
!
interface FastEthernet0/0
 description TO DATACENTER
 ip address 10.11.1.2 255.255.255.252
 duplex auto
 speed auto
!
interface FastEthernet1/0
 description TO R2
 ip address 10.10.10.1 255.255.255.252
 duplex auto
 speed auto
!
interface Serial2/0
 no ip address
 encapsulation frame-relay
 serial restart-delay 0
!
interface Serial2/0.1 point-to-point
 description TO R3
 ip address 10.10.13.1 255.255.255.252
 frame-relay interface-dlci 103
!
interface Serial2/0.2 point-to-point
 description TO R4
 ip address 10.10.14.1 255.255.255.252
 frame-relay interface-dlci 104
!
interface Serial2/0.3 point-to-point
 description TO R5
 ip address 10.10.15.1 255.255.255.252
 frame-relay interface-dlci 105
!
router ospf 1
 router-id 1.1.1.1
 log-adjacency-changes
 network 10.10.10.0 0.0.0.3 area 0
 network 10.10.13.0 0.0.0.3 area 34
 network 10.10.14.0 0.0.0.3 area 34
 network 10.10.15.0 0.0.0.3 area 5
 network 10.11.1.0 0.0.0.3 area 0
!
end

R1#

R2#sh run

Output Omitted

interface FastEthernet0/0
 description TO DATACENTER
 ip address 10.11.2.2 255.255.255.252
 duplex auto
 speed auto
!
interface FastEthernet1/0
 description TO R1
 ip address 10.10.10.2 255.255.255.252
 duplex auto
 speed auto
!
interface Serial2/0
 no ip address
 encapsulation frame-relay
 serial restart-delay 0
!
interface Serial2/0.1 point-to-point
 description TO R3
 ip address 10.10.23.1 255.255.255.252
 frame-relay interface-dlci 203
!
interface Serial2/0.2 point-to-point
 description TO R4
 ip address 10.10.24.1 255.255.255.252
 frame-relay interface-dlci 204
!
interface Serial2/0.3 point-to-point
 description TO R5
 ip address 10.10.25.1 255.255.255.252
 frame-relay interface-dlci 205
!
router ospf 2
 router-id 2.2.2.2
 log-adjacency-changes
 network 10.10.10.0 0.0.0.3 area 0
 network 10.10.23.0 0.0.0.3 area 34
 network 10.10.24.0 0.0.0.3 area 34
 network 10.10.25.0 0.0.0.3 area 5
 network 10.11.2.0 0.0.0.3 area 0
!
end

R2#

R3#sh run

Output Omitted
!
interface FastEthernet0
 description LAN
 ip address 10.10.34.1 255.255.255.0
 speed auto
!
interface Serial0
 no ip address
 encapsulation frame-relay
!
interface Serial0.1 point-to-point
 description TO R1
 ip address 10.10.13.2 255.255.255.252
 frame-relay interface-dlci 301
!
interface Serial0.2 point-to-point
 description TO R2
 ip address 10.10.23.2 255.255.255.252
 frame-relay interface-dlci 302
!
router ospf 3
 router-id 3.3.3.3
 log-adjacency-changes
 network 10.10.13.0 0.0.0.3 area 34
 network 10.10.23.0 0.0.0.3 area 34
 network 10.10.34.0 0.0.0.255 area 34
!
end

R3#

R4#sh run

Output Omitted
!
interface FastEthernet0
 description LAN
 ip address 10.10.34.2 255.255.255.0
 speed auto
!
interface Serial0
 no ip address
 encapsulation frame-relay
!
interface Serial0.1 point-to-point
 description TO R1
 ip address 10.10.14.2 255.255.255.252
 frame-relay interface-dlci 401
!
interface Serial0.2 point-to-point
 description TO R2
 ip address 10.10.24.2 255.255.255.252
 frame-relay interface-dlci 402
!
router ospf 4
 router-id 4.4.4.4
 log-adjacency-changes
 network 10.10.14.0 0.0.0.3 area 34
 network 10.10.24.0 0.0.0.3 area 34
 network 10.10.34.0 0.0.0.255 area 34
!
end

R4#

R5#sh run

Output Omitted
!
interface FastEthernet0
 no ip address
 speed auto
!
interface Serial0
 no ip address
 encapsulation frame-relay
!
interface Serial0.1 point-to-point
 description TO R1
 ip address 10.10.15.2 255.255.255.252
 frame-relay interface-dlci 501
!
interface Serial0.2 point-to-point
 description TO R2
 ip address 10.10.25.2 255.255.255.252
 frame-relay interface-dlci 502
!
router ospf 5
 router-id 5.5.5.5
 log-adjacency-changes
 network 10.10.15.0 0.0.0.3 area 5
 network 10.10.25.0 0.0.0.3 area 5
!
end

R5#

With the configuration above, all routers advertise all subnet. For verification you can use show ip route 10.16.0.0 255.255.0.0 longer-prefixes command in area 5 and area 34 routers. And now we will filter a few 10.16.x.x subnet with the configuration below ;

Filter-List :

R1(config)#ip prefix-list in34 seq 5 deny 10.16.11.1/32
R1(config)#ip prefi in34 seq 10 permit 0.0.0.0/0 le 32
R1(config)#router ospf 1
R1(config-router)#area 34 filter-list prefix in34 in

R2(config)#ip prefix-list out0 seq 5 deny 10.16.12.1/32
R2(config)#ip prefix-list out0 seq 10 permit 0.0.0.0/0 le 32
R2(config)#router ospf 2
R2(config-router)#area 0 filter-list prefix out0 out

You will see the different output for show ip route 10.16.0.0 255.255.0.0 longer-prefixes in router area 5 and area 34, compare with the output before filtering.

Now we will do filtering routes with distribute-list command, it isn’t use in ABR or ASBR, so the feature doesn’t change the LSDB flooding, doesn’t change the LSAs added by ABRs and ASBRs, and doesn’t change the SPF algorithm’s choice of best route.

R3(config)#ip prefix-list filter-12 seq 5 deny 10.16.12.1/32
R3(config)#ip prefix-list filter-12 seq 10 permit 0.0.0.0/0 le 32
R3(config)#router ospf 3
R3(config-router)#distribute-list prefix filter-12 in

Done, you can compare and find the diferenceūüôā