1.ENSP下载
⭐/*无需密钥 免费下载 安装不成功,可关注并私信博主*/
2.OSPF的基础需求和规则
- 实验规则:
1.接口地址→XY.XY.XY.R /24
X:两者之间最小的
Y:两者之间最大的
R:谁的接口就是谁的编号
以R1和R2之间的连接为例,R1的上接口地址为:12.12.12.1 /24
R2的下接口地址为:12.12.12.2 /24
2.Loopback地址→R.R.R.R /32
以R1为例,Loopback地址为:1.1.1.1 /32
- 需求:
通过OSPF协议,实现R1和R2的互通,同时学习一些基础的过程。
3.分析
- 1.首先配置每台路由器(R)对应的接口地址和Loopback地址,需保证地址的唯一性。
- 2.配置OSPF协议,使得区域0和区域1之间的路由器(R)都能互通。
指定Router ID → 运行OSPF → 创建区域 → 宣告网络。 - 3.结果验证,同时对状态、表等进行分析。
4.实验配置
- 地址配置+三表查询(邻居、LSDP、路由表)
以R4地址配置为例:
<Huawei>system-view //进入系统试图
Enter system view, return user view with Ctrl+Z.
[Huawei]undo inf enable //关闭信息中心
Info: Information center is disabled.
[Huawei]sysname R4 //改名
[R4]int LoopBack 0
[R4-LoopBack0]ip add 4.4.4.4 32 //配置本地回环地址
[R4]interface GigabitEthernet 0/0/1
[R4-GigabitEthernet0/0/0]ip add 34.34.34.4 24 //配置接口地址
<R4>save //保证配置
- 以R2为例依次查询三表 (邻居、LSDP、路由表):
- 配置OSPF协议
以R2为例:
[R2]router id 2.2.2.2 //制定ROUTER ID
Info: Router ID has been modified, please reset the relative protocols manually
to update the Router ID.
[R2]ospf 1 //创建进程和区域
[R2-ospf-1]area 1
[R2-ospf-1-area-0.0.0.1]network 12.12.12.0 0.0.0.255 //宣告对应区域的网络
[R2-ospf-1-area-0.0.0.1]network 2.2.2.2 0.0.0.0
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 23.23.23.0 0.0.0.255
- 以R2为例的三张表:
邻居表
※邻居表
<R2>display ospf peer
OSPF Process 1 with Router ID 2.2.2.2
Neighbors
Area 0.0.0.0 interface 23.23.23.2(GigabitEthernet0/0/0)'s neighbors
Router ID: 3.3.3.3 Address: 23.23.23.3
State: Full Mode:Nbr is Master Priority: 1
DR: 23.23.23.2 BDR: 23.23.23.3 MTU: 0
Dead timer due in 32 sec
Retrans timer interval: 5
Neighbor is up for 00:15:30
Authentication Sequence: [ 0 ]
Neighbors
Area 0.0.0.1 interface 12.12.12.2(GigabitEthernet0/0/1)'s neighbors
Router ID: 1.1.1.1 Address: 12.12.12.1
State: Full Mode:Nbr is Slave Priority: 1
DR: 12.12.12.1 BDR: 12.12.12.2 MTU: 0
Dead timer due in 38 sec
Retrans timer interval: 5
Neighbor is up for 00:19:31
Authentication Sequence: [ 0 ]
链路状态表
※链路状态表
<R2>display ospf lsdb
OSPF Process 1 with Router ID 2.2.2.2
Link State Database
Area: 0.0.0.0
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 2.2.2.2 2.2.2.2 923 36 80000005 1
Router 3.3.3.3 3.3.3.3 929 36 80000004 1
Network 23.23.23.2 2.2.2.2 923 32 80000002 0
Sum-Net 34.34.34.0 3.3.3.3 920 28 80000001 1
Sum-Net 3.3.3.3 3.3.3.3 912 28 80000001 0
Sum-Net 4.4.4.4 3.3.3.3 188 28 80000001 1
Sum-Net 2.2.2.2 2.2.2.2 1155 28 80000001 0
Sum-Net 12.12.12.0 2.2.2.2 1155 28 80000001 1
Sum-Net 1.1.1.1 2.2.2.2 1155 28 80000001 1
Area: 0.0.0.1
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 2.2.2.2 2.2.2.2 1165 48 80000005 0
Router 1.1.1.1 1.1.1.1 1171 48 80000006 0
Network 12.12.12.1 1.1.1.1 1171 32 80000002 0
Sum-Net 34.34.34.0 2.2.2.2 919 28 80000001 2
Sum-Net 3.3.3.3 2.2.2.2 911 28 80000001 1
Sum-Net 23.23.23.0 2.2.2.2 1155 28 80000001 1
Sum-Net 4.4.4.4 2.2.2.2 187 28 80000001 2
ospf 路由表
※OSPF 路由表
<R2>display 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.1
12.12.12.0/24 1 Transit 12.12.12.2 2.2.2.2 0.0.0.1
23.23.23.0/24 1 Transit 23.23.23.2 2.2.2.2 0.0.0.0
1.1.1.1/32 1 Stub 12.12.12.1 1.1.1.1 0.0.0.1
3.3.3.3/32 1 Inter-area 23.23.23.3 3.3.3.3 0.0.0.0
4.4.4.4/32 2 Inter-area 23.23.23.3 3.3.3.3 0.0.0.0
34.34.34.0/24 2 Inter-area 23.23.23.3 3.3.3.3 0.0.0.0
Total Nets: 7
Intra Area: 4 Inter Area: 3 ASE: 0 NSSA: 0
5.结果验证
- ping测试:
- 跟踪测试: