要求:
1.如图搭建网络拓扑,所有路由器各自创建一个环回接口,合理规划IP地址
2.R1-R2-R3-R4-R6之间使用OSPF协议,R4-R5-R6之间使用RIP协议
3.R1环回重发布方式引入OSPF网络
4.R4/R6上进行双点双向重发布
5.分析网络中出现路由环路的原因
6.路由优化
配置:
1.如图搭建网络拓扑,所有路由器各自创建一个环回接口,合理规划ip地址
R1
<Huawei>sy
[Huawei]sy R1
[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
[R1-GigabitEthernet0/0/0]int l0
[R1-LoopBack0]ip add 1.1.1.1 24
R2
<Huawei>sy
[Huawei]sy R2
[R2]int g 0/0/1
[R2]int g 0/0/1
[R2]int g 0/0/1
[R2-GigabitEthernet0/0/1]ip add 12.1.1.2 24
[R2-GigabitEthernet0/0/1]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip add 23.1.1.1 24
[R2-GigabitEthernet0/0/0]int l0
[R2-LoopBack0]ip add 2.2.2.2 24
R3
[Huawei]sy 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/1
[R3-GigabitEthernet0/0/1]ip add 34.1.1.1 24
[R3-GigabitEthernet0/0/1]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
<Huawei>sy
[Huawei]sy 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
<Huawei>sy
[Huawei]sy 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
<Huawei>sy
[Huawei]sy 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]net 12.1.1.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]net 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]net 12.1.1.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]net 2.2.2.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]net 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]net 3.3.3.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]net 34.1.1.1 0.0.0.0
[R3-ospf-1-area-0.0.0.0]net 36.1.1.1 0.0.0.0
[R3-ospf-1-area-0.0.0.0]net 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]net 34.1.1.2 0.0.0.0
[R4-ospf-1-area-0.0.0.0]net 4.4.4.4 0.0.0.0
[R4-ospf-1-area-0.0.0.0]net 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]net 6.6.6.6 0.0.0.0
[R6-ospf-1-area-0.0.0.0]net 36.1.1.2 0.0.0.0
RIP
[R4]rip 100
[R4-rip-100]v 2
[R4-rip-100]net 45.0.0.0
[R5]rip 100
[R5-rip-100]v 2
[R5-rip-100]net 45.0.0.0
[R5-rip-100]net 5.0.0.0
[R5-rip-100]net 56.0.0.0
[R6]rip 100
[R6-rip-100]v 2
[R6-rip-100]net 56.0.0.0
[R6-rip-100]net 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.路由优化
把R6,R4上重发布来的1.1.1.0路由,让它不加表,不优选。
1.在R4上,把R6上ospf中重发布的rip,学习到的1.1.1.0路由不加表。2.通过修改R6上的rip学习的优先级,将优先级为100的1.1.1.0路由,修改优先级为150以上。
[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
[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
[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