OSPF的配置练习

       

思路:分析需求

要求1.首先R4有给定的换回路由,其他的环回路由和骨干链路的都需要配置在192.168.1.0/24网段 。

要求2:给定区域OSPF,R3的环回需在area0内

要求3:area0区域内无BDR,有且仅有R3为DR

要求4:R4的环回不能宣告,全网可达

解:

第一步:划分网段

三个环回接口+两个骨干链路   ---  5     //至少需要5个网段

2^n-2>5   ---- n至少为3    //借3位

192.168.1.0  /24+3

192.168.1.0/27    --- 骨干链路

        此时R3-R4需要两个地址    --- /30      192.168.1.0 /30

           而R1-R3需要三个地址     ---/29       192.168.1.8/29

192.168.1.32/27  ---R1的环回接口

        192.168.1.33/27        

192.168.1.64/27  ---R2的环回接口

        192.168.1.65/27

192.168.1.96/27 ----R3的环回接口

        192.168.1.97/27

开始配置R1-R4的接口和环回地址

//R1
[R1-GigabitEthernet0/0/0]ip address  192.168.1.9 29
Nov 15 2021 23:50:13-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R1]interface   l 0
[R1-LoopBack0]ip a	
[R1-LoopBack0]ip address   192.168.1.33  27
[R1-LoopBack0]q

//R2
[R2-GigabitEthernet0/0/0]ip address  192.168.1.10  29
Nov 15 2021 23:50:38-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R2]int	
[R2]interface    l 0
[R2-LoopBack0]ip a	
[R2-LoopBack0]ip address   192.168.1.65  27
[R2-LoopBack0]q

//R3
[R3-GigabitEthernet0/0/0]ip address  192.168.1.11  29
Nov 15 2021 23:51:06-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R3-GigabitEthernet0/0/0]int	
[R3-GigabitEthernet0/0/0]int  g0/0/1
[R3-GigabitEthernet0/0/1]ip  address  192.168.1.2  30
Nov 15 2021 23:51:36-08:00 R3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[R3-GigabitEthernet0/0/1]q
[R3]int	
[R3]interface   l 0
[R3-LoopBack0]ip	
[R3-LoopBack0]ip a	
[R3-LoopBack0]ip address   192.168.1.97  27
[R3-LoopBack0]q

//R4
[R4-GigabitEthernet0/0/0]ip address  192.168.1.1  30
Nov 15 2021 23:50:38-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R2]int	
[R2]interface    l 0
[R2-LoopBack0]ip a	
[R2-LoopBack0]ip address   4.4.4.1   24
[R2-LoopBack0]q

经过检查,没有配置错误,现在开始配置OSPF协议

//R1
[R1]os 
[R1]ospf  1  
[R1]ospf  1  r 
[R1]ospf  1  router-id  1.1.1.1
[R1-ospf-1]area  0
[R1-ospf-1-area-0.0.0.0]net 
[R1-ospf-1-area-0.0.0.0]network   192.168.1.33 0.0.0.255
[R1-ospf-1-area-0.0.0.0]ne 
[R1-ospf-1-area-0.0.0.0]network  192.168.1.9  0.0.0.0

//R2
[R2]
[R2]oss 
[R2]osp 
[R2]ospf  1 r 
[R2]ospf  1 router-id  2.2.2.2
[R2-ospf-1]area 
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]ne 
[R2-ospf-1-area-0.0.0.0]network  192.168.1.10  0.0.0.255

//R3
[R3]
[R3]os 
[R3]ospf  1 r  
[R3]ospf  1 router-id  3.3.3.3
[R3-ospf-1]ara 
[R3-ospf-1]are 
[R3-ospf-1]area  1
[R3-ospf-1-area-0.0.0.1]net 
[R3-ospf-1-area-0.0.0.1]network   192.168.1.2  0.0.0.0
//另一个区域
[R3]ospf 1  r 
[R3]ospf 1  router-id  3.3.3.3
[R3-ospf-1]ar 
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]netw 
[R3-ospf-1-area-0.0.0.0]network 192.168.1.97  0.0.0.255

//R4
[R4]ospf  1 router-id   4.4.4.4
Info: The configuration succeeded. You need to restart the OSPF process to valid
ate the new router ID.
[R4-ospf-1]ar 
[R4-ospf-1]area  1
[R4-ospf-1-area-0.0.0.1]netw 
[R4-ospf-1-area-0.0.0.1]network   192.168.1.1  0.0.0.0

 此时没有检查OSPF表,除了R4的4.4.4.0 /24没有宣告地址无法ping通

//R1
[R1]display   ospf  peer  

	 OSPF Process 1 with Router ID 1.1.1.1
		 Neighbors 

 Area 0.0.0.0 interface 192.168.1.9(GigabitEthernet0/0/0)'s neighbors
 Router ID: 2.2.2.2          Address: 192.168.1.10    
   State: Full  Mode:Nbr is  Master  Priority: 1
   DR: 192.168.1.10  BDR: 192.168.1.11  MTU: 0    
   Dead timer due in 37  sec 
   Retrans timer interval: 4 
   Neighbor is up for 00:00:49     
   Authentication Sequence: [ 0 ] 

 Router ID: 3.3.3.3          Address: 192.168.1.11    
   State: Full  Mode:Nbr is  Master  Priority: 1
   DR: 192.168.1.10  BDR: 192.168.1.11  MTU: 0    
   Dead timer due in 30  sec 
   Retrans timer interval: 5 
   Neighbor is up for 00:00:43     
   Authentication Sequence: [ 0 ] 

