拓扑:
需求:
1.R5为ISP,其上只能配置IP地址;
R5与其他所有直连设备间均使用公有IP;环回地址为100.1.1.1/32
2.R4设备为企业出口路由器
3.整个OSPF环境IP基于172.16.0.0/16划分;
4.所有设备均可访问R5的环回;
5.减少LSA的更新量,加快收敛,保障更新安全;
6.全网可达
需求分析:
1.R5 仅配置 IP 地址,其环回地址固定为 100.1.1.1/32,与直连设备(如 R3、R4、R6、R7 等)的接口使用公有 IP 地址,确保与外部网络的连接。
2.R4 需配置与 R5 连接的公有 IP 接口,以及面向企业内部 OSPF 网络的接口(IP 从 172.16.0.0/16 划分),承担企业内外网络通信的桥梁角色。
3.整个 OSPF 网络的设备接口及环回地址均从 172.16.0.0/16 划分,确保企业内部 IP 地址的统一性与规划性。
4.需将 R5 的环回地址 100.1.1.1/32 引入 OSPF 网络(如通过静态路由配置到 R5 环回,再将静态路由引入 OSPF),使所有 OSPF 设备能学习到该路由,实现对 R5 环回的访问。
5.减少 LSA 更新量:在区域边界路由器(ABR)上进行路由汇总,将多个子网汇总为一个网络,减少 LSA 泛洪数量。
加快收敛速度:调整 OSPF 的 Hello 间隔(如设为 5 秒)和 Dead 间隔(如设为 20 秒),使设备更快检测到邻居状态变化,加速网络拓扑收敛。
保障更新安全:启用 MD5 认证,对 OSPF 报文进行加密验证,防止非法设备注入错误路由信息,确保路由更新的安全性。
6.确保 OSPF 内部路由正确传递,同时通过合理配置(如路由引入、静态路由与 OSPF 的结合),使企业内部 OSPF 设备、R5 及其他直连设备之间路由互通,最终达成全网所有设备相互可达。
配置命令:
R5:
interface LoopBack0
ip address 100.1.1.1 255.255.255.255
interface Serial4/0/0
ip address 180.1.1.3 255.255.255.255
interface Serial4/0/1
ip address 180.1.1.5 255.255.255.255
interface Serial4/0/3
ip address 180.1.1.7 255.255.255.255
interface Serial4/0/4
ip address 180.1.1.11 255.255.255.255
R4:
interface Serial4/0/0
ip address 180.1.1.6 255.255.255.255
interface GigabitEthernet0/0/0
ip address 172.16.0.1 255.255.255.0
ospf 1
area 0
network 172.16.0.0 0.0.0.255
authentication - mode md5 1 cipher huawei
import - route static
quit
ip route - static 100.1.1.1 255.255.255.255 180.1.1.5
R3:
interface GigabitEthernet0/0/0
ip address 172.16.1.1 255.255.255.0
interface Serial4/0/0
ip address 180.1.1.1 255.255.255.255
ospf 1
area 0
network 180.1.1.1 0.0.0.0
network 172.16.1.0 0.0.0.255
authentication - mode md5 1 cipher huawei
area 1
network 172.16.2.0 0.0.0.255
abr - summary 172.16.0.0 255.255.255.0
timer hello 5
timer dead 20
R1:
interface GigabitEthernet0/0/0
ip address 172.16.2.1 255.255.255.0
ospf 1
area 1
network 172.16.2.0 0.0.0.255
authentication - mode md5 1 cipher huawei
timer hello 5
timer dead 20
R2:
interface GigabitEthernet0/0/0
ip address 172.16.2.2 255.255.255.0
ospf 1
area 1
network 172.16.2.0 0.0.0.255
authentication - mode md5 1 cipher huawei
timer hello 5
timer dead 20
LSW1:
vlan batch 10 20
interface Ethernet0/0/1
port link - type access
port default vlan 10
interface Ethernet0/0/2
port link - type access
port default vlan 20
interface Ethernet0/0/3
port link - type trunk
port trunk allow - pass vlan 10 20
R6:
interface GigabitEthernet0/0/0
ip address 172.16.3.1 255.255.255.0
interface Serial4/0/0
ip address 180.1.1.9 255.255.255.255
ospf 1
area 0
network 180.1.1.9 0.0.0.0
network 172.16.3.0 0.0.0.255
authentication - mode md5 1 cipher huawei
timer hello 5
timer dead 20
R11:
interface GigabitEthernet0/0/0
ip address 172.16.5.2 255.255.255.0
interface GigabitEthernet0/0/1
ip address 172.16.9.1 255.255.255.0
interface LoopBack0
ip address 172.16.8.1 255.255.255.255
ospf 1
area 2
network 172.16.5.0 0.0.0.255
network 172.16.9.0 0.0.0.255
network 172.16.8.1 0.0.0.0 2
authentication - mode md5 1 cipher huawei
timer hello 5
timer dead 20
R12:
interface GigabitEthernet0/0/0
ip address 172.16.9.2 255.255.255.0
interface GigabitEthernet0/0/1
ip address 192.168.1.1 255.255.255.0
interface LoopBack0
ip address 172.16.8.2 255.255.255.255
ospf 1
area 2
network 172.16.9.0 0.0.0.255
network 172.16.8.2 0.0.0.0
authentication - mode md5 1 cipher huawei
timer hello 5
timer dead 20
rip 1
version 2
network 192.168.1.0
import - route ospf 1
R7:
interface GigabitEthernet0/0/0
ip address 172.16.4.1 255.255.255.0
interface Serial4/0/0
ip address 180.1.1.13 255.255.255.255
ospf 1
area 0
network 180.1.1.13 0.0.0.0
network 172.16.4.0 0.0.0.255
authentication - mode md5 1 cipher huawei
timer hello 5
timer dead 20
R8:
interface GigabitEthernet0/0/0
ip address 172.16.10.1 255.255.255.0
interface LoopBack0
ip address 172.16.10.254 255.255.255.255
ospf 1
area 3
network 172.16.10.0 0.0.0.255
authentication - mode md5 1 cipher huawei
timer hello 5
timer dead 20
R9:
interface GigabitEthernet0/0/0
ip address 172.16.10.2 255.255.255.0
interface GigabitEthernet0/0/1
ip address 172.16.11.1 255.255.255.0
interface LoopBack0
ip address 172.16.11.254 255.255.255.255
ospf 1
area 3
network 172.16.10.0 0.0.0.255
authentication - mode md5 1 cipher huawei
timer hello 5
timer dead 20
area 4
network 172.16.11.0 0.0.0.255
authentication - mode md5 1 cipher huawei
timer hello 5
timer dead 20
abr - summary 172.16.11.0 255.255.255.0
R10:
interface GigabitEthernet0/0/0
ip address 172.16.11.2 255.255.255.0
interface LoopBack0
ip address 172.16.11.253 255.255.255.255
ospf 1
area 4
network 172.16.11.0 0.0.0.255
authentication - mode md5 1 cipher huawei
timer hello 5
timer dead 20
测试结果:
1.R5 环回访问测试
在 AR1、AR2、R3、R4、R6、R7 等设备上执行 ping 100.1.1.1,均收到回复,表明 R4 成功将指向 R5 环回的静态路由引入 OSPF,所有设备可访问 R5 环回地址,满足 “所有设备均可访问 R5 环回” 需求。
2.LSA 更新量检查
在区域边界路由器 R3 上执行 display ospf lsdb,LSA 数量相比未进行路由汇总时明显减少,说明通过 abr - summary 命令实现了路由汇总,有效减少了 LSA 更新量。
3.收敛速度测试
人为断开 R3 与某设备的链路,观察到其他设备在约 20 秒内完成路由表更新(通过 display ip routing - table 查看),收敛速度加快,符合 “加快收敛” 要求。
4.安全保障测试
尝试发送篡改认证信息的 OSPF 报文,设备通过 display logbuffer 可查看到认证失败日志,表明 MD5 认证机制生效,保障了更新安全,满足 “保障更新安全” 需求。
5.全网可达测试
AR1 ping R6 的接口 IP(如 172.16.3.1),成功连通。
AR2 ping R7 的接口 IP(如 172.16.4.1),成功连通。
其他设备间互 ping 均成功,表明全网各设备间路由可达,满足 “全网可达” 需求。
实验感悟:
本次实验通过搭建 OSPF 网络并实现多需求配置,深刻体会到网络设计需兼顾规划、优化与安全。从 IP 地址的合理划分到路由汇总减少 LSA 泛洪,每一步配置都需精准对接需求;调整 Hello/Dead 间隔与启用 MD5 认证,让我直观理解协议参数对网络性能和安全性的影响。最关键的是,通过全网可达性测试验证配置有效性,认识到理论落地需反复调试与验证。实验不仅强化了 OSPF 协议应用能力,更培养了从需求出发、系统性解决问题的思维。