路由策略3_Distribute-list5

拓扑图:
没配置分发列表前:
R2:
router ospf 1
redistribute connected metric 10 subnets
 redistribute rip metric 30 subnets
 network 192.168.23.0 0.0.0.255 area 0
!
router rip
 version 2
 redistribute connected metric 2
 redistribute ospf 1 metric 4
 network 192.168.12.0
 no auto-summary
查看各路由器的路由表:
r1#sh ip rou
C    192.168.12.0/24 is directly connected, Serial0/0
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
     2.0.0.0/24 is subnetted, 1 subnets
R       2.2.2.0 [120/2] via 192.168.12.2, 00:00:17, Serial0/0
     10.0.0.0/24 is subnetted, 1 subnets
C       10.10.10.0 is directly connected, Loopback1
R    192.168.23.0/24 [120/2] via 192.168.12.2, 00:00:17, Serial0/0
r1#
r2#sh ip rou
C    192.168.12.0/24 is directly connected, Serial0/0
     1.0.0.0/24 is subnetted, 1 subnets
R       1.1.1.0 [120/1] via 192.168.12.1, 00:00:11, Serial0/0
     2.0.0.0/24 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, Loopback0
     10.0.0.0/24 is subnetted, 1 subnets
R       10.10.10.0 [120/1] via 192.168.12.1, 00:00:11, Serial0/0
C    192.168.23.0/24 is directly connected, Serial0/1
r2#
r3#sh ip rou
O E2 192.168.12.0/24 [110/10] via 192.168.23.1, 00:00:22, Serial0/0
     1.0.0.0/24 is subnetted, 1 subnets
O E2    1.1.1.0 [110/30] via 192.168.23.1, 00:00:22, Serial0/0
     2.0.0.0/24 is subnetted, 1 subnets
O E2    2.2.2.0 [110/10] via 192.168.23.1, 00:00:22, Serial0/0
     10.0.0.0/24 is subnetted, 1 subnets
O E2    10.10.10.0 [110/30] via 192.168.23.1, 00:00:09, Serial0/0
C    192.168.23.0/24 is directly connected, Serial0/0r3#
可以看到各路由器都学习到了全网的路由!
下面配置分发列表:
R2
access-list 1 permit 1.1.1.0 0.0.0.255
router ospf 1
distribute-list 1 out rip // 配置分发列表,关联ACL 序号1 ,应用在出接口,协议为RIP ;这里的RIP 是指重发布的来源为RIP 协议(过渡从RIP 网络重发布过来的,其它路由协议的路由不受影响,如下,R2 的直连路由2.2.2.2/24 没有被过渡掉)
S 注意: distribute-list 1 后面如何要加协议的话只能在 OUT 方向, IN 方向无此功能!!!
查看 R3 的路由表:
r3#sh ip rou
O E2 192.168.12.0/24 [110/10] via 192.168.23.1, 00:01:03, Serial0/0
     1.0.0.0/24 is subnetted, 1 subnets
O E2    1.1.1.0 [110/30] via 192.168.23.1, 00:01:03, Serial0/0
     2.0.0.0/24 is subnetted, 1 subnets
O E2    2.2.2.0 [110/10] via 192.168.23.1, 00:01:03, Serial0/0
C    192.168.23.0/24 is directly connected, Serial0/0
r3#
可以看出 R3 只学习到了 RIP 网络的 1.1.1.1/24 ,那为什么 2.2.2.0/24 还在呢?因为它是 R2 的直连路由而不是 RIP 网络的路由!!!

你可能感兴趣的:(路由器,GNS3,ccnp,ospf,路由策略,distribute-list)