Huawei Datacom HCIA Practice - OSPF Single Area Configuration

insert image description here

background

You are the network administrator for your company. Now the company network needs to use the OSPF protocol to transfer routing information. All routers in the planned network belong to OSPF area 0. In actual use, a default route needs to be advertised to OSPF. In addition, you also hope to understand the mechanism of DR/BDR election through this deployment.

step

Step 1 Basic configuration and IP compilation

Configure the corresponding device name and IP address

/*这里以配置R1为例 R2、R3与R1配置相差不大*/
[Huawei]sys
[Huawei]sysname R1
[R1]ip add 10.0.1.1 24

Step 2 Configure OSPF

Set the Router ID of R1 to 10.0.1.1 (the address of logical interface Loopback 0), enable OSPF process 1 (the default process), and set the network segments 10.0.1.0/24, 10.0.12.0/24, and 10.0.13.0/24 Advertise to OSPF area 0.

/*R1*/
[R1]ospf1 router-id 10.0.1.1 //启用ospf并将Router ID配置为10.0.1.1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 10.0.12.1 0.0.0.0 //宣告接口网段
[R1-ospf-1-area-0.0.0.0]network 10.0.13.1 0.0.0.0 //宣告接口网段
[R1-ospf-1-area-0.0.0.0]network 10.0.1.1 0.0.0.0 //宣告接口网段
*注意:同一个路由器可以开启多个OSPF进程,默认进程号为1,由于进程号
只具有本地意义,所以同一路由域的不同路由器可以使用相同或不同的OSPF
进程号。另外network命令后面需使用反掩码。

Set the Router ID of R2 to 10.0.2.2, enable OSPF process 1, and advertise network segments 10.0.12.0/24 and 10.0.2.0/24 to OSPF area 0.

[R2]ospf 1 router-id 10.0.2.2 //启用ospf并将router id配置为10.0.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 10.0.12.2 0.0.0.0 //宣告接口网段
[R2-ospf-1-area-0.0.0.0]network 10.0.2.2 0.0.0.0 //宣告接口网段

Step 3 Verify OSPF configuration

After OSPF convergence is complete, check the routing tables on R1, R2, and R3:
display ip routing-table
insert image description here
display ip routing-table
insert image description here
display ip routing-table
insert image description here

Step 4 Modify OSPF hello and dead time parameters

Run the display ospf interface GigabitEthernet 0/0/0 command on R1 to check the default OSPF hello and dead times.

<R1>display ospf interface GigabitEthernet 0/0/0

insert image description here
Run the ospf timer command on GE0/0/0 of R1 to change the OSPF hello and dead times to 15 seconds and 60 seconds, respectively.

[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ospf timer hello 15 //修改hello时间为15s
[R1-GigabitEthernet0/0/0]ospf timer dead 60 //修改dead时间为60s
<R1>display ospf interface GigabitEthernet 0/0/0//重新查看ospf的hello和dead时间


Check the OSPF neighbor status display ospf peer brief on R1.
insert image description here
Many people may think: Why does R1 only have neighbors with R2 and does not establish a neighbor relationship with R3? How can R1 and R3 also establish a neighbor relationship?
Because the OSPF hello and dead times of R1 have just been modified, the values ​​of OSPF hello and dead times on R1 and R3 are different, so R1 cannot establish a neighbor relationship with R3. If R1 and R3 want to establish a neighbor relationship, they must modify the OSPF hello and dead time parameters of R3 to 15 and 60 respectively.
Screenshot after establishing neighbor relationship:
insert image description here

Step 5 Control the election of OSPF DR/BDR

Run the display ospf peer command to check how the DR/BDR roles of R1 and R3
insert image description here
insert image description here
are elected. If you want to make another router the DR, how can you modify it?
It is not difficult to see that AR3 in the figure above is the DR, and the DR election rules are as follows:

  1. Check the DR priority, the bigger the better.
  2. If the priorities are the same, compare the router IDs of the devices, and the greater the priority, the better.
    If you want another router to be the DR, you can run the ospf dr-priority command in the interface view to manually change the DR priority.

Guess you like

Origin blog.csdn.net/dbqwcl/article/details/121431132