实验要求
要求:
1.如图搭建网络拓扑,所有路由器各自创建一个环回接 口,合理规划IP地址
2.R1-R2-R3-R4-R6之间使用OSPF协议,R4-R5-R6之间使用 RIP协议
3.R1环回重发布方式引入OSPF网络
4.R4/R6上进行双点双向重发布
5.分析网络中出现路由环路的原因
6.路由优化
实验步骤
为所有设备配置IP地址及环回接口
[R1]int g0/0/0
[R1-Ethernet0/0/0]ip address 12.1.1.1 24
[R1]int l0
[R1-LoopBack0]ip address 1.1.1.1 24
[R2]int g0/0/0
[R2-Ethernet0/0/0]ip address 12.1.1.2 24
[R2]int g0/0/1
[R2-Ethernet0/0/1]ip address 23.1.1.1 24
[R2]int l0
[R2-LoopBack0]ip address 2.2.2.2 24
[R3]int g0/0/0
[R3-Ethernet0/0/0]ip address 23.1.1.2 24
[R3-Ethernet0/0/0]int g0/0/1
[R3-Ethernet0/0/1]ip address 34.1.1.1 24
[R3-Ethernet0/0/1]int g0/0/2
[R3-Ethernet0/0/2]ip address 36.1.1.1 24
[R3]int l0
[R3-LoopBack0]ip address 3.3.3.3 24
[R4]int g0/0/0
[R4-Ethernet0/0/0]ip address 34.1.1.2 24
[R4-Ethernet0/0/0]int g0/0/1
[R4-Ethernet0/0/1]ip address 45.1.1.1 24
[R4]inter l0
[R4-LoopBack0]ip address 4.4.4.4 24
[R5]int g0/0/0
[R5-Ethernet0/0/0]ip address 45.1.1.2 24
[R5-Ethernet0/0/0]int g0/0/01
[R5-Ethernet0/0/1]ip address 56.1.1.2 24
[R5]int l0
[R5-LoopBack0]ip address 5.5.5.5 24
[R6]int g0/0/0
[R6-Ethernet0/0/0]ip address 36.1.1.2 24
[R6-Ethernet0/0/0]int g0/0/1
[R6-Ethernet0/0/1]ip address 56.1.1.1 24
[R6]int l0
[R6-LoopBack0]ip address 6.6.6.6 24
在设备R1-R2-R3-R4-R6上启动OSPF协议,并宣告网段
[R1]ospf 1 router-id 11.11.11.11
[R1-ospf-1]a 0
[R1-ospf-1-area-0.0.0.0]network 12.1.1.0 0.0.0.255
[R2]ospf 1 router-id 22.22.22.22
[R2-ospf-1]a 0
[R2-ospf-1-area-0.0.0.0]network 12.1.1.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[R3]ospf 1 router-id 33.33.33.33
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network 34.1.1.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network 36.1.1.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[R4]ospf 1 router-id 44.44.44.44
[R4-ospf-1]a 0
[R4-ospf-1-area-0.0.0.0]network 34.1.1.0 0.0.0.255
[R4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[R6]ospf 1 router-id 66.66.66.66
[R6-ospf-1]a 0
[R6-ospf-1-area-0.0.0.0]network 36.1.1.0 0.0.0.255
[R6-ospf-1-area-0.0.0.0]network 6.6.6.6 0.0.0.0
在设备R4-R5-R6上启动RIP协议、并宣告网段
[R4]rip
[R4-rip-1]version 2
[R4-rip-1]network 45.0.0.0
[R5]rip
[R5-rip-1]version 2
[R5-rip-1]network 45.0.0.0
[R5-rip-1]network 56.0.0.0
[R5-rip-1]network 5.0.0.0
[R6]rip
[R6-rip-1]version 2
[R6-rip-1]network 56.0.0.0
将R1环回以重发布方式引入OSPF网络
[R1]ospf
[R1-ospf-1]import-route direct
在R4/R6上进行双点双向重发布
[R4]ospf
[R4-ospf-1]import-route rip 1
[R4]rip
[R4-rip-1]import-route ospf 1
[R6]ospf
[R6-ospf-1]import-route rip 1
[R6]rip
[R6-rip-1]import-route ospf 1
解决环路
[r6]ip ip-prefix a permit 1.1.1.0 24
[r6]route-policy w permit node 10
[r6-route-policy]if-match ip-prefix a
[r6-route-policy]apply preference 151
[r6]rip
[r6-rip-1]preference route-policy q
修改环回接口的接口网络类型:
[r1]int lo0
[r1-LoopBack0]ospf network-type broadcast
路由优化
在R5的路由表上,到达R4的环回及34.0.0.0/24网段是负载均衡,但是不是最优路径,应该选择45.0.0.0网段
[r6]ip ip-prefix ww permit 4.4.4.0 24
[r6]ip ip-prefix ww permit 34.0.0.0 24
[r6]int g0/0/1
[r6-Ethernet0/0/1]rip metricout ip-prefix ww 2
[r4]ip ip-prefix ww permit 36.0.0.0 24
[r4]int g0/0/1
[r4-Ethernet0/0/1]rip metricout ip-prefix ww 2
在R3的路由表上,到达R6的环回及45.0.0.0/24、56.0.0.0/24网段是负载均衡,但是不是最优路径
[r4]ip ip-prefix qq permit 56.0.0.0 24
[r4]ip ip-prefix qq permit 6.6.6.0 24
[r4]route-policy y1 permit node 10
[r4-route-policy]if-match ip-prefix qq
[r4-route-policy]apply cost-type type-1
[r4]route-policy y1 permit node 20
[r4]ospf
[r4-ospf-1]import-route rip route-policy y1
[r6]ip ip-prefix yy permit 45.0.0.0 24
[r6]route-policy wy permit node 10
[r6-route-policy]if-match ip-prefix yy
[r6-route-policy]apply cost-type type-1
[r6]route-policy wy permit node 20
[r6]ospf
[r6-ospf-1]import-route rip 1 route-policy wy