OSPF router-id, and OSPF basic configuration commands

4.2.4 Routing OSPF (OSPF router-id, OSPF basic configuration)

During the establishment of an OSPF neighbor, an OSPF routing device is identified by its router-id. If the router-id is the same, it is regarded as a routing device. Therefore, an OSPF neighbor cannot be established successfully.

global router-id

  • By default, after a Huawei router is started, it will automatically generate a global Router-id.

  • The global router-id uses the first IP address configured on the device by default.

You can view the global router-id of the device through display router id:

<AR4>display router id 
RouterID:10.1.45.4

The global routing ID can be modified by router id 1.1.1.1

[AR4]router id 1.1.1.1
Info: Router ID has been modified, please reset the relative protocols manually 
to update the Router ID.

[AR4]display router id
RouterID:1.1.1.1

OSPF router-id

By default, ospf 1the router-id created by OSPF is the global router-id.

Of course, it is also possible to manually specify the router-id of ospf:ospf 1 router-id 1.1.1.1

At the same time, it is recommended to configure the OSPF router-id manually.


OSPF basic configuration

Please add a picture description

AR1
<Huawei>sys
[Huawei]sys AR1
# 取消配置回馈信息
[AR1]un in en

[AR1]int g0/0/0
[AR1-GigabitEthernet0/0/0]ip add 10.1.12.1 24
# 配置OSPF
[AR1-GigabitEthernet0/0/0]ospf 1 router 1.1.1.1
[AR1-ospf-1]a 1
[AR1-ospf-1-area-0.0.0.1]network 10.1.12.1 0.0.0.0
AR2
<Huawei>sys
[Huawei]sys AR2
# 取消配置回馈信息
[AR2]un in en

[AR2]int g0/0/0
[AR2-GigabitEthernet0/0/0]ip add 10.1.23.2 24
[AR2-GigabitEthernet0/0/0]int g0/0/1
[AR2-GigabitEthernet0/0/1]ip add 10.1.12.2 24

# 配置OSPF
[AR2-GigabitEthernet0/0/1]ospf 1 router 2.2.2.2
[AR2-ospf-1]a 1
[AR2-ospf-1-area-0.0.0.1]network 10.1.12.2 0.0.0.0
[AR2-ospf-1-area-0.0.0.1]a 0
[AR2-ospf-1-area-0.0.0.0]network 10.1.23.2 0.0.0.0
AR3
<Huawei>sys
[Huawei]sys AR3
[AR3]un in en

[AR3]int g0/0/0
[AR3-GigabitEthernet0/0/0]ip add 10.1.23.3 24
[AR3-GigabitEthernet0/0/0]int g0/0/1
[AR3-GigabitEthernet0/0/1]ip add 10.1.34.3 24

# 配置OSPF
[AR3-GigabitEthernet0/0/1]ospf 1 router 3.3.3.3
[AR3-ospf-1]a 0
[AR3-ospf-1-area-0.0.0.0]network 10.1.23.3 0.0.0.0
[AR3-ospf-1-area-0.0.0.0]a 2
[AR3-ospf-1-area-0.0.0.1]network 10.1.34.3 0.0.0.0
AR4
<Huawei>sys
[Huawei]sys AR4
[AR4]un in en

[AR4]int g0/0/0
[AR4-GigabitEthernet0/0/0]ip ad 10.1.34.4 24

# 配置OSPF
[AR4-GigabitEthernet0/0/0]ospf 1 router 4.4.4.4
[AR4-ospf-1]a 2
[AR4-ospf-1-area-0.0.0.2]network 10.1.34.4 0.0.0.0
Check whether the neighbor is established successfully

Use display ospf peer briefthe command to check whether the neighbor is established successfully. The State state in the echo content identifies the state machine of the link, and Full indicates that the adjacency relationship has been established successfully.

The successful establishment of the adjacency Full also indicates that the neighbor is successfully established.

