华为链路状态型路由协议(OSPF)之多区域的配置

华为链路状态型路由协议(OSPF)之多区域的配置
华为链路状态型路由协议(OSPF)之多区域的配置(1)

路由器的OSPF配置

[R1]display current-configuration configuration ospf 
[V200R003C00]
#
ospf 10 router-id 1.1.1.1 
 area 0.0.0.0 
  network 1.1.1.1 0.0.0.0 
  network 172.16.1.1 0.0.0.0 
#
return
<R2>system-view 
Enter system view, return user view with Ctrl+Z.
[R2]display current-configuration configuration ospf
[V200R003C00]
#
ospf 20 router-id 2.2.2.2 
 area 0.0.0.0 
  network 2.2.2.2 0.0.0.0 
  network 172.16.1.2 0.0.0.0 
 area 0.0.0.1 
  network 172.16.2.1 0.0.0.0 
#
return
[R3]display current-configuration configuration ospf
[V200R003C00]
#
ospf 30 router-id 3.3.3.3 
 area 0.0.0.1 
  network 3.3.3.3 0.0.0.0 
  network 172.16.2.2 0.0.0.0 
 area 172.16.10.0 
  network 172.16.10.1 0.0.0.0 
#
return
[R4]display current-configuration configuration ospf
[V200R003C00]
#
ospf 40 router-id 4.4.4.4 
 area 172.16.10.0 
  network 4.4.4.4 0.0.0.0 
  network 172.16.10.2 0.0.0.0 
#
return

查看R3的OSPF邻居

[R3]display ospf peer

	 OSPF Process 30 with Router ID 3.3.3.3
		 Neighbors 

 Area 0.0.0.1 interface 172.16.2.2(GigabitEthernet0/0/0)'s neighbors
 Router ID: 2.2.2.2          Address: 172.16.2.1      
   State: Full  Mode:Nbr is  Slave  Priority: 1
   DR: 172.16.2.2  BDR: 172.16.2.1  MTU: 0    
   Dead timer due in 37  sec 
   Retrans timer interval: 5 
   Neighbor is up for 00:17:27     
   Authentication Sequence: [ 0 ] 

		 Neighbors 

 Area 172.16.10.0 interface 172.16.10.1(GigabitEthernet0/0/1)'s neighbors
 Router ID: 4.4.4.4          Address: 172.16.10.2     
   State: Full  Mode:Nbr is  Master  Priority: 1
   DR: 172.16.10.2  BDR: 172.16.10.1  MTU: 0    
   Dead timer due in 31  sec 
   Retrans timer interval: 5 
   Neighbor is up for 00:13:15     
   Authentication Sequence: [ 0 ] 

可以看到有两个邻居,分别通过接口G0/0/1在区域172.16.10.0 ;G0/0/1在区域1中形成了邻居。

R3查看OSPF路由

[R3]display ospf routing 

	 OSPF Process 30 with Router ID 3.3.3.3
		  Routing Tables 

 Routing for Network 
 Destination        Cost  Type       NextHop         AdvRouter       Area
 3.3.3.3/32         0     Stub       3.3.3.3         3.3.3.3         0.0.0.1
 172.16.2.0/30      1     Transit    172.16.2.2      3.3.3.3         0.0.0.1
 172.16.10.0/30     1     Transit    172.16.10.1     3.3.3.3         172.16.10.0
 1.1.1.1/32         2     Inter-area 172.16.2.1      2.2.2.2         0.0.0.1
 2.2.2.2/32         1     Inter-area 172.16.2.1      2.2.2.2         0.0.0.1
 4.4.4.4/32         1     Stub       172.16.10.2     4.4.4.4         172.16.10.0
 172.16.1.0/30      2     Inter-area 172.16.2.1      2.2.2.2         0.0.0.1

 Total Nets: 7  
 Intra Area: 4  Inter Area: 3  ASE: 0  NSSA: 0 

[R3]

R3学习到了所有OSPF路由,因为没有配置虚链路,R4没有学习到路由。

R4查看OSPF路由

