HCNA实验OSPF基础

1、拓扑图

方法:

1.配置接口IP

2.配置OSPF协议:
[R2]ospf 100
[R2-ospf-100]area 0
[R2-ospf-100-area-0.0.0.0]network 12.1.1.0 0.0.0.255
[R2-ospf-100-area-0.0.0.0]network 23.1.1.0 0.0.0.255	
[R2-ospf-100-area-0.0.0.0]quit 

 

2、R1配置

 1 The device is running!
 2 ####################
 3 <Huawei>
 4 Dec 11 2017 12:23:50-08:00 Huawei %%01IFPDT/4/IF_STATE(l)[0]:Interface GigabitEt
 5 hernet0/0/0 has turned into UP state.
 6 <Huawei>sys
 7 Enter system view, return user view with Ctrl+Z.
 8 [Huawei]sysn R1
 9 [R1]int    
10 [R1]interface g0/0/0
11 [R1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
12 Dec 11 2017 12:26:33-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
13 on the interface GigabitEthernet0/0/0 has entered the UP state. 
14 [R1-GigabitEthernet0/0/0]q
15 [R1]    
16 [R1]    
17 [R1]    
18 [R1]osfp 100
19     ^
20 Error: Unrecognized command found at '^' position.
21 [R1]os    
22 [R1]ospf 100
23 [R1-ospf-100]are    
24 [R1-ospf-100]area 0
25 [R1-ospf-100-area-0.0.0.0]net    
26 [R1-ospf-100-area-0.0.0.0]network 12.1.1.0 0.0.0.255
27 [R1-ospf-100-area-0.0.0.0]q
28 [R1-ospf-100]q
29 [R1]
30 Dec 11 2017 12:31:20-08:00 R1 %%01OSPF/4/NBR_CHANGE_E(l)[2]:Neighbor changes eve
31 nt: neighbor status changed. (ProcessId=25600, NeighborAddress=2.1.1.12, Neighbo
32 rEvent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init) 
33 [R1]
34 Dec 11 2017 12:31:24-08:00 R1 %%01OSPF/4/NBR_CHANGE_E(l)[3]:Neighbor changes eve
35 nt: neighbor status changed. (ProcessId=25600, NeighborAddress=2.1.1.12, Neighbo
36 rEvent=2WayReceived, NeighborPreviousState=Init, NeighborCurrentState=ExStart) 
37 [R1]
38 Dec 11 2017 12:31:24-08:00 R1 %%01OSPF/4/NBR_CHANGE_E(l)[4]:Neighbor changes eve
39 nt: neighbor status changed. (ProcessId=25600, NeighborAddress=2.1.1.12, Neighbo
40 rEvent=NegotiationDone, NeighborPreviousState=ExStart, NeighborCurrentState=Exch
41 ange) 
42 [R1]
43 Dec 11 2017 12:31:24-08:00 R1 %%01OSPF/4/NBR_CHANGE_E(l)[5]:Neighbor changes eve
44 nt: neighbor status changed. (ProcessId=25600, NeighborAddress=2.1.1.12, Neighbo
45 rEvent=ExchangeDone, NeighborPreviousState=Exchange, NeighborCurrentState=Loadin
46 g) 
47 [R1]
48 Dec 11 2017 12:31:24-08:00 R1 %%01OSPF/4/NBR_CHANGE_E(l)[6]:Neighbor changes eve
49 nt: neighbor status changed. (ProcessId=25600, NeighborAddress=2.1.1.12, Neighbo
50 rEvent=LoadingDone, NeighborPreviousState=Loading, NeighborCurrentState=Full) 
51 [R1]
52 
53   Please check whether system data has been changed, and save data in time
54 
55   Configuration console time out, please press any key to log on
View Code

 

3、R2配置

 1 The device is running!
 2 ######
 3 <Huawei>sys
 4 Enter system view, return user view with Ctrl+Z.
 5 [Huawei]sysn R2
 6 [R2]int    
 7 [R2]interface g0/0/0
 8 [R2-GigabitEthernet0/0/0]ip add 12.1.1.2 24
 9 Dec 11 2017 12:26:59-08:00 R2 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
10 on the interface GigabitEthernet0/0/0 has entered the UP state. 
11 [R2-GigabitEthernet0/0/0]
12 [R2-GigabitEthernet0/0/0]int    
13 [R2-GigabitEthernet0/0/0]int g0/0/1
14 [R2-GigabitEthernet0/0/1]ip add 23.1.1.2 24
15 Dec 11 2017 12:27:17-08:00 R2 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP 
16 on the interface GigabitEthernet0/0/1 has entered the UP state. 
17 [R2-GigabitEthernet0/0/1]q
18 [R2]osf    
19 [R2]osp    
20 [R2]ospf 100
21 [R2-ospf-100]are    
22 [R2-ospf-100]area 0
23 [R2-ospf-100-area-0.0.0.0]net    
24 [R2-ospf-100-area-0.0.0.0]network 12.1.1.0 0.0.0.255
25 [R2-ospf-100-area-0.0.0.0]
26 Dec 11 2017 12:31:21-08:00 R2 %%01OSPF/4/NBR_CHANGE_E(l)[4]:Neighbor changes eve
27 nt: neighbor status changed. (ProcessId=25600, NeighborAddress=1.1.1.12, Neighbo
28 rEvent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init) 
29 [R2-ospf-100-area-0.0.0.0]
30 Dec 11 2017 12:31:21-08:00 R2 %%01OSPF/4/NBR_CHANGE_E(l)[5]:Neighbor changes eve
31 nt: neighbor status changed. (ProcessId=25600, NeighborAddress=1.1.1.12, Neighbo
32 rEvent=2WayReceived, NeighborPreviousState=Init, NeighborCurrentState=2Way) 
33 [R2-ospf-100-area-0.0.0.0]
34 Dec 11 2017 12:31:21-08:00 R2 %%01OSPF/4/NBR_CHANGE_E(l)[6]:Neighbor changes eve
35 nt: neighbor status changed. (ProcessId=25600, NeighborAddress=1.1.1.12, Neighbo
36 rEvent=AdjOk?, NeighborPreviousState=2Way, NeighborCurrentState=ExStart) 
37 [R2-ospf-100-area-0.0.0.0]
38 Dec 11 2017 12:31:21-08:00 R2 %%01OSPF/4/NBR_CHANGE_E(l)[7]:Neighbor changes eve
39 nt: neighbor status changed. (ProcessId=25600, NeighborAddress=1.1.1.12, Neighbo
40 rEvent=NegotiationDone, NeighborPreviousState=ExStart, NeighborCurrentState=Exch
41 ange) 
42 [R2-ospf-100-area-0.0.0.0]
43 Dec 11 2017 12:31:21-08:00 R2 %%01OSPF/4/NBR_CHANGE_E(l)[8]:Neighbor changes eve
44 nt: neighbor status changed. (ProcessId=25600, NeighborAddress=1.1.1.12, Neighbo
45 rEvent=ExchangeDone, NeighborPreviousState=Exchange, NeighborCurrentState=Loadin
46 g) 
47 [R2-ospf-100-area-0.0.0.0]
48 Dec 11 2017 12:31:21-08:00 R2 %%01OSPF/4/NBR_CHANGE_E(l)[9]:Neighbor changes eve
49 nt: neighbor status changed. (ProcessId=25600, NeighborAddress=1.1.1.12, Neighbo
50 rEvent=LoadingDone, NeighborPreviousState=Loading, NeighborCurrentState=Full) 
51 [R2-ospf-100-area-0.0.0.0]
52 [R2-ospf-100-area-0.0.0.0]net    
53 [R2-ospf-100-area-0.0.0.0]network 23.1.1.0 0.0.0.255
54 [R2-ospf-100-area-0.0.0.0]q
55 [R2-ospf-100]q
56 [R2]
57 Dec 11 2017 12:33:13-08:00 R2 %%01OSPF/4/NBR_CHANGE_E(l)[10]:Neighbor changes ev
58 ent: neighbor status changed. (ProcessId=25600, NeighborAddress=3.1.1.23, Neighb
59 orEvent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init) 
60 [R2]
61 Dec 11 2017 12:33:18-08:00 R2 %%01OSPF/4/NBR_CHANGE_E(l)[11]:Neighbor changes ev
62 ent: neighbor status changed. (ProcessId=25600, NeighborAddress=3.1.1.23, Neighb
63 orEvent=2WayReceived, NeighborPreviousState=Init, NeighborCurrentState=ExStart) 
64 
65 [R2]
66 Dec 11 2017 12:33:18-08:00 R2 %%01OSPF/4/NBR_CHANGE_E(l)[12]:Neighbor changes ev
67 ent: neighbor status changed. (ProcessId=25600, NeighborAddress=3.1.1.23, Neighb
68 orEvent=NegotiationDone, NeighborPreviousState=ExStart, NeighborCurrentState=Exc
69 hange) 
70 [R2]
71 Dec 11 2017 12:33:18-08:00 R2 %%01OSPF/4/NBR_CHANGE_E(l)[13]:Neighbor changes ev
72 ent: neighbor status changed. (ProcessId=25600, NeighborAddress=3.1.1.23, Neighb
73 orEvent=ExchangeDone, NeighborPreviousState=Exchange, NeighborCurrentState=Loadi
74 ng) 
75 [R2]
76 Dec 11 2017 12:33:18-08:00 R2 %%01OSPF/4/NBR_CHANGE_E(l)[14]:Neighbor changes ev
77 ent: neighbor status changed. (ProcessId=25600, NeighborAddress=3.1.1.23, Neighb
78 orEvent=LoadingDone, NeighborPreviousState=Loading, NeighborCurrentState=Full) 
79 [R2]
View Code

 

 4、R3配置

The device is running!
######################
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname
                ^
Error:Incomplete command found at '^' position.
[Huawei]sysname R3
[R3]int    
[R3]interface g0/0/1
[R3-GigabitEthernet0/0/1]ip add 23.1.1.3 24
Dec 11 2017 12:27:53-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]os    
[R3]ospf 100
[R3-ospf-100]ar    
[R3-ospf-100]are    
[R3-ospf-100]area 0
[R3-ospf-100-area-0.0.0.0]net    
[R3-ospf-100-area-0.0.0.0]network 23.1.1.0 0.0.0.255
[R3-ospf-100-area-0.0.0.0]
Dec 11 2017 12:33:20-08:00 R3 %%01OSPF/4/NBR_CHANGE_E(l)[2]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=25600, NeighborAddress=2.1.1.23, Neighbo
rEvent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init) 
[R3-ospf-100-area-0.0.0.0]
Dec 11 2017 12:33:20-08:00 R3 %%01OSPF/4/NBR_CHANGE_E(l)[3]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=25600, NeighborAddress=2.1.1.23, Neighbo
rEvent=2WayReceived, NeighborPreviousState=Init, NeighborCurrentState=2Way) 
[R3-ospf-100-area-0.0.0.0]
Dec 11 2017 12:33:20-08:00 R3 %%01OSPF/4/NBR_CHANGE_E(l)[4]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=25600, NeighborAddress=2.1.1.23, Neighbo
rEvent=AdjOk?, NeighborPreviousState=2Way, NeighborCurrentState=ExStart) 
[R3-ospf-100-area-0.0.0.0]
Dec 11 2017 12:33:20-08:00 R3 %%01OSPF/4/NBR_CHANGE_E(l)[5]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=25600, NeighborAddress=2.1.1.23, Neighbo
rEvent=NegotiationDone, NeighborPreviousState=ExStart, NeighborCurrentState=Exch
ange) 
[R3-ospf-100-area-0.0.0.0]
Dec 11 2017 12:33:20-08:00 R3 %%01OSPF/4/NBR_CHANGE_E(l)[6]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=25600, NeighborAddress=2.1.1.23, Neighbo
rEvent=ExchangeDone, NeighborPreviousState=Exchange, NeighborCurrentState=Loadin
g) 
[R3-ospf-100-area-0.0.0.0]
Dec 11 2017 12:33:20-08:00 R3 %%01OSPF/4/NBR_CHANGE_E(l)[7]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=25600, NeighborAddress=2.1.1.23, Neighbo
rEvent=LoadingDone, NeighborPreviousState=Loading, NeighborCurrentState=Full) 
[R3-ospf-100-area-0.0.0.0]q
[R3-ospf-100]q
[R3]
View Code

 

 5、测试结果

R1

<R1>dis ospf peer 

     OSPF Process 100 with Router ID 12.1.1.1
         Neighbors

 Area 0.0.0.0 interface 12.1.1.1(GigabitEthernet0/0/0)'s neighbors
 Router ID: 12.1.1.2         Address: 12.1.1.2        
   State: Full  Mode:Nbr is  Master  Priority: 1
   DR: 12.1.1.1  BDR: 12.1.1.2  MTU: 0    
   Dead timer due in 39  sec
   Retrans timer interval: 5
   Neighbor is up for 00:06:44     
   Authentication Sequence: [ 0 ]

<R1>dis ip rou    
<R1>dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 8        Routes : 8        

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       12.1.1.0/24  Direct  0    0           D   12.1.1.1        GigabitEthernet
0/0/0
       12.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
     12.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
       23.1.1.0/24  OSPF    10   2           D   12.1.1.2        GigabitEthernet
0/0/0
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

<R1>dis ip rou    
<R1>dis ip routing-table pro    
<R1>dis ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
         Destinations : 1        Routes : 1        

OSPF routing table status : <Active>
         Destinations : 1        Routes : 1

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       23.1.1.0/24  OSPF    10   2           D   12.1.1.2        GigabitEthernet
0/0/0

OSPF routing table status : <Inactive>
         Destinations : 0        Routes : 0

<R1>

 

 r2

<R2>dis ospf peer 

     OSPF Process 100 with Router ID 12.1.1.2
         Neighbors 

 Area 0.0.0.0 interface 12.1.1.2(GigabitEthernet0/0/0)'s neighbors
 Router ID: 12.1.1.1         Address: 12.1.1.1        
   State: Full  Mode:Nbr is  Slave  Priority: 1
   DR: 12.1.1.1  BDR: 12.1.1.2  MTU: 0    
   Dead timer due in 36  sec 
   Retrans timer interval: 5 
   Neighbor is up for 00:09:02     
   Authentication Sequence: [ 0 ] 

         Neighbors 

 Area 0.0.0.0 interface 23.1.1.2(GigabitEthernet0/0/1)'s neighbors
 Router ID: 23.1.1.3         Address: 23.1.1.3        
   State: Full  Mode:Nbr is  Master  Priority: 1
   DR: 23.1.1.2  BDR: 23.1.1.3  MTU: 0    
   Dead timer due in 39  sec 
   Retrans timer interval: 5 
   Neighbor is up for 00:07:05     
   Authentication Sequence: [ 0 ] 

 

 R3

[R3]dis ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 8        Routes : 8        

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       12.1.1.0/24  OSPF    10   2           D   23.1.1.2        GigabitEthernet
0/0/1
       23.1.1.0/24  Direct  0    0           D   23.1.1.3        GigabitEthernet
0/0/1
       23.1.1.3/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
     23.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0
      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0
127.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

[R3]dis ospf pee	
[R3]dis ospf peer 

	 OSPF Process 100 with Router ID 23.1.1.3
		 Neighbors 

 Area 0.0.0.0 interface 23.1.1.3(GigabitEthernet0/0/1)'s neighbors
 Router ID: 12.1.1.2         Address: 23.1.1.2        
   State: Full  Mode:Nbr is  Slave  Priority: 1
   DR: 23.1.1.2  BDR: 23.1.1.3  MTU: 0    
   Dead timer due in 38  sec 
   Retrans timer interval: 5 
   Neighbor is up for 00:08:44     
   Authentication Sequence: [ 0 ] 

[R3]dis ip rou	
[R3]dis ip routing-table pr	
[R3]dis ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
         Destinations : 1        Routes : 1        

OSPF routing table status : <Active>
         Destinations : 1        Routes : 1

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

       12.1.1.0/24  OSPF    10   2           D   23.1.1.2        GigabitEthernet
0/0/1

OSPF routing table status : <Inactive>
         Destinations : 0        Routes : 0

 

posted @ 2017-12-11 12:45  JUSTZHI  阅读(718)  评论(0编辑  收藏  举报