OSPF是什么
OSPF(Open Shortest Pass First,开放最短路径优先协议),是一个最常用的内部网管协议,是一个链路状态协议。
使用场景:适用于运营商、政府机构等大型网络中多节点要求互联互通
网络结构:支持两层结构 1骨干区域 2 子区域
OSPF基于IP
OSPF不属于网络层协议
PC12 配置好IP信息后启动
PC13 同样操作配置好IP信息后启动
路由设备配置部分
R6 基础环境配置
<Huawei>system-view #切换模式
[Huawei]sysname R6 #给设备起个名字 R6
[R6]display ip interface brief #查看设备接口信息
[R6]int GigabitEthernet 0/0/0 #进入 GE 0 接口
[R6]ip add 10.0.1.1 24 #配置IP
[R6]q #退出并返回上一级目录
[R6]int GigabitEthernet 0/0/1
[R6-GigabitEthernet0/0/1]ip add 20.0.2.1 24
[R6-GigabitEthernet0/0/1]
[R6-GigabitEthernet0/0/1]display ip interface brief
R8 基础环境配置
<Huawei>
<Huawei>system-view #切换模式
Enter system view, return user view with Ctrl+Z.
[Huawei]
[Huawei]sysname R8 #给设备起个名字 R8
[R8]
[R8]int GigabitEthernet 0/0/0 #进入 GE 0 接口
[R8-GigabitEthernet0/0/0]
[R8-GigabitEthernet0/0/0]ip add 20.0.2.2 24 #配置IP
[R8-GigabitEthernet0/0/0]
Mar 6 2019 11:07:24-08:00 R8 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R8-GigabitEthernet0/0/0]
[R8-GigabitEthernet0/0/0]int GigabitEthernet 0/0/1 #进入 GE 1 接口
[R8-GigabitEthernet0/0/1]
[R8-GigabitEthernet0/0/1]ip add 30.0.3.2 24 #配置IP
Mar 6 2019 11:08:48-08:00 R8 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R8-GigabitEthernet0/0/1]q #退出并返回上一级目录
[R8]
[R8]interface LoopBack0
[R8-LoopBack0]q #退出并返回上一级目录
[R8]
[R8]interface LoopBack0 #配置回环口 0
[R8-LoopBack0]ip add 6.6.6.6 24 #配置IP
[R8-LoopBack0]q #退出并返回上一级目录
[R8]
[R8]display ip interface brief #查看设备接口信息
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 0
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 20.0.2.2/24 up up
GigabitEthernet0/0/1 30.0.3.2/24 up up
LoopBack0 6.6.6.6/24 up up(s)
NULL0 unassigned up up(s)
R9 基础环境配置
<Huawei>SY
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]
[Huawei]SY
[Huawei]sysname R9
[R9]
[R9]int
[R9]interface gi
[R9]interface GigabitEthernet 0/0/0
[R9-GigabitEthernet0/0/0]ip add 30.0.3.3 24
[R9-GigabitEthernet0/0/0]
Mar 6 2019 11:20:22-08:00 R9 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R9-GigabitEthernet0/0/0]interface GigabitEthernet 0/0/1
[R9-GigabitEthernet0/0/1]ip add 60.0.6.3 24
Mar 6 2019 11:20:55-08:00 R9 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R9-GigabitEthernet0/0/1]q
[R9]
[R9]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 0
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 30.0.3.3/24 up up
GigabitEthernet0/0/1 60.0.6.3/24 up up
NULL0 unassigned up up(s)
[R9]
[R9]
OSPF配置部分
R6 配置OSPF
R8 配置OSPF
<R8>system-view #切换模式
Enter system view, return user view with Ctrl+Z.
[R8]
[R8]ospf 2 #创建OSPF线程2
[R8-ospf-2]area 6 #创建区域 6
[R8-ospf-2-area-0.0.0.6]network 20.0.2.0 255.255.255.0 #宣告网段
[R8-ospf-2-area-0.0.0.6]network 30.0.3.0 255.255.255.0 #宣告网段
[R8-ospf-2-area-0.0.0.6]network 6.6.6.6 255.255.255.0 #宣告网段
[R8-ospf-2-area-0.0.0.6]q #退出并返回上一级目录
[R8-ospf-2]
[R8-ospf-2]display this #查看设备接口信息
[V200R003C00]
#
ospf 2
area 0.0.0.6
network 6.6.6.0 0.0.0.255
network 20.0.2.0 0.0.0.255
network 30.0.3.0 0.0.0.255
#
return
[R8-ospf-2]
R9 配置OSPF
来源:https://www.cnblogs.com/Ryan2019/p/10524930.html