ENSP 重发布实验

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

一、实验要求以及拓扑图

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

6e8bc348880c4558a24985c2ace77ae2.png

 二、各路由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

25d073c121614135a427d73ff5c996b3.png

 四、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的路由下一跳不正常

e7c2ad1ffeab4089b621e9885d44cfe2.png

 追踪1.1.1.1路由发现环路出现

6a0103df876f4e54a5ebe16383a513ff.png

 

五、解决环路问题

修改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
#

查看路由表发现环路消失

2fb2d842f82045d881aaed3410d6964a.png

 

六、解决路由次优路径问题

1、查看R5的路由表会发现一些网段负载分担了

e9003355564a4d6587118b78ba9cf0c7.png

93a7734cb55e442db4ef77ce7b5f58c2.png在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
#

查看路由表,选路最优

dff1122ffa0544ed84acab24aa7cc1ad.png

 

将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
#

查看路由表,选路最优

954f2f345fe145dc9d864386c5bb723b.png

 

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

83c8fa3c8fbc43b4894d3889cb246708.png

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
#

查看路由表,选路最优

a279873fd11b40899336bfeed5d0cb8e.png

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值