OSPF(Open Shortest Path First),开放最短路径优先协议

image-20240918082434092

  • R1配置
<Huawei>system-view 
[Huawei]sysname R1 
[R1]int g 0/0/0 
[R1-GigabitEthernet0/0/0]ip add 192.168.1.254 24 
[R1-GigabitEthernet0/0/0]int g 0/0/1 
[R1-GigabitEthernet0/0/1]ip add 10.0.0.1 24 
[R1]ospf [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 10.0.0.0 0.0.0.255 
<R1>save
	The current configuration will be written to the device.   
	Are you sure to continue? (y/n)[n]:y
  • R2配置
<Huawei>system-view      
[Huawei]sysname R2 
[R2]int g 0/0/1 
[R2-GigabitEthernet0/0/1]ip add 10.0.0.2 24 
[R2-GigabitEthernet0/0/1]int g 0/0/0  
[R2-GigabitEthernet0/0/0]ip add 192.168.2.254 24 
[R2]ospf  
[R2-ospf-1]area 0 
[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]network 10.0.0.0 0.0.0.255 
<R2>save   
	The current configuration will be written to the device.   
	Are you sure to continue? (y/n)[n]:y