一、实验要求以及拓扑图
要求:
1.如图搭建网络拓扑,所有路由器各自创建一个环回接口,合理规划IP地址
2.R1-R2-R3-R4-R6之间使用OSPF协议,R4-R5-R6之间使用RIP协议
3.R1环回重发布方式引入OSPF网络4.R4/R6上进行双点双向重发布
5.分析网络中出现路由环路的原因
6.路由优化

二、各路由IP、OSPF以及RIP配置
R1:
#
interface GigabitEthernet0/0/0
ip address 12.0.0.1 255.255.255.0
#
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.0
ospf network-type broadcast
#
ospf 1 router-id 1.1.1.1
import-route direct route-policy lo0
area 0.0.0.0
network 12.0.0.0 0.0.0.255
#
R2:
#
interface GigabitEthernet0/0/0
ip address 12.0.0.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 23.0.0.1 255.255.255.0
#
interface LoopBack0
ip address 2.2.2.2 255.255.255.0
ospf network-type broadcast
#
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 12.0.0.0 0.0.0.255
network 23.0.0.0 0.0.0.255
#
R3:
#
interface GigabitEthernet0/0/0
ip address 34.0.0.1 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 23.0.0.2 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 36.0.0.1 255.255.255.0
#
interface LoopBack0
ip address 3.3.3.3 255.255.255.0
ospf network-type broadcast
#
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 23.0.0.0 0.0.0.255
network 34.0.0.0 0.0.0.255
network 36.0.0.0 0.0.0.255
#
R4:
#
interface GigabitEthernet0/0/0
ip address 34.0.0.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 54.0.0.1 255.255.255.0
#
interface LoopBack0
ip address 4.4.4.4 255.255.255.0
ospf network-type broadcast
#
ospf 1 router-id 4.4.4.4
area 0.0.0.0
network 34.0.0.0 0.0.0.255
network 4.4.4.4 0.0.0.0
#
rip 1
version 2
network 54.0.0.0
#
R5:
#
interface GigabitEthernet0/0/0
ip address 56.0.0.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 54.0.0.2 255.255.255.0
#
interface LoopBack0
ip address 5.5.5.5 255.255.255.0
#
rip 1
version 2
network 54.0.0.0
network 56.0.0.0
network 5.0.0.0
#
R6:
#
interface GigabitEthernet0/0/0
ip address 56.0.0.1 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 36.0.0.2 255.255.255.0
#
interface LoopBack0
ip address 6.6.6.6 255.255.255.0
#
ospf 1 router-id 6.6.6.6
area 0.0.0.0
network 36.0.0.0 0.0.0.255
#
rip 1
version 2
network 56.0.0.0
network 6.0.0.0
#
三、在R1上将环回口引入OSPF
1、首先使用ip-prefix以及route-policy抓取loopback 0
#
ip ip-prefix 0 index 10 permit 1.1.1.0 24
#
route-policy lo0 permit node 10
if-match ip-prefix 0
#
route-policy lo0 permit node 20 //允许其他流量通过
#
2、在OSPF上引入直连并使用策略路由
#
ospf 1 router-id 1.1.1.1
import-route direct route-policy lo0
#
3、查看LSDB

四、R4/6做双向重发布
R4:
#
ospf 1 router-id 4.4.4.4
import-route rip 1
#
rip 1
import-route ospf 1
#
R6:
#
ospf 1 router-id 6.6.6.6
import-route rip 1
#
rip 1
import-route ospf 1
#
查看R3的路由表 发现1.1.1.1的路由下一跳不正常

追踪1.1.1.1路由发现环路出现

五、解决环路问题
修改R4/6的1.1.1.1路由优先级
R4:(R6配置一样)
#
ip ip-prefix 0 index 10 permit 1.1.1.0 24
#
route-policy lo0 permit node 10
if-match ip-prefix o
apply preference 151
#
route-policy lo0 permit node 20
#
rip 1
preference route-policy lo0
#
查看路由表发现环路消失

六、解决路由次优路径问题
1、查看R5的路由表会发现一些网段负载分担了

在R6上将4.4.4.0网段的开销值增大
#
ip ip-prefix 1 index 10 permit 4.4.4.0 24
#
#
interface GigabitEthernet0/0/0
rip metricout ip-prefix 1 3
#
查看路由表,选路最优

将34和36的网段开销值增大
#
ip ip-prefix 1 index 10 permit 34.0.0.0 24 //抓取34网段流量
ip ip-prefix 2 index 10 permit 36.0.0.0 24 //抓取36网段流量
#
#
interface GigabitEthernet0/0/1
rip metricin ip-prefix 2 3
#
interface GigabitEthernet0/0/0
rip metricin ip-prefix 1 3
#
查看路由表,选路最优

2、查看R3的路由表也会发现负载分担的现象

R4上 修改ospf的类型
#
ip ip-prefix 3 index 10 permit 54.0.0.0 24
#
route-policy 1 permit node 10
if-match ip-prefix 3
apply cost-type type-1
#
route-policy 1 permit node 20
#
ospf 1 router-id 4.4.4.4
import-route rip 1 route-policy 1
#
查看路由表,选路最优

本次实验构建了一个包含OSPF和RIP协议的网络拓扑,通过R1的环回接口重发布引入OSPF网络,并在R4和R6上进行双向重发布。实验中出现了路由环路和次优路径问题,通过调整路由优先级和开销值成功解决了这些问题,确保了网络的正常运行。

2353

被折叠的 条评论
为什么被折叠?



