ospf综合实验

分析:

  1. OSPF 规划:OSPF 域网段 172.16.0.0/16,划分 Area0/1/2/3/4;
  2. AR4 为 ISP 公网设备,仅配公网 IP,不跑 OSPF;AR4 配置环回口,全网可访问;
  3. MGRE 环境:AR3 为中心站点,分支 AR5/AR6/AR7;MGRE 隧道跑 OSPF;
  4. AR12 运行 RIP,需重分发到 OSPF,OSPF 外部路由引入 RIP;
  5. OSPF 优化:减少 LSA、加速收敛、安全认证;
  6. 全网互通。

一:area1

AR1 配置

复制代码
sysname AR1
undo info-center enable
interface LoopBack0
 ip address 1.1.1.1 255.255.255.255
# 连接LSW1
interface GigabitEthernet 0/0/0
 ip address 172.16.1.1 255.255.255.0
# OSPF配置
ospf 1 router-id 1.1.1.1
 area 1
  network 172.16.1.0 0.0.0.255

AR2配置

复制代码
sysname AR2
undo info-center enable
interface LoopBack0
 ip address 1.1.1.2 255.255.255.255
interface GigabitEthernet 0/0/0
 ip address 172.16.1.2 255.255.255.0
ospf 1 router-id 1.1.1.2
 area 1
  network 172.16.1.0 0.0.0.255

AR3配置(Area1 ABR、MGRE 中心、Area0/Area1 边界)

复制代码
sysname AR4
undo info-center enable
# ISP公网环回,全网访问
interface LoopBack0
 ip address 209.1.1.1 255.255.255.255
# 四条Serial分别连AR3、AR5、AR6、AR7
interface Serial 4/0/0
 ip address 203.0.1.2 255.255.255.252
interface Serial 4/0/1
 ip address 203.0.1.5 255.255.255.252
interface Serial 3/0/0
 ip address 203.0.1.9 255.255.255.252
interface GigabitEthernet 0/0/0
 ip address 203.0.1.14 255.255.255.252
# 回程静态路由:所有OSPF私网网段下一跳对应各分支
ip route-static 172.16.0.0 255.255.0.0 203.0.1.1
ip route-static 172.16.0.0 255.255.0.0 203.0.1.6
ip route-static 172.16.0.0 255.255.0.0 203.0.1.10
ip route-static 172.16.0.0 255.255.0.0 203.0.1.13
# 负载分担,保证回程可达

二. ISP AR4(仅公网 IP,无 OSPF,全网可达其环回)、

复制代码
sysname AR4
undo info-center enable
# ISP公网环回,全网访问
interface LoopBack0
 ip address 209.1.1.1 255.255.255.255
# 四条Serial分别连AR3、AR5、AR6、AR7
interface Serial 4/0/0
 ip address 203.0.1.2 255.255.255.252
interface Serial 4/0/1
 ip address 203.0.1.5 255.255.255.252
interface Serial 3/0/0
 ip address 203.0.1.9 255.255.255.252
interface GigabitEthernet 0/0/0
 ip address 203.0.1.14 255.255.255.252
# 回程静态路由:所有OSPF私网网段下一跳对应各分支
ip route-static 172.16.0.0 255.255.0.0 203.0.1.1
ip route-static 172.16.0.0 255.255.0.0 203.0.1.6
ip route-static 172.16.0.0 255.255.0.0 203.0.1.10
ip route-static 172.16.0.0 255.255.0.0 203.0.1.13
# 负载分担,保证回程可达

三. MGRE 分支

AR5配置

复制代码
sysname AR5
undo info-center enable
interface LoopBack0
 ip address 1.1.1.5 255.255.255.255
# 公网Serial连AR4
interface Serial 4/0/0
 ip address 203.0.1.6 255.255.255.252
# MGRE隧道口
interface Tunnel0/0/0 mode gre multipoint
 ip address 172.16.0.2 255.255.255.0
 source Serial 4/0/0
 # 注册中心站点
 nhrp entry 172.16.0.1 203.0.1.1 register
 nhrp broadcast
