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
相关推荐
IP搭子来一个1 小时前
爬虫使用代理 IP 频繁失效,该如何定位问题?
网络·爬虫·tcp/ip
KaMeidebaby1 小时前
卡梅德生物技术快报|酵母双杂交 cDNA 文库构建与蛋白互作筛选流程
服务器·前端·数据库·人工智能·算法
csdn_aspnet1 小时前
Modbus TCP C# 客户端程序
服务器·网络·tcp/ip·c#
辣椒思密达1 小时前
住宅IP与机房IP的区别及技术选型指南
网络·网络协议·tcp/ip
沐风___1 小时前
App 上架之后:如何看数据、获取用户与持续迭代产品
服务器·前端·数据库
小灰灰搞电子2 小时前
Rust 实现异步ModbusTCP主机源码分享
服务器·网络·modbustcp·rust
apcipot_rain2 小时前
计科八股20260529——连接协议连接线程池、模块拆解模块通信、WebSocket
运维·服务器·网络·八股
GIS数据转换器2 小时前
智慧能源管理平台
java·大数据·运维·人工智能·无人机
AAA大运重卡何师傅(专跑国道)2 小时前
力扣hot100
服务器·前端·数据库