如上图,在R2和R4上配置双点双向重发布,在配置双点双向重发布时,小AD重发布进大AD时是没问题的,但是大AD重发布进小AD时,就会出现问题,例如次优路径,环路等,如上图,如果是R2先学习到RIP网络的路由,那么在R4的路由表中,RIP网络的路由将是**OSPF学习到的,这样就产生了次优路径(不是**优的路由)!可以配置分发列表来避免次优路径!下面先不配置分发列表,查看各路由器的路由表,接下来好做实验:
配置参数:
R2:
router ospf 1
redistribute rip metric 12 subnets
network 2.2.2.0 0.0.0.255 area 0
router rip
version 2
redistribute ospf 1 metric 3
network 1.0.0.0
no auto-summary
R4:
router ospf 1
redistribute rip metric 12 subnets
network 4.4.4.0 0.0.0.255 area 0
router rip
version 2
redistribute ospf 1 metric 3
network 3.0.0.0
no auto-summary
查看路由表:
R1:
r1#sh ip rou
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Serial0/0
2.0.0.0/24 is subnetted, 1 subnets
R 2.2.2.0 [120/3] via 3.3.3.2, 00:00:11, Serial0/1
[120/3] via 1.1.1.2, 00:00:19, Serial0/0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Serial0/1
4.0.0.0/24 is subnetted, 1 subnets
R 4.4.4.0 [120/3] via 3.3.3.2, 00:00:11, Serial0/1
[120/3] via 1.1.1.2, 00:00:19, Serial0/0
10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks
R 10.10.10.10/32 [120/3] via 3.3.3.2, 00:00:11, Serial0/1
[120/3] via 1.1.1.2, 00:00:19, Serial0/0
R 10.11.11.11/32 [120/3] via 3.3.3.2, 00:00:13, Serial0/1
[120/3] via 1.1.1.2, 00:00:20, Serial0/0
R 10.8.8.8/32 [120/3] via 3.3.3.2, 00:00:13, Serial0/1
[120/3] via 1.1.1.2, 00:00:20, Serial0/0
R 10.9.9.9/32 [120/3] via 3.3.3.2, 00:00:13, Serial0/1
[120/3] via 1.1.1.2, 00:00:20, Serial0/0
C 10.2.0.0/16 is directly connected, Loopback1
C 10.3.0.0/16 is directly connected, Loopback2
C 10.1.0.0/16 is directly connected, Loopback0
r1#
可以看到R1学习到的OSPF的路由是**两台边界路由器R2和R4学习来的,而且实现了负载均衡。这里R2和R4是将OSPF重发布进RIP,是小AD重发布进大AD,不会出现问题。
R2:
r2#sh ip rou
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Serial0/0
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Serial0/1
3.0.0.0/24 is subnetted, 1 subnets
O E2 3.3.3.0 [110/12] via 2.2.2.1, 00:03:58, Serial0/1
4.0.0.0/24 is subnetted, 1 subnets
O 4.4.4.0 [110/128] via 2.2.2.1, 00:03:58, Serial0/1
10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks
O 10.10.10.10/32 [110/65] via 2.2.2.1, 00:03:58, Serial0/1
O 10.11.11.11/32 [110/65] via 2.2.2.1, 00:03:58, Serial0/1
O 10.8.8.8/32 [110/65] via 2.2.2.1, 00:03:58, Serial0/1
O 10.9.9.9/32 [110/65] via 2.2.2.1, 00:03:58, Serial0/1
R 10.2.0.0/16 [120/1] via 1.1.1.1, 00:00:23, Serial0/0
R 10.3.0.0/16 [120/1] via 1.1.1.1, 00:00:23, Serial0/0
R 10.1.0.0/16 [120/1] via 1.1.1.1, 00:00:23, Serial0/0
r2#
可以看到R2**RIP学习到了RIP网络的路由!
R3:
r3#sh ip rou
1.0.0.0/24 is subnetted, 1 subnets
O E2 1.1.1.0 [110/12] via 2.2.2.2, 00:42:39, Serial0/0
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Serial0/0
3.0.0.0/24 is subnetted, 1 subnets
O E2 3.3.3.0 [110/12] via 4.4.4.2, 00:04:43, Serial0/1
4.0.0.0/24 is subnetted, 1 subnets
C 4.4.4.0 is directly connected, Serial0/1
10.0.0.0/16 is subnetted, 7 subnets
C 10.10.0.0 is directly connected, Loopback3
C 10.11.0.0 is directly connected, Loopback4
C 10.8.0.0 is directly connected, Loopback1
C 10.9.0.0 is directly connected, Loopback2
O E2 10.2.0.0 [110/12] via 2.2.2.2, 00:05:06, Serial0/0
O E2 10.3.0.0 [110/12] via 2.2.2.2, 00:05:06, Serial0/0
O E2 10.1.0.0 [110/12] via 2.2.2.2, 00:05:06, Serial0/0
r3#
可以看到R3是**R2来学习RIP网络的路由的!!!
R4:
r4#sh ip rou
1.0.0.0/24 is subnetted, 1 subnets
O E2 1.1.1.0 [110/12] via 4.4.4.1, 00:05:50, Serial0/0
2.0.0.0/24 is subnetted, 1 subnets
O 2.2.2.0 [110/128] via 4.4.4.1, 00:05:50, Serial0/0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Serial0/1
4.0.0.0/24 is subnetted, 1 subnets
C 4.4.4.0 is directly connected, Serial0/0
10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks
O 10.10.10.10/32 [110/65] via 4.4.4.1, 00:05:50, Serial0/0
O 10.11.11.11/32 [110/65] via 4.4.4.1, 00:05:50, Serial0/0
O 10.8.8.8/32 [110/65] via 4.4.4.1, 00:05:50, Serial0/0
O 10.9.9.9/32 [110/65] via 4.4.4.1, 00:05:50, Serial0/0
O E2 10.2.0.0/16 [110/12] via 4.4.4.1, 00:05:51, Serial0/0
O E2 10.3.0.0/16 [110/12] via 4.4.4.1, 00:05:51, Serial0/0
O E2 10.1.0.0/16 [110/12] via 4.4.4.1, 00:05:51, Serial0/0
r4#
如上面,R4是**OSPF学习到的RIP网络的路由,因为OSPF的AD值比RIP小,所以OSPF的路由信息被装进路由表,而这并不**优的路由,这就是大AD值在重发布进小AD值时遇到的次优路径。下面配置分发列表来解决这个问题:
配置参数:
R2:
r2(config)#acc 1 de 10.1.0.0 //配置不匹配RIP网络的路由
r2(config)#acc 1 de 10.2.0.0
r2(config)#acc 1 de 10.3.0.0
r2(config)#acc 1 per an //配置匹配其它的路由
r2(config)#router os 1 //进入OSPF路由配置进程
r2(config-router)#distribute-list 1 in s0/1 //配置分发列表,只有访问列表1匹配的路由才可以从接口s0/1进入
R4:
r4(config)#acc 1 de 10.1.0.0
r4(config)#acc 1 de 10.2.0.0
r4(config)#acc 1 de 10.3.0.0
r4(config)#acc 1 per an
r4(config)#router os 1
r4(config-router)#distri 1 in s0/0
r4(config-router)#
查看配置效果:
R2:
r2#sh ip rou
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Serial0/0
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Serial0/1
3.0.0.0/24 is subnetted, 1 subnets
O E2 3.3.3.0 [110/12] via 2.2.2.1, 00:05:08, Serial0/1
4.0.0.0/24 is subnetted, 1 subnets
O 4.4.4.0 [110/128] via 2.2.2.1, 00:05:08, Serial0/1
10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks
O 10.10.10.10/32 [110/65] via 2.2.2.1, 00:05:08, Serial0/1
O 10.11.11.11/32 [110/65] via 2.2.2.1, 00:05:08, Serial0/1
O 10.8.8.8/32 [110/65] via 2.2.2.1, 00:05:08, Serial0/1
O 10.9.9.9/32 [110/65] via 2.2.2.1, 00:05:08, Serial0/1
R 10.2.0.0/16 [120/1] via 1.1.1.1, 00:00:42, Serial0/0
R 10.3.0.0/16 [120/1] via 1.1.1.1, 00:00:42, Serial0/0
R 10.1.0.0/16 [120/1] via 1.1.1.1, 00:00:42, Serial0/0
r2#
可以看出R2**RIP学习到了RIP网络的路由
R3:
r3#sh ip rou
1.0.0.0/24 is subnetted, 1 subnets
O E2 1.1.1.0 [110/12] via 2.2.2.2, 00:03:36, Serial0/0
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Serial0/0
3.0.0.0/24 is subnetted, 1 subnets
O E2 3.3.3.0 [110/12] via 4.4.4.2, 00:15:00, Serial0/1
4.0.0.0/24 is subnetted, 1 subnets
C 4.4.4.0 is directly connected, Serial0/1
10.0.0.0/16 is subnetted, 7 subnets
C 10.10.0.0 is directly connected, Loopback3
C 10.11.0.0 is directly connected, Loopback4
C 10.8.0.0 is directly connected, Loopback1
C 10.9.0.0 is directly connected, Loopback2
O E2 10.2.0.0 [110/12] via 4.4.4.2, 00:03:49, Serial0/1
[110/12] via 2.2.2.2, 00:03:49, Serial0/0
O E2 10.3.0.0 [110/12] via 4.4.4.2, 00:03:49, Serial0/1
[110/12] via 2.2.2.2, 00:03:49, Serial0/0
O E2 10.1.0.0 [110/12] via 4.4.4.2, 00:03:49, Serial0/1
[110/12] via 2.2.2.2, 00:03:49, Serial0/0
r3#
可以看到R3的路由表中,RIP网络的路由是**R2和R4学习到的而且实现了负载均衡,和R1学习到OSPF网络的路由一样,可以看到有2条路由去往对端的网络!!!
R4:
r4#sh ip rou
1.0.0.0/24 is subnetted, 1 subnets
O E2 1.1.1.0 [110/12] via 4.4.4.1, 00:06:17, Serial0/0
2.0.0.0/24 is subnetted, 1 subnets
O 2.2.2.0 [110/128] via 4.4.4.1, 00:06:17, Serial0/0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Serial0/1
4.0.0.0/24 is subnetted, 1 subnets
C 4.4.4.0 is directly connected, Serial0/0
10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks
O 10.10.10.10/32 [110/65] via 4.4.4.1, 00:06:17, Serial0/0
O 10.11.11.11/32 [110/65] via 4.4.4.1, 00:06:17, Serial0/0
O 10.8.8.8/32 [110/65] via 4.4.4.1, 00:06:17, Serial0/0
O 10.9.9.9/32 [110/65] via 4.4.4.1, 00:06:17, Serial0/0
R 10.2.0.0/16 [120/1] via 3.3.3.1, 00:00:21, Serial0/1
R 10.3.0.0/16 [120/1] via 3.3.3.1, 00:00:21, Serial0/1
R 10.1.0.0/16 [120/1] via 3.3.3.1, 00:00:21, Serial0/1
r4#
可以看到R4是**RIP学习到的RIP网络的路由,而不是**OSPF,这样避免了次优路径!