mblee1989 / huanli

IT
0 stars 0 forks source link

实验2.1 OSPF基本配置 #1

Open mblee1989 opened 5 years ago

mblee1989 commented 5 years ago

1.基本配置[] R1: sys undo info-cen enable sysname R1 int loop 0 ip add 1.1.1.1 32 int loop 1 ip add 11.11.11.11 24 int g0/0/1 ip add 10.0.12.1 24 int g0/0/2 ip add 10.0.13.1 24 q

R2: sys undo info-cen enable sysname R2 int loop 0 ip add 2.2.2.2 32 int g0/0/0 ip add 10.0.12.2 24 int s0/0/2 ip add 10.0.23.2 24 int e0/0/1 ip add 10.0.24.2 24 q

R3: sys undo info-cen enable sysname R3 int loop 0 ip add 3.3.3.3 32 int g0/0/0 ip add 10.0.13.3 24 int s0/0/2 ip add 10.0.23.3 24 q

R4: sys undo info-cen enable sysname R4 int loop 0 ip add 4.4.4.4 32 int loop 1 ip add 44.44.44.44 24 int e0/0/1 ip add 10.0.24.4 24 q

R5: sys undo info-cen enable sysname R5 int loop 0 ip add 5.5.5.5 32 int loop 1 ip add 55.55.55.55 24 int e0/0/1 ip add 10.0.35.5 24 q

mblee1989 commented 5 years ago

2.配置OSPF路由协议 R1: router id 1.1.1.1 ospf area 0 network 10.0.12.1 0.0.0.0 network 10.0.13.1 0.0.0.0 network 1.1.1.1 0.0.0.0 network 11.11.11.11 0.0.0.0 q q ++++++++++++++++++++++++ R2: router id 2.2.2.2 ospf area 0 network 10.0.12.2 0.0.0.0 network 10.0.23.2 0.0.0.0 network 2.2.2.2 0.0.0.0 area 1 network 10.0.24.2 0.0.0.0 q q

+++++++++++++++++++++++ R3: router id 3.3.3.3 ospf area 0 network 10.0.13.3 0.0.0.0 network 10.0.23.3 0.0.0.0 network 3.3.3.3 0.0.0.0 area 2 network 10.0.35.3 0.0.0.0 q q ++++++++++++++++++++++++ R4: router id 4.4.4.4 ospf area 1 network 10.0.24.4 0.0.0.0 network 4.4.4.4 0.0.0.0 network 44.44.44.44 0.0.0.0 q q +++++++++++++++++++++++ R5: router id 5.5.5.5 ospf area 2 network 10.0.35.5 0.0.0.0 network 5.5.5.5 0.0.0.0 network 55.55.55.55 0.0.0.0 q q

mblee1989 commented 5 years ago

3.查看DR/BDR选举情况:

R1、R2、R3: dis ospf peer brief

dis ospf peer brief OSPF Process 1 with Router ID 1.1.1.1 Peer Statistic Information ---------------------------------------------------------------------------- Area Id Interface Neighbor id State 0.0.0.0 GigabitEthernet0/0/1 2.2.2.2 Full 0.0.0.0 GigabitEthernet0/0/2 3.3.3.3 Full ---------------------------------------------------------------------------- [R2]dis ospf peer brief 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 1.1.1.1 Full 0.0.0.0 Serial0/0/2 3.3.3.3 Full 0.0.0.1 Ethernet0/0/1 4.4.4.4 Full ---------------------------------------------------------------------------- [R3]dis ospf peer 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 1.1.1.1 Full 0.0.0.0 Serial0/0/2 2.2.2.2 Full 0.0.0.2 Ethernet0/0/1 5.5.5.5 Full ---------------------------------------------------------------------------- dis ospf peer brief OSPF Process 1 with Router ID 4.4.4.4 Peer Statistic Information ---------------------------------------------------------------------------- Area Id Interface Neighbor id State 0.0.0.1 Ethernet0/0/1 2.2.2.2 Full ---------------------------------------------------------------------------- dis ospf peer brief OSPF Process 1 with Router ID 5.5.5.5 Peer Statistic Information ---------------------------------------------------------------------------- Area Id Interface Neighbor id State 0.0.0.2 Ethernet0/0/1 3.3.3.3 Full ---------------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ R1/R4: dis ip routing-table dis ip routing-table Route Flags: R - relay, D - download to fib ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 18 Routes : 19 Destination/Mask Proto Pre Cost Flags NextHop Interface 1.1.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0 2.2.2.2/32 OSPF 10 1 D 10.0.12.2 GigabitEthernet 0/0/1 3.3.3.3/32 OSPF 10 1 D 10.0.13.3 GigabitEthernet 0/0/2 4.4.4.4/32 OSPF 10 2 D 10.0.12.2 GigabitEthernet 0/0/1 5.5.5.5/32 OSPF 10 2 D 10.0.13.3 GigabitEthernet 0/0/2 ...... ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ dis ip routing-table Route Flags: R - relay, D - download to fib ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 17 Routes : 17 Destination/Mask Proto Pre Cost Flags NextHop Interface 1.1.1.1/32 OSPF 10 2 D 10.0.24.2 Ethernet0/0/1 2.2.2.2/32 OSPF 10 1 D 10.0.24.2 Ethernet0/0/1 3.3.3.3/32 OSPF 10 3 D 10.0.24.2 Ethernet0/0/1 4.4.4.4/32 Direct 0 0 D 127.0.0.1 LoopBack0 5.5.5.5/32 OSPF 10 4 D 10.0.24.2 Ethernet0/0/1 10.0.12.0/24 OSPF 10 2 D 10.0.24.2 Ethernet0/0/1 10.0.13.0/24 OSPF 10 3 D 10.0.24.2 Ethernet0/0/1 10.0.23.0/24 OSPF 10 1563 D 10.0.24.2 Ethernet0/0/1 10.0.24.0/24 Direct 0 0 D 10.0.24.4 Ethernet0/0/1 10.0.24.4/32 Direct 0 0 D 127.0.0.1 Ethernet0/0/1 10.0.35.0/24 OSPF 10 4 D 10.0.24.2 Ethernet0/0/1 11.11.11.11/32 OSPF 10 2 D 10.0.24.2 Ethernet0/0/1 44.44.44.0/24 Direct 0 0 D 44.44.44.44 LoopBack1 44.44.44.44/32 Direct 0 0 D 127.0.0.1 LoopBack1 55.55.55.55/32 OSPF 10 4 D 10.0.24.2 Ethernet0/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
mblee1989 commented 5 years ago

R1、R2、R3、R4、R5: dis ospf interface ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

dis ospf interface OSPF Process 1 with Router ID 1.1.1.1 Interfaces Area: 0.0.0.0 (MPLS TE not enabled) IP Address Type State Cost Pri DR BDR 1.1.1.1 P2P P-2-P 0 1 0.0.0.0 0.0.0.0 11.11.11.11 P2P P-2-P 0 1 0.0.0.0 0.0.0.0 10.0.12.1 Broadcast BDR 1 1 10.0.12.2 10.0.12.1 10.0.13.1 Broadcast DR 1 1 10.0.13.1 10.0.13.3 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ dis ospf interface OSPF Process 1 with Router ID 2.2.2.2 Interfaces Area: 0.0.0.0 (MPLS TE not enabled) IP Address Type State Cost Pri DR BDR 2.2.2.2 P2P P-2-P 0 1 0.0.0.0 0.0.0.0 10.0.12.2 Broadcast DR 1 1 10.0.12.2 10.0.12.1 10.0.23.2 P2P P-2-P 1562 1 0.0.0.0 0.0.0.0 Area: 0.0.0.1 (MPLS TE not enabled) IP Address Type State Cost Pri DR BDR 10.0.24.2 Broadcast DR 1 1 10.0.24.2 10.0.24.4 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ [R3]dis ospf interface OSPF Process 1 with Router ID 3.3.3.3 Interfaces Area: 0.0.0.0 (MPLS TE not enabled) IP Address Type State Cost Pri DR BDR 3.3.3.3 P2P P-2-P 0 1 0.0.0.0 0.0.0.0 10.0.13.3 Broadcast BDR 1 1 10.0.13.1 10.0.13.3 10.0.23.3 P2P P-2-P 1562 1 0.0.0.0 0.0.0.0 Area: 0.0.0.2 (MPLS TE not enabled) IP Address Type State Cost Pri DR BDR 10.0.35.3 Broadcast BDR 1 1 10.0.35.5 10.0.35.3 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ dis ospf interface OSPF Process 1 with Router ID 4.4.4.4 Interfaces Area: 0.0.0.1 (MPLS TE not enabled) IP Address Type State Cost Pri DR BDR 4.4.4.4 P2P P-2-P 0 1 0.0.0.0 0.0.0.0 44.44.44.44 P2P P-2-P 0 1 0.0.0.0 0.0.0.0 10.0.24.4 Broadcast BDR 1 1 10.0.24.2 10.0.24.4 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ dis ospf interface OSPF Process 1 with Router ID 5.5.5.5 Interfaces Area: 0.0.0.2 (MPLS TE not enabled) IP Address Type State Cost Pri DR BDR 5.5.5.5 P2P P-2-P 0 1 0.0.0.0 0.0.0.0 55.55.55.55 P2P P-2-P 0 1 0.0.0.0 0.0.0.0 10.0.35.5 Broadcast DR 1 1 10.0.35.5 10.0.35.3 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ R1: int g0/0/1 ospf dr-priority 2 q dis ospf interface ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ R1&R2: reset ospf 1 process#R1和R2一定都要重启,否则无法实现DR/BDR转换# dis ospf interface =========================== ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ [R1]dis ospf int OSPF Process 1 with Router ID 1.1.1.1 Interfaces Area: 0.0.0.0 (MPLS TE not enabled) IP Address Type State Cost Pri DR BDR 1.1.1.1 P2P P-2-P 0 1 0.0.0.0 0.0.0.0 11.11.11.11 P2P P-2-P 0 1 0.0.0.0 0.0.0.0 10.0.12.1 Broadcast BDR 1 2 10.0.12.2 10.0.12.1 10.0.13.1 Broadcast BDR 1 1 10.0.13.3 10.0.13.1 [R1]q reset ospf 1 process Warning: The OSPF process will be reset. Continue? [Y/N]:y dis ospf int OSPF Process 1 with Router ID 1.1.1.1 Interfaces Area: 0.0.0.0 (MPLS TE not enabled) IP Address Type State Cost Pri DR BDR 1.1.1.1 P2P P-2-P 0 1 0.0.0.0 0.0.0.0 11.11.11.11 P2P P-2-P 0 1 0.0.0.0 0.0.0.0 10.0.12.1 Broadcast DR 1 2 10.0.12.1 10.0.12.2 10.0.13.1 Broadcast BDR 1 1 10.0.13.3 10.0.13.1 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ dis ospf int OSPF Process 1 with Router ID 2.2.2.2 Interfaces Area: 0.0.0.0 (MPLS TE not enabled) IP Address Type State Cost Pri DR BDR 2.2.2.2 P2P P-2-P 0 1 0.0.0.0 0.0.0.0 10.0.12.2 Broadcast DR 1 1 10.0.12.2 10.0.12.1 10.0.23.2 P2P P-2-P 1562 1 0.0.0.0 0.0.0.0 Area: 0.0.0.1 (MPLS TE not enabled) IP Address Type State Cost Pri DR BDR 10.0.24.2 Broadcast DR 1 1 10.0.24.2 10.0.24.4 reset ospf 1 process Warning: The OSPF process will be reset. Continue? [Y/N]:y dis ospf int OSPF Process 1 with Router ID 2.2.2.2 Interfaces Area: 0.0.0.0 (MPLS TE not enabled) IP Address Type State Cost Pri DR BDR 2.2.2.2 P2P P-2-P 0 1 0.0.0.0 0.0.0.0 10.0.12.2 Broadcast BDR 1 1 10.0.12.1 10.0.12.2 10.0.23.2 P2P P-2-P 1562 1 0.0.0.0 0.0.0.0 Area: 0.0.0.1 (MPLS TE not enabled) IP Address Type State Cost Pri DR BDR 10.0.24.2 Broadcast BDR 1 1 10.0.24.4 10.0.24.2 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
mblee1989 commented 5 years ago