[R4]display ospf routing 

	 OSPF Process 40 with Router ID 4.4.4.4
		  Routing Tables 

 Routing for Network 
 Destination        Cost  Type       NextHop         AdvRouter       Area
 4.4.4.4/32         0     Stub       4.4.4.4         4.4.4.4         172.16.10.0
 172.16.10.0/30     1     Transit    172.16.10.2     4.4.4.4         172.16.10.0

 Total Nets: 2  
 Intra Area: 2  Inter Area: 0  ASE: 0  NSSA: 0 

[R4]

这两条路由自己通告的,并没有学习到这个OSPF网络中的其他路由。

R1查看OSPF路由

[R1]display ospf routing 

	 OSPF Process 10 with Router ID 1.1.1.1
		  Routing Tables 

 Routing for Network 
 Destination        Cost  Type       NextHop         AdvRouter       Area
 1.1.1.1/32         0     Stub       1.1.1.1         1.1.1.1         0.0.0.0
 172.16.1.0/30      1     Transit    172.16.1.1      1.1.1.1         0.0.0.0
 2.2.2.2/32         1     Stub       172.16.1.2      2.2.2.2         0.0.0.0
 3.3.3.3/32         2     Inter-area 172.16.1.2      2.2.2.2         0.0.0.0
 172.16.2.0/30      2     Inter-area 172.16.1.2      2.2.2.2         0.0.0.0

 Total Nets: 5  
 Intra Area: 3  Inter Area: 2  ASE: 0  NSSA: 0 

[R1]

R1除了区域0,还学习到了两条区域之间的路由,但没有学习到区域172.16.10.0的路由,所以需要在R2、R3上补全OSPF虚链路。

配置OSPF虚链路

[R2]ospf 20
[R2-ospf-20]area 1
[R2-ospf-20-area-0.0.0.1]vlink-peer 3.3.3.3
[R2-ospf-20-area-0.0.0.1]quit
[R3]ospf 30
[R3-ospf-30]area 1
[R3-ospf-30-area-0.0.0.1]vlink-peer 2.2.2.2
[R3-ospf-30-area-0.0.0.1]quit

R3上查看虚链路

[R3]display ospf vlink 

	 OSPF Process 30 with Router ID 3.3.3.3
		 Virtual Links 

 **Virtual-link Neighbor-id  -> 2.2.2.2, Neighbor-State: Full**

 Interface: 172.16.2.2 (GigabitEthernet0/0/0)
 Cost: 1  State: P-2-P  Type: Virtual 
 Transit Area: 0.0.0.1 
 Timers: Hello 10 , Dead 40 , Retransmit 5 , Transmit Delay 1 
 GR State: Normal 
 
[R3]

字体加粗部分看到,R3上已经和2.2.2.2形成了虚链路,建立了完全邻居

R4上查看路由

[R4]display ospf routing 

	 OSPF Process 40 with Router ID 4.4.4.4
		  Routing Tables 

 Routing for Network 
 Destination        Cost  Type       NextHop         AdvRouter       Area
 4.4.4.4/32         0     Stub       4.4.4.4         4.4.4.4         172.16.10.0
 172.16.10.0/30     1     Transit    172.16.10.2     4.4.4.4         172.16.10.0
 1.1.1.1/32         3     Inter-area 172.16.10.1     3.3.3.3         172.16.10.0
 2.2.2.2/32         2     Inter-area 172.16.10.1     3.3.3.3         172.16.10.0
 3.3.3.3/32         1     Inter-area 172.16.10.1     3.3.3.3         172.16.10.0
 172.16.1.0/30      3     Inter-area 172.16.10.1     3.3.3.3         172.16.10.0
 172.16.2.0/30      2     Inter-area 172.16.10.1     3.3.3.3         172.16.10.0

 Total Nets: 7  
 Intra Area: 2  Inter Area: 5  ASE: 0  NSSA: 0 

现在R4已经学习到了OSPF网络中的路由。

发布了27 篇原创文章 · 获赞 3 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/weixin_46192300/article/details/104133569