一、实验拓扑图
二、实验需求
1.如图搭建网络拓扑,所有路由器各自创建一个环回接口,合理规划IP地址
2.R1-R2-R3-R4-R6之间使用OSPF协议,R4-R5-R6之间使用RIP协议
3.R1环回重发布方式引入OSPF网络
4.R4/R6上进行双点双向重发布
5.分析网络中出现路由环路的原因
6.路由优化
三、实验步骤
1.配置接口IP地址及各个环回
AR1
[Huawei]sysname AR1 [AR1-GigabitEthernet0/0/0]ip add 12.1.1.1 24 [AR1-LoopBack0]ip add 1.1.1.1 32
AR2
[Huawei]sysname AR2 [AR2-GigabitEthernet0/0/1]ip add 12.1.1.1 24 [AR2-GigabitEthernet0/0/0]ip add 23.1.1.1 24 [AR2-LoopBack0]ip add 2.2.2.2 32
AR3
[Huawei]sysname AR3 [AR3-GigabitEthernet0/0/1]ip add 23.1.1.2 24 [AR3-GigabitEthernet0/0/0]ip add 34.1.1.1 24 [AR3-LoopBack0]ip add 3.3.3.3 32 [AR3-GigabitEthernet0/0/2]ip add 36.1.1.2 24
AR4
[Huawei]sysname AR4 [AR4-GigabitEthernet0/0/0]ip add 45.1.1.1 24 [AR4-GigabitEthernet0/0/1]ip add 34.1.1.2 24 [AR4-LoopBack0]ip add 4.4.4.4 32
AR5
[Huawei]sysname AR5 [AR5-GigabitEthernet0/0/0]ip add 56.1.1.1 24 [AR5-GigabitEthernet0/0/1]ip add 45.1.1.2 24 [AR5-LoopBack0]ip add 5.5.5.5 32
AR6
[Huawei]sysname AR6 [AR6-GigabitEthernet0/0/1]ip add 56.1.1.2 24 [AR6-GigabitEthernet0/0/0]ip add 36.1.1.1 24 [AR6-LoopBack0]ip add 6.6.6.6 32
2.R1-R2-R3-R4-R6之间启用OSPF协议,R4-R5-R6之间使用RIP协议
R1-R2-R3-R4-R6
[AR1]ospf 100 router-id 91.1.1.1 [AR1-ospf-100]area 0 [AR1-ospf-100-area-0.0.0.0]network 12.1.1.1 0.0.0.0 [AR2]ospf 100 router-id 92.2.2.2 [AR2-ospf-100]area 0 [AR2-ospf-100-area-0.0.0.0]network 2.2.2.2 0.0.0.0 [AR2-ospf-100-area-0.0.0.0]network 12.1.1.2 0.0.0.0 [AR2-ospf-100-area-0.0.0.0]network 23.1.1.1 0.0.0.0 [AR3]ospf 100 router-id 93.3.3.3 [AR3-ospf-100]area 0 [AR3-ospf-100-area-0.0.0.0]network 23.1.1.2 0.0.0.0 [AR3-ospf-100-area-0.0.0.0]network 34.1.1.1 0.0.0.0 [AR3-ospf-100-area-0.0.0.0]network 36.1.1.2 0.0.0.0 [AR3-ospf-100-area-0.0.0.0]network 3.3.3.3 0.0.0.0 [AR4]ospf 100 router-id 94.4.4.4 [AR4-ospf-100]area 0 [AR4-ospf-100-area-0.0.0.0]network 34.1.1.2 0.0.0.0 [AR4-ospf-100-area-0.0.0.0]network 4.4.4.4 0.0.0.0 [AR6]ospf 100 router-id 96.6.6.6 [AR6-ospf-100]area 0 [AR6-ospf-100-area-0.0.0.0]network 36.1.1.1 0.0.0.0 [AR6-ospf-100-area-0.0.0.0]network 6.6.6.6 0.0.0.0
R4-R5-R6
[AR4]rip 100 [AR4-rip-100]version 2 [AR4-rip-100]network 45.0.0.0 [AR5]rip 100 [AR5-rip-100]version 2 [AR5-rip-100]network 5.0.0.0 [AR5-rip-100]network 45.0.0.0 [AR5-rip-100]network 56.0.0.0 [AR6]rip 100 [AR6-rip-100]version 2 [AR6-rip-100]network 56.0.0.0
3.R1环回重发布方式引入OSPF网络
[AR1]ospf 100
[AR1-ospf-100]import-route direct
4.R4/R6上进行双点双向重发布
[AR6]ospf 100
[AR6-ospf-100]import-route rip 100
[AR6]rip 100
[AR6-rip-100]import-route ospf 100
[AR4]rip 100
[AR4-rip-100]import-route ospf 100
[AR4]ospf 100
[AR4-ospf-100]import-route rip 100
5.分析网络中出现路由环路的原因
产生环路的原因是因为 RIP和OSPF的优先级不同,RIP的优先级为100,OSPF的优先级为10和150,通过重分布进来产生的五类LSA的优先级为150,通过R4和R5的重发布后优先级会变为RIP的优先级,R5学习到后会把1.1.1.1 32这条路由发给R6,R6又会发给R3,但是此时R3中有关于1.1.1.1 32这条路由,就会导致环路,我们需要做的就是在重发布时修改1.1.1.1 32这条路由的优先级,使得R3不会学习重发布里面的路由
[AR4]ip ip-prefix B4 permit 1.1.1.1 32
[AR4]route-policy wy permit node 12
[AR4-route-policy]if-match ip-prefix B4
[AR4-route-policy]apply preference 160
[AR6]ip ip-prefix A4 permit 1.1.1.0 24
[AR6]route-policy wjk permit node 12
[AR6-route-policy]if-match ip-prefix A4
[AR6-route-policy]apply preference 160
6.路由优化
修改种子度量值
[AR4]ip ip-prefix B1 permit 36.1.1.0 24
[AR4]ip ip-prefix B2 permit 6.6.6.6 32
[AR4]ip ip-prefix B3 permit 56.1.1.0 24
[AR4]route-policy wy permit node 10
Info: New Sequence of this List.
[AR4-route-policy]if-match ip-prefix B1
[AR4-route-policy]apply cost 99
[AR4-route-policy]q
[AR4]route-policy wy permit node 20
[AR4-route-policy]if-match ip-prefix B2
[AR4-route-policy]apply cost 99
[AR4-route-policy]q
[AR4]route-policy wy permit node 30
Info: New Sequence of this List.
[AR4-route-policy]if-match ip-prefix B3
[AR4-route-policy]apply cost 99
[AR4-route-policy]q
[AR4]route-policy wy permit node 40
Info: New Sequence of this List.
[AR4-route-policy]q
[AR4]rip 100
[AR4-rip-100]import-route ospf 100 route-policy wy
[AR6]ip ip-prefix A1 permit 45.1.1.0 24
[AR6]ip ip-prefix A2 permit 4.4.4.4 32
[AR6]ip ip-prefix A3 permit 34.1.1.0 24
[AR6]route-policy wjk permit node 10
Info: New Sequence of this List.
[AR6-route-policy]if-match ip-prefix A1
[AR6-route-policy]apply cost 99
[AR6-route-policy]q
[AR6]route-policy wjk permit node 20
Info: New Sequence of this List.
[AR6-route-policy]if-match ip-prefix A2
[AR6-route-policy]apply cost 99
[AR6-route-policy]q
[AR6]route-policy wjk permit node 30
Info: New Sequence of this List.
[AR6-route-policy]if-match ip-prefix A3
[AR6-route-policy]apply cost 99
[AR6-route-policy]q
[AR6]route-policy wjk permit node 40
Info: New Sequence of this List.
7.全网通