# OSPF
ospf 1 router-id 1.1.1.5
 area 0
  network 172.16.0.0 0.0.0.255
# 默认路由访问公网
ip route-static 0.0.0.0 0 Serial 4/0/0

AR6(MGRE 分支 + Area2 ABR)

复制代码
sysname AR6
undo info-center enable
interface LoopBack0
 ip address 1.1.1.6 255.255.255.255
# 公网Serial连AR4
interface Serial 4/0/0
 ip address 203.0.1.10 255.255.255.252
# MGRE隧道
interface Tunnel0/0/0 mode gre multipoint
 ip address 172.16.0.3 255.255.255.0
 source Serial 4/0/0
 nhrp entry 172.16.0.1 203.0.1.1 register
 nhrp broadcast
# Area2 下行接口
interface GigabitEthernet 0/0/0
 ip address 172.16.2.1 255.255.255.0
# OSPF
ospf 1 router-id 1.1.1.6
 area 0
  network 172.16.0.0 0.0.0.255
 area 2
  network 172.16.2.0 0.0.0.255
# 默认路由
ip route-static 0.0.0.0 0 Serial 4/0/0

AR7(MGRE 分支 + Area3 ABR)

复制代码
sysname AR7
undo info-center enable
interface LoopBack0
 ip address 1.1.1.7 255.255.255.255
# 公网GE连AR4
interface GigabitEthernet 0/0/0
 ip address 203.0.1.13 255.255.255.252
# MGRE隧道
interface Tunnel0/0/0 mode gre multipoint
 ip address 172.16.0.4 255.255.255.0
 source GigabitEthernet 0/0/0
 nhrp entry 172.16.0.1 203.0.1.1 register
 nhrp broadcast
# Area3下行口
interface GigabitEthernet 0/0/1
 ip address 172.16.3.1 255.255.255.0
# OSPF
ospf 1 router-id 1.1.1.7
 area 0
  network 172.16.0.0 0.0.0.255
 area 3
  network 172.16.3.0 0.0.0.255
# 默认路由
ip route-static 0.0.0.0 0 GigabitEthernet 0/0/0

四. Area2:AR11、AR12(RIP 与 OSPF 重分发)

AR11

复制代码
sysname AR11
undo info-center enable
interface LoopBack0
 ip address 1.1.1.11 255.255.255.255
# 上联AR6
interface GigabitEthernet 0/0/0
 ip address 172.16.2.2 255.255.255.0
# 下联AR12
interface GigabitEthernet 0/0/1
 ip address 172.16.2.3 255.255.255.0
# OSPF
ospf 1 router-id 1.1.1.11
 area 2
  network 172.16.2.0 0.0.0.255

AR12

复制代码
sysname AR12
undo info-center enable
interface LoopBack0
 ip address 1.1.1.12 255.255.255.255
# 上联AR11
interface GigabitEthernet 0/0/0
 ip address 172.16.2.4 255.255.255.0
# RIP私有网段
interface GigabitEthernet 0/0/1
 ip address 10.0.0.1 255.255.255.0
# OSPF进程
ospf 1 router-id 1.1.1.12
 area 2
  network 172.16.2.0 0.0.0.255
 # 引入RIP路由
 import-route rip 1 type 2
# RIP进程
rip 1
 version 2
 network 10.0.0.0
 # 引入OSPF路由
 import-route ospf 1
# 关闭RIP自动汇总
undo summary

五. Area3:AR8

AR8

复制代码
sysname AR8
undo info-center enable
interface LoopBack0
 ip address 1.1.1.8 255.255.255.255
# 上联AR7
interface GigabitEthernet 0/0/1
 ip address 172.16.3.2 255.255.255.0
# 下联AR9
interface GigabitEthernet 0/0/0
 ip address 172.16.3.3 255.255.255.0
ospf 1 router-id 1.1.1.8
 area 3
  network 172.16.3.0 0.0.0.255

六. Area4:AR9、AR10