<AR1>dis ospf pee br

	 OSPF Process 1 with Router ID 1.1.1.1
		  Peer Statistic Information
 ----------------------------------------------------------------------------
 Area Id          Interface                        Neighbor id      State    
 0.0.0.1          GigabitEthernet0/0/0             2.2.2.2          Full        
 ----------------------------------------------------------------------------
 
 <AR2>dis ospf pee br

	 OSPF Process 1 with Router ID 2.2.2.2
		  Peer Statistic Information
 ----------------------------------------------------------------------------
 Area Id          Interface                        Neighbor id      State    
 0.0.0.0          GigabitEthernet0/0/0             3.3.3.3          Full        
 0.0.0.1          GigabitEthernet0/0/1             1.1.1.1          Full        
 ----------------------------------------------------------------------------
 
<AR3>dis ospf pee brief

	 OSPF Process 1 with Router ID 3.3.3.3
		  Peer Statistic Information
 ----------------------------------------------------------------------------
 Area Id          Interface                        Neighbor id      State    
 0.0.0.0          GigabitEthernet0/0/0             2.2.2.2          Full        
 0.0.0.2          GigabitEthernet0/0/1             4.4.4.4          Full        
 ----------------------------------------------------------------------------
 
 <AR4>dis ospf pee br

	 OSPF Process 1 with Router ID 4.4.4.4
		  Peer Statistic Information
 ----------------------------------------------------------------------------
 Area Id          Interface                        Neighbor id      State    
 0.0.0.2          GigabitEthernet0/0/0             3.3.3.3          Full        
 ----------------------------------------------------------------------------
Look back at the above OSPF command for explanation:
# 启用OSPF,并手动指定router-id为4.4.4.4
ospf 1 router 4.4.4.4

# 配置区域0中的OSPF信息,全命令:area 0
a 0

# 指定启用OSPF功能的接口,启用了OSPF功能的接口才能进行发送OSPF报文并建立邻居、邻接关系。
network 10.1.34.4 0.0.0.0

In addition to network IP地址 0.0.0.0enabling OSPF on a specified interface, there are three other ways:

1. Precise announcement mode : that is network IP地址 0.0.0.0, this mode precisely specifies that only the interface with the IP address can send OSPF packets, and other interfaces that have not been announced will not be able to send OSPF packets.

This method is more secure. If OSPF is enabled on each interface, unnecessary troubles will be caused.

2. Relatively accurate declaration method : network 192.168.1.0 0.0.0.255, the method of declaring a network segment through the reverse mask. This method is relatively accurate because the scope of the declaration can be controlled through the reverse mask.

3. Inaccurate declaration method : network 192.168.0.0 0.0.255.255, which is similar to relative accuracy, but this method directly declares a very large range.

4. Interface announcement method : 接口模式下:ospf enable 1 area 0, enable OSPF function under the specified interface, and divide it into area 0 of OSPF process 1 , this method saves the specified IP address compared with precise announcement.
The advantage of the interface declaration method is that it can still be used after the interface address is changed , while other methods need to be updated more or less after the interface address is changed.

# 实操接口宣告方式,在AR4将之前使用精确宣告的方式删除,使用接口宣告
[AR4]ospf 1 
[AR4-ospf-1]a 2
[AR4-ospf-1-area-0.0.0.2]undo network 10.1.34.4 0.0.0.0
[AR4-ospf-1-area-0.0.0.2]q

# 此时邻接关系断开
[AR4-ospf-1]dis ospf pee br

	 OSPF Process 1 with Router ID 4.4.4.4
		  Peer Statistic Information
 ----------------------------------------------------------------------------
 Area Id          Interface                        Neighbor id      State    
 ----------------------------------------------------------------------------
 
 # 配置接口宣告
 [AR4-ospf-1]int g0/0/0
[AR4-GigabitEthernet0/0/0]ospf enable 1 area 2
[AR4-GigabitEthernet0/0/0]【Ctrl+Z 快速跳转到用户模式】
<AR4>dis ospf pee br

	 OSPF Process 1 with Router ID 4.4.4.4
		  Peer Statistic Information
 ----------------------------------------------------------------------------
 Area Id          Interface                        Neighbor id      State    
 0.0.0.2          GigabitEthernet0/0/0             3.3.3.3          Full        
 ----------------------------------------------------------------------------
 

Guess you like

Origin blog.csdn.net/qq_45443704/article/details/128534725