例图
要求:
1.如图搭建网络拓扑,所有路由器各自创建一个环回接 口,合理规划IP地址
2.R1-R2-R3-R4-R6之间使用OSPF协议,R4-R5-R6之间使用 RIP协议
3.R1环回重发布方式引入OSPF网络
4.R4/R6上进行双点双向重发布
5.分析网络中出现路由环路的原因
6.路由优化
实验过程
1、搭建网络拓扑,所有路由器各自创建一个环回接口,合理规划IP地址
R1
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
[r1-GigabitEthernet0/0/0]int g 0/0/1
[r1]int l0
[r1-LoopBack0]ip add 1.1.1.1 24
R2
[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]ip add 12.1.1.2 24
[r2-GigabitEthernet0/0/0]int g 0/0/1
[r2-GigabitEthernet0/0/1]ip add 23.1.1.1 24
[r2-GigabitEthernet0/0/1]int l0
[r2-LoopBack0]ip add 2.2.2.2 24
R3
[r3]int g 0/0/0
[r3-GigabitEthernet0/0/0]ip add 23.1.1.2 24
[r3-GigabitEthernet0/0/0]int g 0/0/0
[r3-GigabitEthernet0/0/0]ip add 34.1.1.1 24
[r3-GigabitEthernet0/0/0]int g 0/0/2
[r3-GigabitEthernet0/0/2]ip add 36.1.1.1 24
[r3-GigabitEthernet0/0/2]int l0
[r3-LoopBack0]ip add 3.3.3.3 24
R4
[r4]int g 0/0/0
[r4-GigabitEthernet0/0/0]ip add 34.1.1.2 24
[r4-GigabitEthernet0/0/0]int g 0/0/1
[r4-GigabitEthernet0/0/1]ip add 45.1.1.1 24
[r4-GigabitEthernet0/0/1]int l0
[r4-LoopBack0]ip add 4.4.4.4 24
R5
[r5]int g 0/0/0
[r5-GigabitEthernet0/0/0]ip add 45.1.1.2 24
[r5-GigabitEthernet0/0/0]int g 0/0/1
[r5-GigabitEthernet0/0/1]ip add 56.1.1.1 24
[r5-GigabitEthernet0/0/1]int l0
[r5-LoopBack0]ip add 5.5.5.5 24
R6
[r6]int g 0/0/0
[r6-GigabitEthernet0/0/0]ip add 56.1.1.2 24
[r6-GigabitEthernet0/0/0]int g 0/0/1
[r6-GigabitEthernet0/0/1]ip add 36.1.1.2 24
[r6-GigabitEthernet0/0/1]int l0
[r6-LoopBack0]ip add 6.6.6.6 24
2.R1-R2-R3-R4-R6之间使用OSPF协议,R4-R5-R6之间使用 RIP协议
OSPF
[R1]ospf 1 router-id 91.1.1.1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 12.1.1.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[R2]ospf 1 router-id 92.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 12.1.1.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]netwprk 2.2.2.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 23.1.1.1 0.0.0.0
[R3]ospf 1 router-id 93.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 34.1.1.1 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 36.1.1.1 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 23.1.1.2 0.0.0.0
[R4]ospf 1 router-id 94.4.4.4
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 34.1.1.2 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 45.1.1.1 0.0.0.0
[R6]ospf 1 router-id 96.6.6.6
[R6-ospf-1]area 0
[R6-ospf-1-area-0.0.0.0]network 6.6.6.6 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 36.1.1.2 0.0.0.0
RIP
[R4]rip 100
[R4-rip-100]ver 2
[R4-rip-100]network 45.0.0.0
[R5]rip 100
[R5-rip-100]ver 2
[R5-rip-100]network 45.0.0.0
[R5-rip-100]network 5.0.0.0
[R5-rip-100]network 56.0.0.0
[R6]rip 100
[R6-rip-100]ver 2
[R6-rip-100]network 56.0.0.0
[R6-rip-100]network 3.0.0.0
3.R1环回重发布方式引入OSPF网络
[R1]route-policy ccie permit node 10
[R1-route-policy]if-match int l0
[R1-route-policy]ospf 1
[R1-ospf-1]import-route direct route-policy ccie
4.R4/R6上进行双点双向重发布
[R4]rip 100
[R4-rip-100]import-route ospf 1
[R4-rip-100]ospf 1
[R4-ospf-1]import-route rip 100
[R6]rip 100
[R6-rip-100]import-route ospf 1
[R6-rip-100]ospf 1
[R6-ospf-1]import-route rip 100
5.分析网络中出现路由环路的原因
在路由器R1上进行重发布,将R1的环回接口重发布到OSPF网络中,此时1.1.1.0/24的优先级为150,之后在R4、R6上配置双向双点重发布,路由器R4、R6分别将1.1.1.0/24的路由信息发送到RIP网络中,此时在RIP网络中1.1.1.0/24的优先级为100,当R5将1.1.1.0/24的路由信息发送到R6时,由于R5发送的路由信息优先级较小,路由器优先选择优先级较小的加入路由表,会将路由器R6的路由表刷新,从而导致路由环路的产生
[R6]rip 100
[R6-rip-100]preference route-policy r6
[R6-rip-100]q
[R6]ip ip-prefix r6 permit 1.1.1.0 24
[R6]route-policy r6 permit node 10
[R6-route-policy]if-match ip-prefix r6
[R6-route-policy]apply preference 151
[R4]route-policy r6 permit node 10
[R4-route-policy]if-match ip-prefix r6
[R4-route-policy]apply preference 151
6.路由优化
[R4]acl 2000
[R4-acl-basic-2000]rule permit source 36.1.1.0 0
[R4-acl-basic-2000]q
[R4]int g 0/0/1
[R4-GigabitEthernet0/0/1]rip metricin 2000 3
[R4]ip ip-prefix c1 permit 45.1.1.0 24
[R4]ip ip-prefix c2 permit 56.1.1.0 24
[R4]ip ip-prefix c2 permit 6.6.6.0 24
[R4]route-policy c permit node 10
[R4-route-policy]if-match ip-prefix c1
[R4-route-policy]apply cost-type type-1
[R4]route-policy c permit node 20
[R4-route-policy]if-match ip-prefix c2
[R4-route-policy]apply cost 3
[R4-route-policy]q
[R4]route-policy c permit node 30
[R4-route-policy]q
[R4]ospf 1
[R4-ospf-1]import-route rip route-policy c
[R6]ip ip-prefix hcip permit 4.4.4.0 24
[R6]ip ip-prefix hcip permit 34.1.1.0 24
[R6]route-policy hcip permit node 10
[R6-route-policy]if-match ip-prefix hcip
[R6-route-policy]apply cost 3
[R6-route-policy]q
[R6]route-policy hcip per node 20
[R6-route-policy]q
[R6]rip 100
[R6-rip-100]import-route ospf 1 route-policy hcip