=========================== 4.配置ospf的接口开销值:

R2>sy Enter system view, return user view with Ctrl+Z. [R2]int g0/0/0 [R2-GigabitEthernet0/0/0]ospf cost 2000 [R2-GigabitEthernet0/0/0]q [R2]dis ospf interface

 OSPF Process 1 with Router ID 2.2.2.2
     Interfaces 

Area: 0.0.0.0 (MPLS TE not enabled) IP Address Type State Cost Pri DR BDR 2.2.2.2 P2P P-2-P 0 1 0.0.0.0 0.0.0.0 10.0.12.2 Broadcast BDR 2000 1 10.0.12.1 10.0.12.2 10.0.23.2 P2P P-2-P 1562 1 0.0.0.0 0.0.0.0

Area: 0.0.0.1 (MPLS TE not enabled) IP Address Type State Cost Pri DR BDR 10.0.24.2 Broadcast BDR 1 1 10.0.24.4 10.0.24.2

[R2]tracert 55.55.55.55

traceroute to 55.55.55.55(55.55.55.55), max hops: 30 ,packet length: 40,press CTRL_C to break

1 10.0.23.3 30 ms 50 ms 50 ms

2 10.0.35.5 60 ms 60 ms 60 ms

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

sys Enter system view, return user view with Ctrl+Z. [R3]int g0/0/0 [R3-GigabitEthernet0/0/0]ospf cost 2000 [R3-GigabitEthernet0/0/0]q [R3] [R3]dis ospf interface OSPF Process 1 with Router ID 3.3.3.3 Interfaces Area: 0.0.0.0 (MPLS TE not enabled) IP Address Type State Cost Pri DR BDR 3.3.3.3 P2P P-2-P 0 1 0.0.0.0 0.0.0.0 10.0.13.3 Broadcast DR 2000 1 10.0.13.3 10.0.13.1 10.0.23.3 P2P P-2-P 1562 1 0.0.0.0 0.0.0.0 Area: 0.0.0.2 (MPLS TE not enabled) IP Address Type State Cost Pri DR BDR 10.0.35.3 Broadcast BDR 1 1 10.0.35.5 10.0.35.3 [R3]tracert 44.44.44.44 traceroute to 44.44.44.44(44.44.44.44), max hops: 30 ,packet length: 40,press CTRL_C to break 1 10.0.23.2 50 ms 30 ms 40 ms 2 10.0.24.4 70 ms 80 ms 60 ms ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
mblee1989 commented 5 years ago

=========================== 5.配置ospf的被动接口:

[R2]ospf [R2-ospf-1]silent-int e0/0/1 [R2-ospf-1]q [R2]dis ospf peer brief

 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 1.1.1.1 Full
0.0.0.0 Serial0/0/2 3.3.3.3 Full

[R2]dis ip rout [R2]dis ip routing-table Route Flags: R - relay, D - download to fib

Routing Tables: Public Destinations : 17 Routes : 17