//R2和R3同理
[R2]display   ospf  peer

	 OSPF Process 1 with Router ID 2.2.2.2
		 Neighbors 

 Area 0.0.0.0 interface 192.168.1.10(GigabitEthernet0/0/0)'s neighbors
 Router ID: 1.1.1.1          Address: 192.168.1.9     
   State: Full  Mode:Nbr is  Slave  Priority: 1
   DR: 192.168.1.9  BDR: 192.168.1.10  MTU: 0    
   Dead timer due in 40  sec 
   Retrans timer interval: 0 
   Neighbor is up for 00:03:48     
   Authentication Sequence: [ 0 ] 

 Router ID: 3.3.3.3          Address: 192.168.1.11    
   State: Full  Mode:Nbr is  Master  Priority: 1
   DR: 192.168.1.9  BDR: 192.168.1.10  MTU: 0    
   Dead timer due in 31  sec 
   Retrans timer interval: 4 
   Neighbor is up for 00:01:12     
   Authentication Sequence: [ 0 ] 

//R4
<R4>display   ospf   peer  

	 OSPF Process 1 with Router ID 4.4.4.4
		 Neighbors 

 Area 0.0.0.1 interface 192.168.1.1(GigabitEthernet0/0/0)'s neighbors
 Router ID: 3.3.3.3          Address: 192.168.1.2     
   State: Full  Mode:Nbr is  Slave  Priority: 1
   DR: 192.168.1.1  BDR: 192.168.1.2  MTU: 0    
   Dead timer due in 33  sec 
   Retrans timer interval: 5 
   Neighbor is up for 00:31:53     
   Authentication Sequence: [ 0 ] 

开始配置area0的BR和BDR

//R1
[R1]int	
[R1]interface g0/0/0
[R1-GigabitEthernet0/0/0]os	
[R1-GigabitEthernet0/0/0]ospf d	
[R1-GigabitEthernet0/0/0]ospf dr-priority  ?
  INTEGER<0-255>  Router priority value
[R1-GigabitEthernet0/0/0]ospf dr-priority  0

//R2
[R2]int	
[R2]interface  g0/0/0
[R2-GigabitEthernet0/0/0]os	
[R2-GigabitEthernet0/0/0]ospf  d	
[R2-GigabitEthernet0/0/0]ospf  dr-priority  0

此时再次查看area表内的内容 

[R3]display   ospf  peer  

	 OSPF Process 1 with Router ID 3.3.3.3
		 Neighbors 

 Area 0.0.0.0 interface 192.168.1.11(GigabitEthernet0/0/0)'s neighbors
 Router ID: 1.1.1.1          Address: 192.168.1.9     
   State: Full  Mode:Nbr is  Slave  Priority: 0
   DR: 192.168.1.11  BDR: None   MTU: 0    
   Dead timer due in 30  sec 
   Retrans timer interval: 5 
   Neighbor is up for 00:00:57     
   Authentication Sequence: [ 0 ] 

 Router ID: 2.2.2.2          Address: 192.168.1.10    
   State: Full  Mode:Nbr is  Slave  Priority: 0
   DR: 192.168.1.11  BDR: None   MTU: 0    
   Dead timer due in 36  sec 
   Retrans timer interval: 4 
   Neighbor is up for 00:00:29     
   Authentication Sequence: [ 0 ] 

		 Neighbors 

 Area 0.0.0.1 interface 192.168.1.2(GigabitEthernet0/0/1)'s neighbors
 Router ID: 4.4.4.4          Address: 192.168.1.1     
   State: Full  Mode:Nbr is  Master  Priority: 1
   DR: 192.168.1.1  BDR: 192.168.1.2  MTU: 0    
   Dead timer due in 32  sec 
   Retrans timer interval: 5 
   Neighbor is up for 00:05:46     
   Authentication Sequence: [ 0 ] 

此时已经没有BDR,只有BR

尝试ping联通

[R3]ping 192.168.1.1
  PING 192.168.1.1: 56  data bytes, press CTRL_C to break
    Reply from 192.168.1.1: bytes=56 Sequence=1 ttl=255 time=30 ms
    Reply from 192.168.1.1: bytes=56 Sequence=2 ttl=255 time=30 ms
    Reply from 192.168.1.1: bytes=56 Sequence=3 ttl=255 time=20 ms
    Reply from 192.168.1.1: bytes=56 Sequence=4 ttl=255 time=30 ms
    Reply from 192.168.1.1: bytes=56 Sequence=5 ttl=255 time=30 ms

  --- 192.168.1.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 20/28/30 ms

结束

おすすめ

転載: blog.csdn.net/qq_44685426/article/details/121346818