# R1 配置
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R1
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip address 192.168.1.1 24
[R1-GigabitEthernet0/0/0]q
[R1]
[R1]interface GigabitEthernet 0/0/1
[R1-GigabitEthernet0/0/1]ip address 192.168.2.1 24
[R1]ospf 1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[R1-ospf-1]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost Flags NextHop Interface
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
192.168.1.0/24 Direct 0 0 D 192.168.1.1 GigabitEthernet
0/0/0
192.168.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.2.0/24 Direct 0 0 D 192.168.2.1 GigabitEthernet
0/0/1
192.168.2.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.3.0/24 OSPF 10 2 D 192.168.2.2 GigabitEthernet
0/0/1
192.168.4.0/24 OSPF 10 3 D 192.168.2.2 GigabitEthernet
0/0/1
[R1-ospf-1]q
[R1]q
<R1>
<R1>save
The current configuration will be written to the device.
Are you sure to continue?[Y/N]y
Info: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]:
May 18 2021 21:48:54-08:00 R1 %%01CFM/4/SAVE(l)[8]:The user chose Y when decidin
g whether to save the configuration to the device.
Now saving the current configuration to the slot 17..
Save the configuration successfully.
<R1>
R2
# R2 OSPF 配置
[R2]ospf 1
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]q
[R2-ospf-1]display ospf interface # 查看ospf 通告
OSPF Process 1 with Router ID 192.168.2.2
Interfaces
Area: 0.0.0.0 (MPLS TE not enabled)
IP Address Type State Cost Pri DR BDR
192.168.2.2 Broadcast DR 1 1 192.168.2.2 192.168.2.1
192.168.3.1 Broadcast BDR 1 1 192.168.3.2 192.168.3.1
[R2-ospf-1]display ospf peer # 查看 ospf 邻居
OSPF Process 1 with Router ID 192.168.2.2
Neighbors
Area 0.0.0.0 interface 192.168.2.2(GigabitEthernet0/0/0)'s neighbors
Router ID: 192.168.1.1 Address: 192.168.2.1
State: Full Mode:Nbr is Slave Priority: 1
DR: 192.168.2.2 BDR: 192.168.2.1 MTU: 0
Dead timer due in 34 sec
Retrans timer interval: 5
Neighbor is up for 00:08:45
Authentication Sequence: [ 0 ]
Neighbors
Area 0.0.0.0 interface 192.168.3.1(GigabitEthernet0/0/1)'s neighbors
Router ID: 192.168.3.2 Address: 192.168.3.2
State: Full Mode:Nbr is Master Priority: 1
DR: 192.168.3.2 BDR: 192.168.3.1 MTU: 0
Dead timer due in 36 sec
Retrans timer interval: 5
Neighbor is up for 00:09:22
Authentication Sequence: [ 0 ]