实验技术理解:
1、多点重分发中,一边的路由协议注入到另一边的路由协议时,只发生在多点中的其中一点,而其余点即便配置有重分发命令也不会再发生注入。理解这一点很重要,所以下面的配置在“其余点”上不配置重分发命令(其实配置上去也没关系,只是不起作用),以便更清楚的分析路由环路产生的源点位置。
2、多点双向重分发中的“双向”情况:第一种情况,双向发生在同一个路由器上,会产生次优路由,但不会发生路由环路,所以这里不分析;第二种情况,双向发生在不同路由器上,必然存在路由环路的危机,下面就分析这种环路产生的必然条件及环路的起点位置。
实验目录:
1)逐步配置重分发,将其推上路由环路。
2)防止路由方法。
实验拓扑:
实验步骤:
1)各路由器简要配置如下
R1(config)#do sh run
interface FastEthernet0/0
ip address 1.1.1.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 2.2.2.1 255.255.255.0
duplex auto
speed auto
!
router ospf 1
log-adjacency-changes
network 0.0.0.0 255.255.255.255 area 0
R1(config)#
R2(config)#do sh run
interface FastEthernet0/0
ip address 1.1.1.2 255.255.255.0
duplex auto
speed auto
!
interface Serial1/0
ip address 5.5.5.1 255.255.255.0
serial restart-delay 0
!
interface Serial1/2
ip address 4.4.4.2 255.255.255.0
serial restart-delay 0
!
router eigrp 100
network 4.4.4.0 0.0.0.255
network 5.5.5.0 0.0.0.255
auto-summary
!
router ospf 1
log-adjacency-changes
network 1.1.1.0 0.0.0.255 area 0
R2(config)#
R3(config)#do sh run
interface FastEthernet0/1
ip address 2.2.2.2 255.255.255.0
duplex auto
speed auto
!
interface Serial1/0
ip address 5.5.5.2 255.255.255.0
serial restart-delay 0
!
interface Serial1/1
no ip address
shutdown
serial restart-delay 0
!
interface Serial1/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial1/3
ip address 3.3.3.2 255.255.255.0
serial restart-delay 0
!
router eigrp 100
network 3.3.3.0 0.0.0.255
network 5.5.5.0 0.0.0.255
auto-summary
!
router ospf 1
log-adjacency-changes
network 2.2.2.0 0.0.0.255 area 0
R3(config)#
R4(config-router)#do sh run
interface Loopback0
ip address 114.114.114.114 255.255.255.255
!
interface Serial1/2
ip address 4.4.4.1 255.255.255.0
serial restart-delay 0
!
interface Serial1/3
ip address 3.3.3.1 255.255.255.0
serial restart-delay 0
!
router eigrp 100
redistribute connected metric 10000 100 255 1 1500
network 3.3.3.0 0.0.0.255
network 4.4.4.0 0.0.0.255
no auto-summary
R4(config-router)#
1.1)各路由表
R1(config)#do sh ip rou
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, FastEthernet0/0
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, FastEthernet0/1
R1(config)#
R2(config-router)#do sh ip rou
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, FastEthernet0/0
2.0.0.0/24 is subnetted, 1 subnets
O 2.2.2.0 [110/20] via 1.1.1.1, 01:32:05, FastEthernet0/0
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 3.3.3.0/24 [90/2681856] via 4.4.4.1, 00:44:00, Serial1/2
D 3.0.0.0/8 [90/2681856] via 5.5.5.2, 00:44:00, Serial1/0
4.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 4.4.4.0/24 is directly connected, Serial1/2
D 4.0.0.0/8 is a summary, 00:44:01, Null0
114.0.0.0/32 is subnetted, 1 subnets
D EX 114.114.114.114 [170/2195456] via 4.4.4.1, 00:01:07, Serial1/2
5.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 5.5.5.0/24 is directly connected, Serial1/0
D 5.0.0.0/8 is a summary, 01:24:53, Null0
R2(config-router)#
R3(config)#do sh ip rou
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
O 1.1.1.0 [110/20] via 2.2.2.1, 01:24:30, FastEthernet0/1
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, FastEthernet0/1
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 3.3.3.0/24 is directly connected, Serial1/3
D 3.0.0.0/8 is a summary, 00:44:41, Null0
4.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 4.4.4.0/24 [90/2681856] via 3.3.3.1, 00:44:41, Serial1/3
D 4.0.0.0/8 [90/2681856] via 5.5.5.1, 00:44:43, Serial1/0
114.0.0.0/32 is subnetted, 1 subnets
D EX 114.114.114.114 [170/2195456] via 3.3.3.1, 00:01:49, Serial1/3
5.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 5.5.5.0/24 is directly connected, Serial1/0
D 5.0.0.0/8 is a summary, 01:25:03, Null0
R3(config)#
R4(config-router)#do sh ip rou
Gateway of last resort is not set
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 3.3.3.0/24 is directly connected, Serial1/3
D 3.0.0.0/8 [90/3193856] via 4.4.4.2, 00:45:12, Serial1/2
4.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 4.4.4.0/24 is directly connected, Serial1/2
D 4.0.0.0/8 [90/3193856] via 3.3.3.2, 00:45:12, Serial1/3
114.0.0.0/32 is subnetted, 1 subnets
C 114.114.114.114 is directly connected, Loopback0
D 5.0.0.0/8 [90/2681856] via 4.4.4.2, 01:25:33, Serial1/2
[90/2681856] via 3.3.3.2, 01:25:34, Serial1/3
R4(config-router)#
1.3)在R2上重分发EIGPR到ospf中
R2(config-router)#red eigrp 100 metric 100 subnets
对比之前的R2、R3,发现R2路由表不变,R3变为如下
R3(config)#do sh ip rou
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
O 1.1.1.0 [110/20] via 2.2.2.1, 01:29:37, FastEthernet0/1
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, FastEthernet0/1
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 3.3.3.0/24 is directly connected, Serial1/3
D 3.0.0.0/8 is a summary, 00:49:49, Null0
4.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 4.4.4.0/24 [90/2681856] via 3.3.3.1, 00:49:49, Serial1/3
D 4.0.0.0/8 [90/2681856] via 5.5.5.1, 00:49:50, Serial1/0
114.0.0.0/32 is subnetted, 1 subnets
O E2 114.114.114.114 [110/100] via 2.2.2.1, 00:03:06, FastEthernet0/1 \\获悉路由的协议从eigrp变为ospf。
5.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 5.5.5.0/24 is directly connected, Serial1/0
D 5.0.0.0/8 is a summary, 01:30:12, Null0
R3(config)#
1.4)紧接上一步,将R3上的OSPF重分发到EIGRP中,从而形成了双向分发即多点双向重分发的拓扑。根据重分发规则,重分发只能是存在于路由表中的路由。所以R3会将路由表中的ospf路由(包括O E2 114.114.114.114 )都会重分发到EIGRP中,到此,终于知道路由环路的源点位置就发生这个重分发上面了。
R3(config-router)#red ospf 1 metric 10000 50 255 1 1500 \\注意这里注入到eigrp所定义的度量值必须要小于(114.114.114.114这条路由)原先注入eigrp时度量值,这是形成环路的必需条件。这时eigrp会进行路径比较,最终选择度量值较小的路径成为最佳路由。
于是查看R2、R3及路由表,R3路由表与1.3步中一样,而R2变为如下
R2(config-router)#do sh ip rou
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, FastEthernet0/0
2.0.0.0/24 is subnetted, 1 subnets
O 2.2.2.0 [110/20] via 1.1.1.1, 04:37:34, FastEthernet0/0
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 3.3.3.0/24 [90/2681856] via 4.4.4.1, 03:49:29, Serial1/2
D 3.0.0.0/8 [90/2681856] via 5.5.5.2, 03:49:29, Serial1/0
4.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 4.4.4.0/24 is directly connected, Serial1/2
D 4.0.0.0/8 is a summary, 03:49:30, Null0
114.0.0.0/32 is subnetted, 1 subnets
D EX 114.114.114.114 [170/2182656] via 5.5.5.2, 00:08:59, Serial1/0 \\可以看到目标路径选择R3做为下一跳,到此路由环路产生。
5.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 5.5.5.0/24 is directly connected, Serial1/0
D 5.0.0.0/8 is a summary, 04:30:21, Null0
R2(config-router)#
R2#sh ip eigrp topology 114.114.114.114/32
IP-EIGRP (AS 100): Topology entry for 114.114.114.114/32
State is Passive, Query origin flag is 1, 1 Successor(s), FD is 2182656
Routing Descriptor Blocks:
5.5.5.2 (Serial1/0), from 5.5.5.2, Send flag is 0x0
Composite metric is (2182656/268800), Route is External \\度量值较小,放入路由表中
Vector metric:
Minimum bandwidth is 1544 Kbit
Total delay is 20500 microseconds
Reliability is 255/255
Load is 1/255
Minimum MTU is 1500
Hop count is 1
External data:
Originating router is 5.5.5.2
AS number of route is 1
External protocol is OSPF, external metric is 100
Administrator tag is 0 (0x00000000)
4.4.4.1 (Serial1/2), from 4.4.4.1, Send flag is 0x0
Composite metric is (2195456/281600), Route is External \\度量值较大
Vector metric:
Minimum bandwidth is 1544 Kbit
Total delay is 21000 microseconds
Reliability is 255/255
Load is 1/255
Minimum MTU is 1500
Hop count is 1
External data:
Originating router is 114.114.114.114
AS number of route is 0
External protocol is Connected, external metric is 0
Administrator tag is 0 (0x00000000)
R2#
查看路由环路
R2#traceroute 114.114.114.114
Type escape sequence to abort.
Tracing the route to 114.114.114.114
1 5.5.5.2 56 msec 40 msec 24 msec
2 2.2.2.1 36 msec 36 msec 40 msec
3 1.1.1.2 56 msec 56 msec 56 msec
4 5.5.5.2 48 msec 52 msec 52 msec
5 2.2.2.1 52 msec 84 msec 52 msec
6 1.1.1.2 92 msec 96 msec 112 msec
7 5.5.5.2 92 msec 80 msec 84 msec
8 2.2.2.1 84 msec 112 msec 92 msec
9 1.1.1.2 124 msec 116 msec 136 msec
10 5.5.5.2 120 msec 140 msec 116 msec
.......
R1(config)#do trace 114.114.114.114
Type escape sequence to abort.
Tracing the route to 114.114.114.114
1 1.1.1.2 76 msec 44 msec 4 msec
2 5.5.5.2 52 msec 52 msec 60 msec
3 2.2.2.1 48 msec 68 msec 56 msec
4 1.1.1.2 72 msec 80 msec 52 msec
5 5.5.5.2 72 msec 60 msec 64 msec
6 2.2.2.1 56 msec 100 msec 52 msec
7 1.1.1.2 92 msec 112 msec 80 msec
8 5.5.5.2 108 msec 128 msec 112 msec
9 2.2.2.1 96 msec 84 msec 104 msec
10 1.1.1.2 124 msec 132 msec 116 msec
11 5.5.5.2 116 msec 152 msec 124 msec
12 2.2.2.1 124 msec 132 msec 120 msec
13 1.1.1.2 156 msec
.....
2)防止路由环路最常用且最有效的方法是标签法
R2(config)#
router ospf 1
log-adjacency-changes
redistribute eigrp 100 metric 100 subnets route-map into_ospf
network 1.1.1.0 0.0.0.255 area 0
!
route-map into_ospf deny 10
match tag 30
!
route-map into_ospf permit 20
set tag 20
R2(config)#
R3(config-router)#
router eigrp 100
redistribute ospf 1 metric 10000 50 255 1 1500 route-map into_eigrp
network 3.3.3.0 0.0.0.255
network 5.5.5.0 0.0.0.255
auto-summary
!
router ospf 1
log-adjacency-changes
network 2.2.2.0 0.0.0.255 area 0
!
route-map into_eigrp deny 10
match tag 20
!
route-map into_eigrp permit 20
set tag 30
!
R3(config-router)#
最后查看路由
R2(config)#do sh ip rou
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, FastEthernet0/0
2.0.0.0/24 is subnetted, 1 subnets
O 2.2.2.0 [110/20] via 1.1.1.1, 05:28:39, FastEthernet0/0
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 3.3.3.0/24 [90/2681856] via 4.4.4.1, 04:40:34, Serial1/2
D 3.0.0.0/8 [90/2681856] via 5.5.5.2, 04:40:34, Serial1/0
4.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 4.4.4.0/24 is directly connected, Serial1/2
D 4.0.0.0/8 is a summary, 04:40:35, Null0
114.0.0.0/32 is subnetted, 1 subnets
D EX 114.114.114.114 [170/2195456] via 4.4.4.1, 00:10:50, Serial1/2
5.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 5.5.5.0/24 is directly connected, Serial1/0
D 5.0.0.0/8 is a summary, 05:21:26, Null0
R2(config)#
R3(config-router)#do sh ip rou
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
O 1.1.1.0 [110/20] via 2.2.2.1, 05:20:14, FastEthernet0/1
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, FastEthernet0/1
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 3.3.3.0/24 is directly connected, Serial1/3
D 3.0.0.0/8 is a summary, 04:40:26, Null0
4.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 4.4.4.0/24 [90/2681856] via 3.3.3.1, 04:40:26, Serial1/3
D 4.0.0.0/8 [90/2681856] via 5.5.5.1, 04:40:27, Serial1/0
114.0.0.0/32 is subnetted, 1 subnets
O E2 114.114.114.114 [110/100] via 2.2.2.1, 00:12:36, FastEthernet0/1
5.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 5.5.5.0/24 is directly connected, Serial1/0
D 5.0.0.0/8 is a summary, 05:20:48, Null0
R3(config-router)#
测试链路
R2(config)#do trace 114.114.114.114
Type escape sequence to abort.
Tracing the route to 114.114.114.114
1 4.4.4.1 44 msec 44 msec 52 msec
R2(config)#
R3(config)#do trace 114.114.114.114
Type escape sequence to abort.
Tracing the route to 114.114.114.114
1 2.2.2.1 100 msec 40 msec 56 msec
2 1.1.1.2 36 msec 92 msec 80 msec
3 4.4.4.1 80 msec 96 msec 72 msec
R3(config)#
呵呵,路由环路终于解决,可是还存在一个问题----次优路由,这个可以在R3上直接修改本地管理距离,这里不多说了。
本文为了更清楚路由环路产生的原因,而将其他不起作用的重分发删除,但在现实中如果出现多点双向重分发时,应该在每个点都要配置双向重分发(即便不产生作用),这样会使网络更加的稳定。