AR9

复制代码
sysname AR9
undo info-center enable
interface LoopBack0
 ip address 1.1.1.9 255.255.255.255
# 上联AR8
interface GigabitEthernet 0/0/1
 ip address 172.16.3.4 255.255.255.0
# 下联AR10
interface GigabitEthernet 0/0/0
 ip address 172.16.4.1 255.255.255.0
ospf 1 router-id 1.1.1.9
 area 3
  network 172.16.3.0 0.0.0.255
 area 4
  network 172.16.4.0 0.0.0.255

AR10

复制代码
sysname AR10
undo info-center enable
interface LoopBack0
 ip address 1.1.1.10 255.255.255.255
interface GigabitEthernet 0/0/0
 ip address 172.16.4.2 255.255.255.0
ospf 1 router-id 1.1.1.10
 area 4
  network 172.16.4.0 0.0.0.255

七、OSPF 优化配置(减少 LSA、加速收敛、安全)

1、AR3:Area1

复制代码
ospf 1
 area 1
  stub no-summary

Area2 含外部 RIP 路由,配置 NSSA 完全 NSSA

AR6

复制代码
ospf 1
 area 2
  nssa no-summary default-route-advertise
  1. 加速收敛配置(所有 OSPF 路由器)

    ospf 1

    缩短hello时间,快速发现邻居

    timer hello 5

    缩短死亡时间

    timer dead 20

    快速泛洪LSA

    timer lsa-update 1

    开启SPF智能计时器

    spf-schedule-interval 100 1000

    接口级快速收敛(所有OSPF接口)

    interface GigabitEthernet 0/0/X
    ospf timer hello 5
    ospf cost 10
    ospf fast-reroute auto

  2. OSPF 安全

Area0(MGRE 隧道接口密文认证)

AR3/AR5/AR6/AR7 隧道口统一配置:

复制代码
interface Tunnel0/0/0
 ospf authentication-mode md5 1 cipher admin@123
ospf 1
 area 0
  authentication-mode md5

其他区域明文认证(Area1/2/3/4)

ABR 与区域内路由器统一:

复制代码
ospf 1
 area X
  authentication-mode simple
# 区域接口
interface GigabitEthernet 0/0/X
 ospf authentication-mode simple cipher ospf123

八、全网可达验证思路

  1. OSPF 邻居检查:display ospf peer brief
  2. 路由表查看:display ip routing-table protocol ospf
  3. MGRE 隧道检查:display nhrp peerdisplay tunnel-info
  4. RIP 重分发检查:AR12 display ip routing-table rip
  5. 公网连通:所有设备 ping 209.1.1.1(AR4 环回)
  6. 跨区域连通:AR1 ping AR10、AR1 ping RIP 网段 10.0.0.1
相关推荐
大树882 天前
金刚石散热越强,管路越先见顶
大数据·运维·服务器·人工智能·ai
摇滚侠2 天前
Linux CentOS7 rpm 安装 MySQL 5.7
linux·运维·mysql
霸道流氓气质2 天前
领域驱动设计(DDD)在 Spring Boot 微服务中的实践指南
运维·spring boot·微服务
小宇宙Zz2 天前
Maven依赖冲突
java·服务器·maven
Inhand陈工2 天前
基于台达PLC与映翰通IG502的智慧水产养殖精准投喂与远程运维解决方案
运维·人工智能·物联网·阿里云·信息与通信
网络研究院2 天前
2026年网络安全
网络·安全·法律·法规·趋势·发展
酣大智2 天前
ARP代理--工作原理
运维·网络·arp·arp代理
treesforest2 天前
AI安全系统如何识别异常访问?IP风险识别正在成为关键能力
网络·人工智能·tcp/ip·安全·web安全
shushangyun_2 天前
2026年快消品B2B系统推荐:支持终端门店订货、促销政策自动化的工具?
java·运维·网络·数据库·人工智能·spring·自动化
古城小栈2 天前
Unix 与 Linux 异同小叙
linux·服务器·unix