要求:
1.如图搭建网络拓扑,所有路由器各自创建一个环回接口,合理规划IP地址
2.R1-R2-R3-R4-R6之间使用OSPF协议,R4-R5-R6之间使用RIP协议
3.R1环回重发布方式引入OSPF网络
4.R4/R6上进行双点双向重发布
5.分析网络中出现路由环路的原因
6.路由优化
1.如图搭建网络拓扑,所有路由器各自创建一个环回接口,合理规划IP地址
[r1]interface g0/0/0
[r1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
[r1]interface LoopBack 0
[r1-LoopBack0]ip add 1.1.1.1 24
[r2]interface g0/0/1
[r2-GigabitEthernet0/0/1]ip add 12.1.1.2 24
[r2]interface g0/0/0
[r2-GigabitEthernet0/0/0]ip add 23.1.1.1 24
[r2]interface LoopBack 0
[r2-LoopBack0]ip add 2.2.2.2 24
[r3]interface g0/0/1
[r3-GigabitEthernet0/0/1]ip add 23.1.1.2 24
[r3]interface g0/0/0
[r3-GigabitEthernet0/0/0]ip add 34.1.1.1 24
[r3]interface g0/0/2
[r3-GigabitEthernet0/0/2]ip add 36.1.1.1 24
[r3]interface LoopBack 0
[r3-LoopBack0]ip add 3.3.3.3 24
[r4]interface g0/0/1
[r4-GigabitEthernet0/0/1]ip add 34.1.1.2 24
[r4]interface g0/0/0
[r4-GigabitEthernet0/0/0]ip add 45.1.1.1 24
[r4]interface LoopBack 0
[r4-LoopBack0]ip add 4.4.4.4 24
[r6]interface g0/0/0
[r6-GigabitEthernet0/0/0]ip add 36.1.1.2 24
[r6]interface g0/0/1
[r6-GigabitEthernet0/0/1]ip add 56.1.1.1 24
[r6]interface LoopBack 0
[r6-LoopBack0]ip add 6.6.6.6 24
[r5]interface g0/0/1
[r5-GigabitEthernet0/0/1]ip add 45.1.1.2 24
[r5]interface g0/0/0
[r5-GigabitEthernet0/0/0]ip add 56.1.1.2 24[r5]interface LoopBack 0
[r5-LoopBack0]ip add 5.5.5.5 24
2.R1-R2-R3-R4-R6之间使用OSPF协议,R4-R5-R6之间使用RIP协议
[r1]ospf 100 router-id 91.1.1.1
[r1-ospf-100]area 0
[r1-ospf-100-area-0.0.0.0]network 12.1.1.1 0.0.0.0[r2]ospf 100 router-id 92.2.2.2
[r2-ospf-100]area 0
[r2-ospf-100-area-0.0.0.0]network 12.1.1.2 0.0.0.0[r2-ospf-100-area-0.0.0.0]network 23.1.1.1 0.0.0.0
[r2-ospf-100-area-0.0.0.0]network 2.2.2.2 0.0.0.0[r3]ospf 100 router-id 93.3.3.3
[r3-ospf-100]area 0
[r3-ospf-100-area-0.0.0.0]network 23.1.1.2 0.0.0.0[r3-ospf-100-area-0.0.0.0]network 34.1.1.1 0.0.0.0
[r3-ospf-100-area-0.0.0.0]network 36.1.1.1 0.0.0.0
[r3-ospf-100-area-0.0.0.0]network 3.3.3.3 0.0.0.0[r4]ospf 100 router-id 94.4.4.4
[r4-ospf-100]area 0
[r4-ospf-100-area-0.0.0.0]net
[r4-ospf-100-area-0.0.0.0]network 34.1.1.2 0.0.0.0[r4-ospf-100-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[r6]ospf 100 router-id 96.6.6.6
[r6-ospf-100]area 0
[r6-ospf-100-area-0.0.0.0]network 36.1.1.2 0.0.0.0
[r4]rip 100
[r4-rip-100]version 2
[r4-rip-100]network 45.0.0.0[r5]rip 100
[r5-rip-100]version 2
[r5-rip-100]network 45.0.0.0
[r5-rip-100]network 56.0.0.0
[r5-rip-100]network 5.0.0.0[r6]rip 100
[r6-rip-100]version 2
[r6-rip-100]network 56.0.0.0[r6-rip-100]network 6.0.0.0
3.R1环回重发布方式引入OSPF网络
[r1]ospf 100
[r1-ospf-100]import-route direct
4.R4/R6上进行双点双向重发布
[r4]ospf 100
[r4-ospf-100]import-route rip 100[r4]rip 100
[r4-rip-100]import-route ospf 100[r6]ospf 100
[r6-ospf-100]import-route rip 100
[r6]rip 100
[r6-rip-100]import-route ospf 100
5.分析网络中出现路由环路的原因
路由器R1重发布引入OSPF中,此时1.1.1.0/24的优先级为150,在双向双点重发布后,路由器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 hcip
[r6]ip ip-prefix hcip permit 1.1.1.0 24
[r6]route-policy hcip permit node 10
[r6-route-policy]if-match ip-prefix hcip
[r6-route-policy]apply preference 151[r4]rip 100
[r4-rip-100]preference route-policy hcip
[r4-rip-100]ip ip-prefix hcip permit 1.1.1.0 24
[r4]route-policy hcip permit node 10
[r4-route-policy]if-match ip-prefix hcip
[r4-route-policy]apply preference 151
6.路由优化
标签:r4,r6,ip,双向,发布,0.0,100,ospf From: https://blog.csdn.net/2201_75911805/article/details/141131988[r6]ip ip-prefix hica permit 34.1.1.0 24
[r6]ip ip-prefix hica permit 4.4.4.0 24
[r6]route-policy hcia permit node 10
[r6-route-policy] if-match ip-prefix hcia
[r6-route-policy]apply cost 3
[r6]route-policy hica per node 20
[r6-ospf-100]rip 100
[r6-rip-100]import-route ospf 100 route-policy hcia[r4]ip ip-prefix c1 permit 36.1.1.0 24
[r4]int g0/0/0
[r4-GigabitEthernet0/0/0]rip metricout ip-prefix c1 2[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 c2
[r4-route-policy]apply cost-type type-1
[r4]route-policy c permit node 20
[r4]ospf 100
[r4-ospf-100]import-route rip 100 route-policy c[r6]ip ip-prefix c4 permit 45.1.1.0 24
[r6]route-policy c5 permit node 10
[r6-route-policy]if-match ip-prefix c4
[r6-route-policy]apply cost-type type-1
[r6]route-policy c5 permit node 20
[r6]ospf 100
[r6-ospf-100]import-route rip 100 route-policy c5