Destination/Mask Proto Pre Cost Flags NextHop Interface

    1.1.1.1/32  OSPF    10   2000        D   10.0.12.1       GigabitEthernet

0/0/0 2.2.2.2/32 Direct 0 0 D 127.0.0.1 LoopBack0 3.3.3.3/32 OSPF 10 1562 D 10.0.23.3 Serial0/0/2 5.5.5.5/32 OSPF 10 1563 D 10.0.23.3 Serial0/0/2 10.0.12.0/24 Direct 0 0 D 10.0.12.2 GigabitEthernet 0/0/0 10.0.12.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 10.0.13.0/24 OSPF 10 2001 D 10.0.12.1 GigabitEthernet 0/0/0 10.0.23.0/24 Direct 0 0 D 10.0.23.2 Serial0/0/2 10.0.23.2/32 Direct 0 0 D 127.0.0.1 Serial0/0/2 10.0.23.3/32 Direct 0 0 D 10.0.23.3 Serial0/0/2 10.0.24.0/24 Direct 0 0 D 10.0.24.2 Ethernet0/0/1 10.0.24.2/32 Direct 0 0 D 127.0.0.1 Ethernet0/0/1 10.0.35.0/24 OSPF 10 1563 D 10.0.23.3 Serial0/0/2 11.11.11.11/32 OSPF 10 2000 D 10.0.12.1 GigabitEthernet 0/0/0 55.55.55.55/32 OSPF 10 1563 D 10.0.23.3 Serial0/0/2 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

[R2] User interface con0 is available ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

dis ospf peer brief OSPF Process 1 with Router ID 4.4.4.4 Peer Statistic Information ---------------------------------------------------------------------------- Area Id Interface Neighbor id State ---------------------------------------------------------------------------- dis ip routing-table Route Flags: R - relay, D - download to fib ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 7 Routes : 7 Destination/Mask Proto Pre Cost Flags NextHop Interface 4.4.4.4/32 Direct 0 0 D 127.0.0.1 LoopBack0 10.0.24.0/24 Direct 0 0 D 10.0.24.4 Ethernet0/0/1 10.0.24.4/32 Direct 0 0 D 127.0.0.1 Ethernet0/0/1 44.44.44.0/24 Direct 0 0 D 44.44.44.44 LoopBack1 44.44.44.44/32 Direct 0 0 D 127.0.0.1 LoopBack1 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 ++++++++++++++++++++++++++
mblee1989 commented 5 years ago

=========================== 6.配置ospf的认证功能:

R1]ospf 1 [R1-ospf-1]area 0 [R1-ospf-1-area-0.0.0.0]au
[R1-ospf-1-area-0.0.0.0]authentication-mode simple pla
[R1-ospf-1-area-0.0.0.0]authentication-mode simple plain H
[R1-ospf-1-area-0.0.0.0]authentication-mode simple plain Huawei [R1-ospf-1-area-0.0.0.0]q [R1-ospf-1]q [R1]dis ospf peer brief

 OSPF Process 1 with Router ID 1.1.1.1
      Peer Statistic Information

Area Id Interface Neighbor id State

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

[R2]ospf 1 [R2-ospf-1]area 0 [R2-ospf-1-area-0.0.0.0]authentication-mode simple plain Huawei [R2-ospf-1-area-0.0.0.0]q [R2-ospf-1]q

[R3]ospf 1 [R3-ospf-1]area 0 [R3-ospf-1-area-0.0.0.0]authentication-mode simple plain Huawei [R3-ospf-1-area-0.0.0.0]q [R3-ospf-1]q

[R1]dis ospf peer brief

 OSPF Process 1 with Router ID 1.1.1.1
      Peer Statistic Information

Area Id Interface Neighbor id State
0.0.0.0 GigabitEthernet0/0/1 2.2.2.2 Full
0.0.0.0 GigabitEthernet0/0/2 3.3.3.3 Full

[R1]