Wednesday, 30 October 2013

Filtering routers from a neighbor using prefix-lists



Filtering routers from a neighbor using prefix-lists
The this post I’m going to filter routes allow only those from R1 specifically with prefix length between 17 – 19 long into the routing table of R3
The routing table on R3 looks like this at the moment:
17.0.0.0/19 is subnetted, 2 subnets
R       17.0.0.0 [120/1] via 10.1.1.1, 00:00:07, FastEthernet0/0
R       17.2.0.0 [120/1] via 10.1.1.2, 00:00:02, FastEthernet0/0
1.0.0.0/32 is subnetted, 1 subnets
R       1.1.1.1 [120/1] via 10.1.1.1, 00:00:07, FastEthernet0/0
3.0.0.0/32 is subnetted, 1 subnets
C       3.3.3.3 is directly connected, Loopback0
10.0.0.0/24 is subnetted, 1 subnets
C       10.1.1.0 is directly connected, FastEthernet0/0
12.0.0.0/18 is subnetted, 2 subnets
R       12.0.0.0 [120/1] via 10.1.1.1, 00:00:07, FastEthernet0/0
R       12.2.0.0 [120/1] via 10.1.1.2, 00:00:02, FastEthernet0/0
13.0.0.0/17 is subnetted, 2 subnets
R       13.0.0.0 [120/1] via 10.1.1.1, 00:00:08, FastEthernet0/0
R       13.2.0.0 [120/1] via 10.1.1.2, 00:00:03, FastEthernet0/0
14.0.0.0/9 is subnetted, 2 subnets
R       14.0.0.0 [120/1] via 10.1.1.1, 00:00:08, FastEthernet0/0
R       14.128.0.0 [120/1] via 10.1.1.2, 00:00:03, FastEthernet0/0

Configuration steps
1) Configure a prefix-list to filter routes

R3(config)#ip prefix-list R1-Filter permit 0.0.0.0/0 ge 17 le 19
2) Configure a prefix-list that identifies the routing source
R3(config)#ip prefix-list R1 seq 5 permit 10.1.1.1/32    
3) Apply the distribute-list prefix
R3(config)#router rip
R3(config-router)#distribute-list prefix R1-Filter gateway R1 in f0/0
The result is just those routes in the perfix-list are allowed and only from R1 (10.1.1.1)
R3(config-router)#do sh ip ro rip
17.0.0.0/19 is subnetted, 1 subnets
R       17.0.0.0 [120/1] via 10.1.1.1, 00:00:07, FastEthernet0/0
12.0.0.0/18 is subnetted, 1 subnets
R       12.0.0.0 [120/1] via 10.1.1.1, 00:00:07, FastEthernet0/0
13.0.0.0/17 is subnetted, 1 subnets
R       13.0.0.0 [120/1] via 10.1.1.1, 00:00:07, FastEthernet0/0

0 comments:

Post a Comment