玩转华为ENSP模拟器系列 | 配置OSPF router-id冲突检测
Posted COCOgsta
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了玩转华为ENSP模拟器系列 | 配置OSPF router-id冲突检测相关的知识,希望对你有一定的参考价值。
素材来源:华为路由器配置指南
一边学习一边整理试验笔记,并与大家分享,侵权即删,谢谢支持!
附上汇总贴:玩转华为ENSP模拟器系列 | 合集_COCOgsta的博客-CSDN博客_ensp实验大全
目标
验证华为路由在不同接口收到相同OSPF Router-id发来的不同路由,可以修改对方的router-id
组网模型
配置思路
- CX1、CX2、CX3使用相同的Router-id与CX4建立OSPF邻居
- CX1、CX2、CX3分别通告不同的路由至CX4,观察CX4是否接收到所有路由
- 观察CX4上这对CX1、CX2、CX3的router-id是否发生了修改
操作步骤
- 配置各接口IP地址,其中CX1、CX2、CX3的loopback地址为相同IP地址(略)
- 配置OSPF邻居
配置CX1
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 10.1.14.0 0.0.0.255
配置CX2
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 10.1.24.0 0.0.0.255
配置CX3
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 10.1.34.0 0.0.0.255
配置CX4
ospf 1 router-id 4.4.4.4
area 0.0.0.0
network 10.1.14.0 0.0.0.255
network 10.1.24.0 0.0.0.255
network 10.1.34.0 0.0.0.255
查看OSPF邻居,以CX4为例
[~CX4-ospf-1]dis ospf peer brief
(M) Indicates MADJ neighbor
OSPF Process 1 with Router ID 4.4.4.4
Peer Statistic Information
Total number of peer(s): 3
Peer(s) in full state: 3
-----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 Eth1/0/0 1.1.1.1 Full
0.0.0.0 Eth1/0/1 1.1.1.1 Full
0.0.0.0 Eth1/0/2 1.1.1.1 Full
-----------------------------------------------------------------------------
OSPF Process 65534 with Router ID 128.1.138.139
Peer Statistic Information
Total number of peer(s): 5
Peer(s) in full state: 5
-----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 Eth1/0/0.4094 128.1.138.140 Full
0.0.0.0 Eth1/0/1.4094 128.1.138.137 Full
0.0.0.0 Eth1/0/2.4094 128.1.138.138 Full
0.0.0.0 DCN-Serial1/0/1:0 128.1.138.137 Full
0.0.0.0 DCN-Serial1/0/0:0 128.1.138.140 Full
-----------------------------------------------------------------------------
[~CX4-ospf-1]
- 观察OSPF router-id变化
放置一段时候后,再次在CX4上观察OSPF邻居,发现CX1和CX2的router-id发生了变化
[~CX4-ospf-1]dis ospf peer brief
(M) Indicates MADJ neighbor
OSPF Process 1 with Router ID 4.4.4.4
Peer Statistic Information
Total number of peer(s): 3
Peer(s) in full state: 3
-----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 Eth1/0/0 0.153.32.146 Full
0.0.0.0 Eth1/0/1 0.32.50.169 Full
0.0.0.0 Eth1/0/2 1.1.1.1 Full
-----------------------------------------------------------------------------
OSPF Process 65534 with Router ID 128.1.138.139
Peer Statistic Information
Total number of peer(s): 5
Peer(s) in full state: 5
-----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 Eth1/0/0.4094 128.1.138.140 Full
0.0.0.0 Eth1/0/1.4094 128.1.138.137 Full
0.0.0.0 Eth1/0/2.4094 128.1.138.138 Full
0.0.0.0 DCN-Serial1/0/1:0 128.1.138.137 Full
0.0.0.0 DCN-Serial1/0/0:0 128.1.138.140 Full
-----------------------------------------------------------------------------
[~CX4-ospf-1]
CX1上查看OSPF邻居,发现router-id也相应发生了变化
[~CX1-ospf-1]dis ospf peer brief
(M) Indicates MADJ neighbor
OSPF Process 1 with Router ID 0.153.32.146
Peer Statistic Information
Total number of peer(s): 1
Peer(s) in full state: 1
-----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 Eth1/0/0 4.4.4.4 Full
-----------------------------------------------------------------------------
OSPF Process 65534 with Router ID 128.1.138.140
Peer Statistic Information
Total number of peer(s): 2
Peer(s) in full state: 2
-----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 Eth1/0/0.4094 128.1.138.139 Full
0.0.0.0 DCN-Serial1/0/0:0 128.1.138.139 Full
-----------------------------------------------------------------------------
[~CX1-ospf-1]
CX2上查看OSPF邻居,发现router-id也相应发生了变化
[~CX2-ospf-1]dis ospf peer brief
(M) Indicates MADJ neighbor
OSPF Process 1 with Router ID 0.32.50.169
Peer Statistic Information
Total number of peer(s): 1
Peer(s) in full state: 1
-----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 Eth1/0/0 4.4.4.4 Full
-----------------------------------------------------------------------------
OSPF Process 65534 with Router ID 128.1.138.137
Peer Statistic Information
Total number of peer(s): 2
Peer(s) in full state: 2
-----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 Eth1/0/0.4094 128.1.138.139 Full
0.0.0.0 DCN-Serial1/0/0:0 128.1.138.139 Full
-----------------------------------------------------------------------------
[~CX2-ospf-1]
CX3上查看OSPF邻居,router-id没有发生变化
[~CX3-ospf-1]dis ospf peer brief
(M) Indicates MADJ neighbor
OSPF Process 1 with Router ID 1.1.1.1
Peer Statistic Information
Total number of peer(s): 1
Peer(s) in full state: 1
-----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 Eth1/0/0 4.4.4.4 Full
-----------------------------------------------------------------------------
OSPF Process 65534 with Router ID 128.1.138.138
Peer Statistic Information
Total number of peer(s): 1
Peer(s) in full state: 1
-----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 Eth1/0/0.4094 128.1.138.139 Full
-----------------------------------------------------------------------------
[~CX3-ospf-1]
- CX1、CX2、CX3、CX4关闭router-id冲突检测功能
配置CX1
ospf router-id auto-recover disable
配置CX2
ospf router-id auto-recover disable
配置CX3
ospf router-id auto-recover disable
配置CX4
ospf router-id auto-recover disable
reset 4台设备的ospf进程,以CX1为例
reset ospf process
再次查看OSPF邻居,以CX4为例
[~CX4]dis ospf peer brief
(M) Indicates MADJ neighbor
OSPF Process 1 with Router ID 4.4.4.4
Peer Statistic Information
Total number of peer(s): 3
Peer(s) in full state: 3
-----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 Eth1/0/0 1.1.1.1 Full
0.0.0.0 Eth1/0/1 1.1.1.1 Full
0.0.0.0 Eth1/0/2 1.1.1.1 Full
-----------------------------------------------------------------------------
OSPF Process 65534 with Router ID 128.1.138.139
Peer Statistic Information
Total number of peer(s): 5
Peer(s) in full state: 5
-----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 Eth1/0/0.4094 128.1.138.140 Full
0.0.0.0 Eth1/0/1.4094 128.1.138.137 Full
0.0.0.0 Eth1/0/2.4094 128.1.138.138 Full
0.0.0.0 DCN-Serial1/0/1:0 128.1.138.137 Full
0.0.0.0 DCN-Serial1/0/0:0 128.1.138.140 Full
-----------------------------------------------------------------------------
[~CX4]
- CX1、CX2、CX3分别通告不同的路由
配置CX1
interface LoopBack100
ip address 2.2.2.1 255.255.255.255
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 10.1.14.0 0.0.0.255
配置CX2
interface LoopBack100
ip address 2.2.2.2 255.255.255.255
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 10.1.24.0 0.0.0.255
配置CX3
interface LoopBack100
ip address 2.2.2.3 255.255.255.255
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 2.2.2.3 0.0.0.0
network 10.1.34.0 0.0.0.255
此时查看CX4的路由,仅有1条路由在路由表中,即最后通告的路由。相应的OSPF路由表中路由也在不停的变化。
[~CX4]dis ip routing-table
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole
route
------------------------------------------------------------------------------
Routing Table : _public_
Destinations : 15 Routes : 15
Destination/Mask Proto Pre Cost Flags NextHop Interface
2.2.2.3/32 OSPF 10 1 D 10.1.34.1 Ethernet1/0/2
4.4.4.4/32 Direct 0 0 D 127.0.0.1 LoopBack0
10.1.14.0/24 Direct 0 0 D 10.1.14.2 Ethernet1/0/0
10.1.14.2/32 Direct 0 0 D 127.0.0.1 Ethernet1/0/0
10.1.14.255/32 Direct 0 0 D 127.0.0.1 Ethernet1/0/0
10.1.24.0/24 Direct 0 0 D 10.1.24.2 Ethernet1/0/1
10.1.24.2/32 Direct 0 0 D 127.0.0.1 Ethernet1/0/1
10.1.24.255/32 Direct 0 0 D 127.0.0.1 Ethernet1/0/1
10.1.34.0/24 Direct 0 0 D 10.1.34.2 Ethernet1/0/2
10.1.34.2/32 Direct 0 0 D 127.0.0.1 Ethernet1/0/2
10.1.34.255/32 Direct 0 0 D 127.0.0.1 Ethernet1/0/2
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[~CX4]
[~CX4]dis ospf routing
OSPF Process 1 with Router ID 4.4.4.4
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
2.2.2.2/32 1 Stub 10.1.24.1 1.1.1.1 0.0.0.0
10.1.14.0/24 1 Direct 10.1.14.2 4.4.4.4 0.0.0.0
10.1.24.0/24 1 Direct 10.1.24.2 4.4.4.4 0.0.0.0
10.1.34.0/24 1 Direct 10.1.34.2 4.4.4.4 0.0.0.0
Total Nets: 4
Intra Area: 4 Inter Area: 0 ASE: 0 NSSA: 0
OSPF Process 65534 with Router ID 128.1.138.139
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
128.1.138.137/32 100 Stub 128.1.138.137 128.1.138.137 0.0.0.0
128.1.138.137/32 100 Stub 128.1.138.137 128.1.138.137 0.0.0.0
128.1.138.138/32 100 Stub 128.1.138.138 128.1.138.138 0.0.0.0
128.1.138.139/32 0 Direct 128.1.138.139 128.1.138.139 0.0.0.0
128.1.138.140/32 100 Stub 128.1.138.140 128.1.138.140 0.0.0.0
128.1.138.140/32 100 Stub 128.1.138.140 128.1.138.140 0.0.0.0
Total Nets: 4
Intra Area: 4 Inter Area: 0 ASE: 0 NSSA: 0
[~CX4]
[~CX4]dis ospf routing
OSPF Process 1 with Router ID 4.4.4.4
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
2.2.2.3/32 1 Stub 10.1.34.1 1.1.1.1 0.0.0.0
10.1.14.0/24 1 Direct 10.1.14.2 4.4.4.4 0.0.0.0
10.1.24.0/24 1 Direct 10.1.24.2 4.4.4.4 0.0.0.0
10.1.34.0/24 1 Direct 10.1.34.2 4.4.4.4 0.0.0.0
Total Nets: 4
Intra Area: 4 Inter Area: 0 ASE: 0 NSSA: 0
OSPF Process 65534 with Router ID 128.1.138.139
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
128.1.138.137/32 100 Stub 128.1.138.137 128.1.138.137 0.0.0.0
128.1.138.137/32 100 Stub 128.1.138.137 128.1.138.137 0.0.0.0
128.1.138.138/32 100 Stub 128.1.138.138 128.1.138.138 0.0.0.0
128.1.138.139/32 0 Direct 128.1.138.139 128.1.138.139 0.0.0.0
128.1.138.140/32 100 Stub 128.1.138.140 128.1.138.140 0.0.0.0
128.1.138.140/32 100 Stub 128.1.138.140 128.1.138.140 0.0.0.0
Total Nets: 4
Intra Area: 4 Inter Area: 0 ASE: 0 NSSA: 0
[~CX4]
以上是关于玩转华为ENSP模拟器系列 | 配置OSPF router-id冲突检测的主要内容,如果未能解决你的问题,请参考以下文章
玩转华为ENSP模拟器系列 | 配置LDP与OSPF联动示例
玩转华为ENSP模拟器系列 | 配置BFD for OSPF特性示例
玩转华为ENSP模拟器系列 | 配置OSPF ABR路由聚合示例