摘要:大家好,我是「极客运维社」飞哥!深耕企业组网和网络设备领域多年,每天为你拆解:1、交换机/路由器疑难故障处理方案2、网络架构优化与安全防护实战技巧3、中小企业低成本智能组网案例解析长按【收藏】 搭建你的专属运维知识库,点亮文末小红心,激励飞哥创作更多硬核内容。
大家好,我是「极客运维社」飞哥!深耕企业组网和网络设备领域多年,每天为你拆解:
1、交换机/路由器疑难故障处理方案
2、网络架构优化与安全防护实战技巧
3、中小企业低成本智能组网案例解析
点亮文末小红心,激励飞哥创作更多硬核内容。
特别提醒:网络运维问题常有突发性,建议将本文加入收藏,遇到设备配置、链路故障、卡顿、数据丢包等问题时,随时可调取解决方案!
OSPF 网络拓扑图
1、配置ip
#AR1路由器配置sysEnter system view, return user view with Ctrl+Z.Info: Information center is disabled.[Huawei]sysname AR1[AR1][AR1]int gi 0/0/0[AR1-GigabitEthernet0/0/0]ip add 192.168.12.1 24[AR1-GigabitEthernet0/0/0]q[AR1]int loopback 0[AR1-LoopBack0]ip address 1.1.1.1 24[AR1-LoopBack0]q[AR1]#查看接口信息[AR1]dis ip int brief *down: administratively down^down: standby(l): LoopBack(s): spoofingThe number of interface that is UP in Physical is 3The number of interface that is DOWN in Physical is 2The number of interface that is UP in Protocol is 3The number of interface that is DOWN in Protocol is 2Interface IP Address/Mask Physical Protocol GigabitEthernet0/0/0 192.168.12.1/24 up up GigabitEthernet0/0/1 unassigned down down GigabitEthernet0/0/2 unassigned down down LoopBack0 1.1.1.1/24 up up(s) NULL0 unassigned up up(s) [AR1]#AR2路由器配置sysEnter system view, return user view with Ctrl+Z.[Huawei]undo inf enInfo: Information center is disabled.[Huawei]sysna [Huawei]sysname AR2[AR2][AR2]int gi 0/0/0[AR2-GigabitEthernet0/0/0]ip add 192.168.12.2 24[AR2-GigabitEthernet0/0/0]q[AR2]int loop [AR2]int LoopBack 0[AR2-LoopBack0]ip add 2.2.2.2 24[AR2-LoopBack0][AR2-LoopBack0]q[AR2]int gi 0/0/1[AR2-GigabitEthernet0/0/1]ip add 192.168.10.2 24[AR2-GigabitEthernet0/0/1]q[AR2]int loop [AR2]#AR3配置SYSEnter system view, return user view with Ctrl+Z.Info: Information center is disabled.[Huawei]sysname AR3[AR3][AR3]int gi 0/0/0[AR3-GigabitEthernet0/0/0]ip add 192.168.10.3 24[AR3-GigabitEthernet0/0/0]q[AR3]int LoopBack 0[AR3-LoopBack0]ip add 3.3.3.3 24[AR3-LoopBack0]q[AR3]dis ip int brief *down: administratively down^down: standby(l): loopback(s): spoofingThe number of interface that is UP in Physical is 3The number of interface that is DOWN in Physical is 2The number of interface that is UP in Protocol is 3The number of interface that is DOWN in Protocol is 2Interface IP Address/Mask Physical Protocol GigabitEthernet0/0/0 192.168.10.3/24 up up GigabitEthernet0/0/1 unassigned down down GigabitEthernet0/0/2 unassigned down down LoopBack0 3.3.3.3/24 up up(s) NULL0 unassigned up up(s) [AR3]2、配置OSPF
#AR1 OSPF 配置[AR1]ospf 1 Router-id 1.1.1.1[AR1-ospf-1]area 0[AR1-ospf-1-area-0.0.0.0]network 192.168.12.0 0.0.0.255[AR1-ospf-1-area-0.0.0.0]network 1.1.1.0 0.0.0.255[AR1-ospf-1-area-0.0.0.0]q[AR1-ospf-1]q[AR1]#AR2 OSPF 配置[AR2]ospf 1 router-id 2.2.2.2[AR2-ospf-1]area 0[AR2-ospf-1-area-0.0.0.0]network 192.168.12.0 0.0.0.255[AR2-ospf-1-area-0.0.0.0]network 192.168.10.0 0.0.0.255[AR2-ospf-1-area-0.0.0.0]network 2.2.2.0 0.0.0.255[AR2-ospf-1-area-0.0.0.0]q[AR2-ospf-1]q[AR2]#AR3 OSPF配置[AR3]ospf 1 router-id 3.3.3.3[AR3-ospf-1]area 0[AR3-ospf-1-area-0.0.0.0]network 192.168.10.0 0.0.0.255[AR3-ospf-1-area-0.0.0.0]network 3.3.3.0 0.0.0.255[AR3-ospf-1-area-0.0.0.0]q[AR3-ospf-1]q[AR3]查看邻居表
#AR1邻居表[AR1]dis ospf peer OSPF Process 1 with Router ID 1.1.1.1 Neighbors Area 0.0.0.0 interface 192.168.12.1(GigabitEthernet0/0/0)'s neighbors Router ID: 2.2.2.2 Address: 192.168.12.2 State: Full Mode:Nbr is Master Priority: 1 DR: 192.168.12.1 BDR: 192.168.12.2 MTU: 0 Dead timer due in 34 sec Retrans timer interval: 5 Neighbor is up for 00:04:15 Authentication Sequence: [ 0 ] [AR1]#AR2邻居表[AR2]dis ospf peer OSPF Process 1 with Router ID 2.2.2.2 Neighbors Area 0.0.0.0 interface 192.168.12.2(GigabitEthernet0/0/0)'s neighbors Router ID: 1.1.1.1 Address: 192.168.12.1 State: Full Mode:Nbr is Slave Priority: 1 DR: 192.168.12.1 BDR: 192.168.12.2 MTU: 0 Dead timer due in 40 sec Retrans timer interval: 5 Neighbor is up for 00:07:07 Authentication Sequence: [ 0 ] Neighbors Area 0.0.0.0 interface 192.168.10.2(GigabitEthernet0/0/1)'s neighbors Router ID: 3.3.3.3 Address: 192.168.10.3 State: Full Mode:Nbr is Master Priority: 1 DR: 192.168.10.2 BDR: 192.168.10.3 MTU: 0 Dead timer due in 40 sec Retrans timer interval: 5 Neighbor is up for 00:04:11 Authentication Sequence: [ 0 ] [AR2]#AR3 邻居表[AR3]dis ospf peer OSPF Process 1 with Router ID 3.3.3.3 Neighbors Area 0.0.0.0 interface 192.168.10.3(GigabitEthernet0/0/0)'s neighbors Router ID: 2.2.2.2 Address: 192.168.10.2 State: Full Mode:Nbr is Slave Priority: 1 DR: 192.168.10.2 BDR: 192.168.10.3 MTU: 0 Dead timer due in 40 sec Retrans timer interval: 5 Neighbor is up for 00:08:05 Authentication Sequence: [ 0 ] [AR3]查看路由表
#AR1路由表[AR1]dis ospf Routing OSPF Process 1 with Router ID 1.1.1.1 Routing Tables Routing for Network Destination Cost Type NextHop AdvRouter Area 1.1.1.1/32 0 Stub 1.1.1.1 1.1.1.1 0.0.0.0 192.168.12.0/24 1 Transit 192.168.12.1 1.1.1.1 0.0.0.0 2.2.2.2/32 1 Stub 192.168.12.2 2.2.2.2 0.0.0.0 3.3.3.3/32 2 Stub 192.168.12.2 3.3.3.3 0.0.0.0 192.168.10.0/24 2 Transit 192.168.12.2 2.2.2.2 0.0.0.0 Total Nets: 5 Intra Area: 5 Inter Area: 0 ASE: 0 NSSA: 0 [AR1]#AR2路由表[AR2]dis ospf routing OSPF Process 1 with Router ID 2.2.2.2 Routing Tables Routing for Network Destination Cost Type NextHop AdvRouter Area 2.2.2.2/32 0 Stub 2.2.2.2 2.2.2.2 0.0.0.0 192.168.10.0/24 1 Transit 192.168.10.2 2.2.2.2 0.0.0.0 192.168.12.0/24 1 Transit 192.168.12.2 2.2.2.2 0.0.0.0 1.1.1.1/32 1 Stub 192.168.12.1 1.1.1.1 0.0.0.0 3.3.3.3/32 1 Stub 192.168.10.3 3.3.3.3 0.0.0.0 Total Nets: 5 Intra Area: 5 Inter Area: 0 ASE: 0 NSSA: 0 [AR2]#AR3 路由表这里省略,用到命令相同3、测试
AR1 能够与AR3 互通
场景1:邻居状态卡在Init
现象:display ospf peer显示状态为Init
排查步骤:
检查物理链路状态:display interface brief验证Hello包交互:debugging ospf packet hello确认ACL过滤规则:display acl all场景2:反复震荡在ExStart/Exchange
特征:邻居状态在ExStart和Exchange之间震荡
解决方案:
检查MTU一致性:display interface | include MTU验证DD报文序列号:debugging ospf packet dd考虑关闭MTU检测:ospf mtu-ignore(临时方案)1. 静默接口配置
防止不必要的邻居建立:
[RouterA] ospf 1[RouterA-ospf-1] silent-interface GigabitEthernet0/0/1 // 禁止发送OSPF报文2. 调整网络类型
解决帧中继环境下的邻居问题:
[RouterA-GigabitEthernet0/0/0] ospf network-type p2mp // 修改网络类型3. 安全加固配置
启用MD5认证:
[RouterA-GigabitEthernet0/0/0] ospf authentication-mode md5 1 cipher Huawei@123五、结语实战建议:
建议读者建立“四查清单”(区域/认证/计时器/MTU),并养成对比display ospf peer verbose 与debugging日志联动的排障习惯。真正的技术成长始于动手验证——用ENSP环境模拟文中拓扑场景(如故意区域不一致等场景),来检验实验的可行性。
来源:极客运维社