拓扑图如下
ospf一个设备就只能一个进程,
在AR上操作,附讲解,
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sy R1
[R1]os
[R1]ospf 10 ospf进程10
[R1-ospf-10]a 0 建立区域0
[R1-ospf-10-area-0.0.0.0]
[R1-ospf-10-area-0.0.0.0]network 192.168.1.0 0.0.0.255 在区域下宣告
[R1-ospf-10-area-0.0.0.0]dis
[R1-ospf-10-area-0.0.0.0]dis th 查看配置
[V200R003C00]
#
area 0.0.0.0
network 192.168.1.0 0.0.0.255
#
return
[R1-ospf-10-area-0.0.0.0]
[R1]dis ospf int g0/0/0
Info: The specified interface is not enabled in the current OSPF instance.
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add
[R1-GigabitEthernet0/0/0]ip address 192.168.1.1 24
[R1-GigabitEthernet0/0/0]
[R1]dis ospf int g0/0/0
OSPF Process 10 with Router ID 192.168.1.1
Interfaces
Interface: 192.168.1.1 (GigabitEthernet0/0/0)
Cost: 1 State: DR Type: Broadcast MTU: 1500
Priority: 1
Designated Router: 192.168.1.1
Backup Designated Router: 192.168.1.2
Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ospf en
[R2-GigabitEthernet0/0/0]ospf enable 20 a
[R2-GigabitEthernet0/0/0]ospf enable 20 area 0
这里是在R2是接口下宣告,ospf 进程是20区域是0
dis ospf int g0/0/0查看ospf状态,
<Huawei>
Jul 28 2025 21:41:19-08:00 Huawei %%01IFPDT/4/IF_STATE(l)[0]:Interface GigabitEt
hernet0/0/0 has turned into UP state.
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sy R2
[R2]ospf 20
[R2-ospf-20]a 0
[R2-ospf-20-area-0.0.0.0]q
[R2-ospf-20]q
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ospf en
[R2-GigabitEthernet0/0/0]ospf enable 20 a
[R2-GigabitEthernet0/0/0]ospf enable 20 area 0
[R2-GigabitEthernet0/0/0]dis th
[V200R003C00]
#
interface GigabitEthernet0/0/0
ospf enable 20 area 0.0.0.0
#
return
[R2-GigabitEthernet0/0/0]ip add
[R2-GigabitEthernet0/0/0]ip address 192.168.1.2 24
Jul 28 2025 21:44:02-08:00 R2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R2-GigabitEthernet0/0/0]
Jul 28 2025 21:44:09-08:00 R2 %%01OSPF/4/NBR_CHANGE_E(l)[7]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=5120, NeighborAddress=1.1.168.192, Neigh
borEvent=LoadingDone, NeighborPreviousState=Loading, NeighborCurrentState=Full)
[R2-GigabitEthernet0/0/0]
[R2-GigabitEthernet0/0/0]
[R2-GigabitEthernet0/0/0]q
[R2]dis ospf int g0/0/0
OSPF Process 20 with Router ID 192.168.1.2
Interfaces
Interface: 192.168.1.2 (GigabitEthernet0/0/0)
Cost: 1 State: BDR Type: Broadcast MTU: 1500
Priority: 1
Designated Router: 192.168.1.1
Backup Designated Router: 192.168.1.2
Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1
[R2]
这里R2是BDR ,R1是DR
The device is running!
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sy R3
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add
[R3-GigabitEthernet0/0/0]ip address 192.168.1.3 24
Jul 28 2025 21:55:57-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R3-GigabitEthernet0/0/0]
Please check whether system data has been changed, and save data in time
Configuration console time out, please press any key to log on
<R3>
<R3>sy
Enter system view, return user view with Ctrl+Z.
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]dis th
[V200R003C00]
#
interface GigabitEthernet0/0/0
ip address 192.168.1.3 255.255.255.0
#
return
[R3-GigabitEthernet0/0/0]ospf en
[R3-GigabitEthernet0/0/0]ospf enable 30 ar
[R3-GigabitEthernet0/0/0]ospf enable 30 area 0
[R3-GigabitEthernet0/0/0]
Please check whether system data has been changed, and save data in time
Configuration console time out, please press any key to log on
<R3>sy
Enter system view, return user view with Ctrl+Z.
[R3]ospf 30
[R3-ospf-30]a
[R3-ospf-30]area 0
[R3-ospf-30-area-0.0.0.0]
Jul 28 2025 22:09:56-08:00 R3 %%01OSPF/4/NBR_CHANGE_E(l)[0]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=7680, NeighborAddress=1.1.168.192, Neigh
borEvent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init)
[R3-ospf-30-area-0.0.0.0]q
[R3-ospf-30]q
[R3]dis ospf int g0/0/0
OSPF Process 30 with Router ID 192.168.1.3
Interfaces
Interface: 192.168.1.3 (GigabitEthernet0/0/0)
Cost: 1 State: DROther Type: Broadcast MTU: 1500
Priority: 1
Designated Router: 192.168.1.1
Backup Designated Router: 192.168.1.2
Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1
[R3]
Please check whether system data has been changed, and save data in time
下面是R4
The device is running!
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sy R4
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip addr 192.168.1.4 24
Jul 28 2025 21:56:43-08:00 R4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R4-GigabitEthernet0/0/0]q
[R4]int g0/0/1
[R4-GigabitEthernet0/0/1]ip addr 45.1.1.4 24
Jul 28 2025 22:00:25-08:00 R4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R4-GigabitEthernet0/0/1]
[R4-GigabitEthernet0/0/1]osp
[R4-GigabitEthernet0/0/1]ospf en
[R4-GigabitEthernet0/0/1]ospf enable 40 ar
[R4-GigabitEthernet0/0/1]ospf enable 40 area 0
[R4-GigabitEthernet0/0/1]q
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ospf enable 40 area 0
[R4-GigabitEthernet0/0/0]q
[R4]dis ospf int g0/0/0
OSPF is not active on the interface.
[R4]
[R4]dis
[R4]display ospf in
[R4]display ospf interface g0/0/0
OSPF is not active on the interface.
[R4]osf
[R4]ospf 40
[R4-ospf-40]a 0
[R4-ospf-40-area-0.0.0.0]
Jul 28 2025 22:09:15-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[2]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=10240, NeighborAddress=2.1.168.192, Neig
hborEvent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init)
[R4-ospf-40-area-0.0.0.0]
Jul 28 2025 22:09:15-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[6]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=10240, NeighborAddress=2.1.168.192, Neig
hborEvent=ExchangeDone, NeighborPreviousState=Exchange, NeighborCurrentState=Loa
ding)
[R4-ospf-40-area-0.0.0.0]
Jul 28 2025 22:09:15-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[7]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=10240, NeighborAddress=2.1.168.192, Neig
hborEvent=LoadingDone, NeighborPreviousState=Loading, NeighborCurrentState=Full)
[R4-ospf-40-area-0.0.0.0]q
[R4-ospf-40]
Jul 28 2025 22:09:19-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[8]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=10240, NeighborAddress=1.1.168.192, Neig
hborEvent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init)
[R4-ospf-40]
Jul 28 2025 22:09:19-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[9]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=10240, NeighborAddress=1.1.168.192, Neig
hborEvent=2WayReceived, NeighborPreviousState=Init, NeighborCurrentState=2Way)
[R4-ospf-40]
Jul 28 2025 22:09:19-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[10]:Neighbor changes ev
ent: neighbor status changed. (ProcessId=10240, NeighborAddress=1.1.168.192, Nei
ghborEvent=AdjOk?, NeighborPreviousState=2Way, NeighborCurrentState=ExStart)
[
[R4-ospf-40]
Jul 28 2025 22:10:05-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[15]:Neighbor changes ev
ent: neighbor status changed. (ProcessId=10240, NeighborAddress=3.1.168.192, Nei
ghborEvent=2WayReceived, NeighborPreviousState=Init, NeighborCurrentState=2Way)
[R4-ospf-40]
Jul 28 2025 22:10:05-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[16]:Neighbor changes ev
ent: neighbor status changed. (ProcessId=10240, NeighborAddress=3.1.168.192, Nei
ghborEvent=AdjOk?, NeighborPreviousState=2Way, NeighborCurrentState=2Way)
[R4-ospf-40]q
[R4]display ospf interface g0/0/0
OSPF Process 40 with Router ID 192.168.1.4
Interfaces
Interface: 192.168.1.4 (GigabitEthernet0/0/0)
Cost: 1 State: DROther Type: Broadcast MTU: 1500
Priority: 1
Designated Router: 192.168.1.1
Backup Designated Router: 192.168.1.2
Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1
[R4]
Jul 28 2025 22:14:26-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[17]:Neighbor changes ev
ent: neighbor status changed. (ProcessId=10240, NeighborAddress=5.1.1.45, Neighb
orEvent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init)
[R4]
Jul 28 2025 22:14:34-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[18]:Neighbor changes ev
ent: neighbor status changed. (ProcessId=10240, NeighborAddress=5.1.1.45, Neighb
orEvent=2WayReceived, NeighborPreviousState=Init, NeighborCurrentState=ExStart)
[R4]
Jul 28 2025 22:14:34-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[19]:Neighbor changes ev
ent: neighbor status changed. (ProcessId=10240, NeighborAddress=5.1.1.45, Neighb
orEvent=NegotiationDone, NeighborPreviousState=ExStart, NeighborCurrentState=Exc
hange)
Please check whether system data has been changed, and save data in time
Configuration console time out, please press any key to log on
<R4>
<R4>sy
Enter system view, return user view with Ctrl+Z.
[R4]dis ospf int g0/0/1
OSPF Process 40 with Router ID 192.168.1.4
Interfaces
Interface: 45.1.1.4 (GigabitEthernet0/0/1)
Cost: 1 State: DR Type: Broadcast MTU: 1500
Priority: 1
Designated Router: 45.1.1.4
Backup Designated Router: 45.1.1.5
Timers: Hello 10 , Dead 40 , Poll 120 , Retransmit 5 , Transmit Delay 1
[R4]ping 123.1.2.3
PING 123.1.2.3: 56 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
Request time out
--- 123.1.2.3 ping statistics ---
5 packet(s) transmitted
0 packet(s) received
100.00% packet loss
下面是R5的
The device is running!
############################################
<Huawei>sy
Jul 28 2025 22:21:15-08:00 Huawei %%01IFPDT/4/IF_STATE(l)[0]:Interface GigabitEt
hernet0/0/0 has turned into UP state.
<Huawei>sysy R5
^
Error: Unrecognized command found at '^' position.
<Huawei>osp
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sy R5
[R5]ospf 50
[R5-ospf-50]a 0
[R5-ospf-50-area-0.0.0.0]q
[R5-ospf-50]q
[R5]int g0/0/0
[R5-GigabitEthernet0/0/0]ip add
[R5-GigabitEthernet0/0/0]ip address 45.1.1.5 24
Jul 28 2025 22:22:30-08:00 R5 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R5-GigabitEthernet0/0/0]osp
[R5-GigabitEthernet0/0/0]ospf en
[R5-GigabitEthernet0/0/0]ospf enable 50 a
[R5-GigabitEthernet0/0/0]ospf enable 50 area 0
[R5-GigabitEthernet0/0/0]
Jul 28 2025 22:23:15-08:00 R5 %%01OSPF/4/NBR_CHANGE_E(l)[2]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=12800, NeighborAddress=4.1.1.45, Neighbo
rEvent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init)
[R5-GigabitEthernet0/0/0]
Jul 28 2025 22:23:15-08:00 R5 %%01OSPF/4/NBR_CHANGE_E(l)[3]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=12800, NeighborAddress=4.1.1.45, Neighbo
rEvent=2WayReceived, NeighborPreviousState=Init, NeighborCurrentState=2Way)
[R5-GigabitEthernet0/0/0]
Jul 28 2025 22:23:15-08:00 R5 %%01OSPF/4/NBR_CHANGE_E(l)[4]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=12800, NeighborAddress=4.1.1.45, Neighbo
rEvent=AdjOk?, NeighborPreviousState=2Way, NeighborCurrentState=ExStart)
[R5-GigabitEthernet0/0/0]
Jul 28 2025 22:23:15-08:00 R5 %%01OSPF/4/NBR_CHANGE_E(l)[5]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=12800, NeighborAddress=4.1.1.45, Neighbo
rEvent=NegotiationDone, NeighborPreviousState=ExStart, NeighborCurrentState=Exch
ange)
[R5-GigabitEthernet0/0/0]
Jul 28 2025 22:23:15-08:00 R5 %%01OSPF/4/NBR_CHANGE_E(l)[6]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=12800, NeighborAddress=4.1.1.45, Neighbo
rEvent=ExchangeDone, NeighborPreviousState=Exchange, NeighborCurrentState=Loadin
g)
[R5-GigabitEthernet0/0/0]
Jul 28 2025 22:23:15-08:00 R5 %%01OSPF/4/NBR_CHANGE_E(l)[7]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=12800, NeighborAddress=4.1.1.45, Neighbo
rEvent=LoadingDone, NeighborPreviousState=Loading, NeighborCurrentState=Full)
[R5-GigabitEthernet0/0/0]q
[R5]q
<R5>int b
<R5>int l
<R5>sy
Enter system view, return user view with Ctrl+Z.
[R5]int l
[R5]int LoopBack 0
[R5-LoopBack0]ip add
[R5-LoopBack0]ip address 123.1.2.3. 24
^
Error: Wrong parameter found at '^' position.
[R5-LoopBack0]ip address 123.1.2.3 24
[R5-LoopBack0]ospf enable 50 ar
[R5-LoopBack0]ospf enable 50 area 0
[R5]dis ospf peer
OSPF Process 50 with Router ID 45.1.1.5
Neighbors
Area 0.0.0.0 interface 45.1.1.5(GigabitEthernet0/0/0)'s neighbors
Router ID: 192.168.1.4 Address: 45.1.1.4
State: Full Mode:Nbr is Master Priority: 1
DR: 45.1.1.4 BDR: 45.1.1.5 MTU: 0
Dead timer due in 40 sec
Retrans timer interval: 5
Neighbor is up for 00:28:22
Authentication Sequence: [ 0 ]
环回接口配置:
interface LoopBack 0 进入环回地址接口
ip address 192.168.1.1 24 配置环回口IP地
最初ping 不到123.1.2.3环回端口是因为没有在环回端口下宣告,