如上图,在
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
,这样避免了次优路径!