Monday, 26 October 2015

RIPv2 filtering with Administrative distance

RIPv2 filtering with AD


In this example we are filtering from R2 the subnet 2.2.5.0/24



R1(config)#access-list 5 permit 2.2.5.0 ?
  A.B.C.D  Wildcard bits
  log      Log matches against this entry
  <cr>

R1(config)#access-list 5 permit 2.2.5.0 0.0.0.255 ?
  log  Log matches against this entry
  <cr>

R1(config)#access-list 5 permit 2.2.5.0 0.0.0.255 log
R1(config)#router rip
R1(config-router)#dist
R1(config-router)#distance 255 0.0.0.0 255.255.255.255 ?
  <1-99>       IP Standard access list number
  <1300-1999>  IP Standard expanded access list number
  WORD         Standard access-list name
  <cr>

R1(config-router)#distance 255 0.0.0.0 255.255.255.255 5
R1(config-router)#do clear ip route *
R1(config-router)#
*Mar  2 00:57:26.809: %SEC-6-IPACCESSLOGNP: list 5 permitted 0 2.2.5.0 -> 0.0.0.0, 1 packet
R1(config-router)#do sh ip route 2.0.0.0
Routing entry for 2.0.0.0/24, 3 known subnets
  Redistributing via rip

R       2.2.4.0 [120/1] via 12.1.1.2, 00:00:14, Serial0/0
R       2.2.6.0 [120/3] via 14.1.1.2, 00:00:18, Serial0/1
R       2.2.7.0 [120/1] via 12.1.1.2, 00:00:14, Serial0/0
R1(config-router)#

 Another example

we have two paths to arrive to a destination  in subnet 4.4.12.and 4.4.15 starting from R2 we wnat to make one path primary ,and filter the second one


       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     34.0.0.0/24 is subnetted, 1 subnets
R       34.1.1.0 [120/1] via 23.1.1.2, 00:00:29, Serial0/1
     1.0.0.0/24 is subnetted, 4 subnets
R       1.1.0.0 [120/1] via 12.1.1.1, 00:00:08, Serial0/0
R       1.1.1.0 [120/1] via 12.1.1.1, 00:00:08, Serial0/0
R       1.1.2.0 [120/1] via 12.1.1.1, 00:00:08, Serial0/0
R       1.1.3.0 [120/1] via 12.1.1.1, 00:00:08, Serial0/0
     2.0.0.0/24 is subnetted, 4 subnets
C       2.2.4.0 is directly connected, Loopback0
C       2.2.5.0 is directly connected, Loopback1
C       2.2.6.0 is directly connected, Loopback2
C       2.2.7.0 is directly connected, Loopback3
     3.0.0.0/24 is subnetted, 4 subnets
R       3.3.8.0 [120/1] via 23.1.1.2, 00:00:02, Serial0/1
R       3.3.9.0 [120/1] via 23.1.1.2, 00:00:02, Serial0/1
R       3.3.10.0 [120/1] via 23.1.1.2, 00:00:02, Serial0/1
R       3.3.11.0 [120/1] via 23.1.1.2, 00:00:02, Serial0/1
     4.0.0.0/24 is subnetted, 4 subnets
R       4.4.12.0 [120/2] via 23.1.1.2, 00:00:02, Serial0/1
                 [120/2] via 12.1.1.1, 00:00:11, Serial0/0
R       4.4.13.0 [120/2] via 12.1.1.1, 00:00:11, Serial0/0
R       4.4.14.0 [120/2] via 23.1.1.2, 00:00:02, Serial0/1
                 [120/2] via 12.1.1.1, 00:00:11, Serial0/0
R       4.4.15.0 [120/2] via 23.1.1.2, 00:00:02, Serial0/1
                 [120/2] via 12.1.1.1, 00:00:11, Serial0/0

     23.0.0.0/24 is subnetted, 1 subnets
C       23.1.1.0 is directly connected, Serial0/1
     172.16.0.0/32 is subnetted, 2 subnets
C       172.16.0.20 is directly connected, Loopback20
C       172.16.0.10 is directly connected, Loopback10
     12.0.0.0/24 is subnetted, 1 subnets
C       12.1.1.0 is directly connected, Serial0/0
     14.0.0.0/24 is subnetted, 1 subnets
R       14.1.1.0 [120/1] via 12.1.1.1, 00:00:13, Serial0/0
R2#config t
Enter configuration commands, one per line.  End with CNTL/Z.
R2(config)#acc
R2(config)#access-list 12 permit 4.4.12.0
R2(config)#access-
R2(config)#access-list 13 permit 4.4.15.0
R2(config)#router rip
R2(config-router)#distance 255 23.1.1.2 0.0.0.0 ?
  <1-99>       IP Standard access list number
  <1300-1999>  IP Standard expanded access list number
  WORD         Standard access-list name
  <cr>

R2(config-router)#distance 255 23.1.1.2 0.0.0.0 12
R2(config-router)#distance 255 12.1.1.1 0.0.0.0 13
R2(config-router)#do clear ip route *
R2(config-router)#do sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     34.0.0.0/24 is subnetted, 1 subnets
R       34.1.1.0 [120/1] via 23.1.1.2, 00:00:09, Serial0/1
     1.0.0.0/24 is subnetted, 4 subnets
R       1.1.0.0 [120/1] via 12.1.1.1, 00:00:09, Serial0/0
R       1.1.1.0 [120/1] via 12.1.1.1, 00:00:09, Serial0/0
R       1.1.2.0 [120/1] via 12.1.1.1, 00:00:09, Serial0/0
R       1.1.3.0 [120/1] via 12.1.1.1, 00:00:09, Serial0/0
     2.0.0.0/24 is subnetted, 4 subnets
C       2.2.4.0 is directly connected, Loopback0
C       2.2.5.0 is directly connected, Loopback1
C       2.2.6.0 is directly connected, Loopback2
C       2.2.7.0 is directly connected, Loopback3
     3.0.0.0/24 is subnetted, 4 subnets
R       3.3.8.0 [120/1] via 23.1.1.2, 00:00:12, Serial0/1
R       3.3.9.0 [120/1] via 23.1.1.2, 00:00:12, Serial0/1
R       3.3.10.0 [120/1] via 23.1.1.2, 00:00:12, Serial0/1
R       3.3.11.0 [120/1] via 23.1.1.2, 00:00:12, Serial0/1
     4.0.0.0/24 is subnetted, 4 subnets
R       4.4.12.0 [120/2] via 12.1.1.1, 00:00:12, Serial0/0
R       4.4.13.0 [120/2] via 12.1.1.1, 00:00:12, Serial0/0
R       4.4.14.0 [120/2] via 23.1.1.2, 00:00:12, Serial0/1
                 [120/2] via 12.1.1.1, 00:00:12, Serial0/0
R       4.4.15.0 [120/2] via 23.1.1.2, 00:00:12, Serial0/1

     23.0.0.0/24 is subnetted, 1 subnets
C       23.1.1.0 is directly connected, Serial0/1
     172.16.0.0/32 is subnetted, 2 subnets
C       172.16.0.20 is directly connected, Loopback20
C       172.16.0.10 is directly connected, Loopback10
     12.0.0.0/24 is subnetted, 1 subnets
C       12.1.1.0 is directly connected, Serial0/0
     14.0.0.0/24 is subnetted, 1 subnets
R       14.1.1.0 [120/1] via 12.1.1.1, 00:00:13, Serial0/0
R2(config-router)#