华为路由器:多区域OSPF协议实验

一、实验拓扑

在这里插入图片描述

二、ospf基本概念复习

  • 区域划分:area0为骨干区域,其他area1area2都为普通区域/常规区域。普通区域必须和骨干区域直接相连。
  • ABR:区域边界路由器。R2、R3位于两个区域的中间,我们称之为区域边界路由器 ;ABR用来链接骨干区域和普通区域。
  • ASBR :自制系统边界路由器。进行了重新分布操作的路由器。例如上图中的R5链接着两个自制系统,我们把R5称作自制系统边界路由器,自制系统边界路由器用来链接ospf的AS与外部其他的路由。
  • route id:表示ospf的路由器身份ID,身份ID不能重复。一般在配置时都会指定route id。如果没有指定则进行选举。华为的路由器比较特殊,它会选举最先配置好的接口。这个实验我们没有指定route id。手动指定route id:
[AR2]router id 2.2.2.2    #手动指定route id
[AR2]q              
<AR2>reset ospf process   #重启ospf进程,使route id生效
  • ospf的路由优先级:preference默认为10,可以手动修改 。

在这里插入图片描述

三、实验步骤

AR1

先按照拓扑图配好IP
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys AR1
[AR1]int s4/0/0

[AR1-Serial4/0/0]ip add 12.1.1.1 24
[AR1-Serial4/0/0]q
[AR1]un in en
Info: Information center is disabled.
[AR1]
[AR1]int lo 0
[AR1-LoopBack0]ip add 1.1.1.1 24
配置ospf协议

把R1换回也配置到area 1内。

[AR1]ospf 1          #1为自治系统ID
[AR1-ospf-1]area 1   #自治系统内的区域ID
[AR1-ospf-1-area-0.0.0.1]network 12.1.1.0 0.0.0.255   #将12.1.1.0网段宣告到area 1区域
[AR1-ospf-1-area-0.0.0.1]network 1.1.1.0 0.0.0.255 

AR2

先按照拓扑图配好IP
<Huawei>sys    
Enter system view, return user view with Ctrl+Z.
[Huawei]sys AR2

[AR2]int s4/0/0
[AR2-Serial4/0/0]ip add 12.1.1.2 24
[AR2-Serial4/0/0]q      
[AR2]un in en

[AR2]int g0/0/0
[AR2-GigabitEthernet0/0/0]ip add 23.1.1.2 24
[AR2-GigabitEthernet0/0/0]q

[AR2]int LoopBack 0
[AR2-LoopBack0]ip add 2.2.2.2 24
[AR2-LoopBack0]q                 
[AR2]
配置ospf协议

把R2换回也配置到area 0内。

[AR2]ospf 1   
[AR2-ospf-1]area 1
[AR2-ospf-1-area-0.0.0.1]network 12.1.1.0 0.0.0.255
[AR2-ospf-1-area-0.0.0.1]q

[AR2-ospf-1]area 0
[AR2-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255
[AR2-ospf-1-area-0.0.0.0]network 2.2.2.0 0.0.0.255
[AR2-ospf-1-area-0.0.0.0]q

AR3

先按照拓扑图配好IP
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys AR3
[AR3]int g0/0/0
[AR3-GigabitEthernet0/0/0]ip add 23.1.1.3 24
[AR3-GigabitEthernet0/0/0]q
[AR3]un in en
Info: Information center is disabled.
[AR3]int g0/0/1
[AR3-GigabitEthernet0/0/1]ip add 192.168.1.3 24
[AR3-GigabitEthernet0/0/1]q
[AR3]int LoopBack 0
[AR3-LoopBack0]ip add 3.3.3.3 24
配置ospf协议

把R3换回也配置到area 0内。

[AR3]ospf 1
[AR3-ospf-1]area 0
[AR3-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255
[AR3-ospf-1-area-0.0.0.0]network 3.3.3.0 0.0.0.255
[AR3-ospf-1-area-0.0.0.0]q
[AR3-ospf-1]area 2
[AR3-ospf-1-area-0.0.0.2]network 192.168.1.0 0.0.0.255
[AR3-ospf-1-area-0.0.0.2]

AR4

先按照拓扑图配好IP
<Huawei>
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys AR4
[AR4]un in en
Info: Information center is disabled.
[AR4]int g0/0/0
[AR4-GigabitEthernet0/0/0]ip add 192.168.1.4 24
[AR4-GigabitEthernet0/0/0]q
[AR4]int LoopBack 0
[AR4-LoopBack0]ip add 4.4.4.4 24
[AR4-LoopBack0]
配置ospf协议

把R4换回也配置到area 2内。

[AR4]ospf 1
[AR4-ospf-1]area 2
[AR4-ospf-1-area-0.0.0.2]network 192.168.1.0 0.0.0.255
[AR4-ospf-1-area-0.0.0.2]network 4.4.4.0 0.0.0.255
[AR4-ospf-1-area-0.0.0.2]

AR5

先按照拓扑图配好IP
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys AR5
[AR5]un in en
Info: Information center is disabled.
[AR5]int g0/0/0
[AR5-GigabitEthernet0/0/0]ip add 192.168.1.5 24
[AR5-GigabitEthernet0/0/0]q
[AR5]int LoopBack 0
[AR5-LoopBack0]ip add 5.5.5.5 24
[AR5-LoopBack0]q
[AR5]int LoopBack 1
[AR5-LoopBack1]ip add 8.8.8.8 24
R5配置ospf协议

把R5换回也配置到area 2内。

<AR5>sys
Enter system view, return user view with Ctrl+Z.
[AR5]
[AR5]ospf 1
[AR5-ospf-1]area 2
[AR5-ospf-1-area-0.0.0.2]network 192.168.1.0 0.0.0.255
[AR5-ospf-1-area-0.0.0.2]network 5.5.5.0 0.0.0.255
[AR5-ospf-1-area-0.0.0.2]

等下再做RIP

检测ospf的连通性

在R1上ping 192.168.1.5
[AR1]ping 192.168.1.5
  PING 192.168.1.5: 56  data bytes, press CTRL_C to break
    Reply from 192.168.1.5: bytes=56 Sequence=1 ttl=253 time=170 ms
    Reply from 192.168.1.5: bytes=56 Sequence=2 ttl=253 time=50 ms
    Reply from 192.168.1.5: bytes=56 Sequence=3 ttl=253 time=50 ms
    Reply from 192.168.1.5: bytes=56 Sequence=4 ttl=253 time=50 ms
    Reply from 192.168.1.5: bytes=56 Sequence=5 ttl=253 time=60 ms

  --- 192.168.1.5 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 50/76/170 ms

查看R1的整个路由表
<AR1>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.0/24  Direct  0    0           D   1.1.1.1         LoopBack0
        1.1.1.1/32  Direct  0    0           D   127.0.0.1       LoopBack0
      1.1.1.255/32  Direct  0    0           D   127.0.0.1       LoopBack0
        2.2.2.2/32  OSPF    10   48          D   12.1.1.2        Serial4/0/0
        3.3.3.3/32  OSPF    10   49          D   12.1.1.2        Serial4/0/0
        4.4.4.4/32  OSPF    10   50          D   12.1.1.2        Serial4/0/0
        5.5.5.5/32  OSPF    10   50          D   12.1.1.2        Serial4/0/0
       12.1.1.0/24  Direct  0    0           D   12.1.1.1        Serial4/0/0
       12.1.1.1/32  Direct  0    0           D   127.0.0.1       Serial4/0/0
       12.1.1.2/32  Direct  0    0           D   12.1.1.2        Serial4/0/0
     12.1.1.255/32  Direct  0    0           D   127.0.0.1       Serial4/0/0
       23.1.1.0/24  OSPF    10   49          D   12.1.1.2        Serial4/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
    192.168.1.0/24  OSPF    10   50          D   12.1.1.2        Serial4/0/0
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

只想查看ospf协议的路由,可以加参数protocol,后面在跟ospf

<AR1>dis ip routing-table protocol ?   
  bgp     Border Gateway Protocol (BGP) routes
  direct  Direct routes
  isis    IS-IS routing protocol defined by ISO
  ospf    Open Shortest Path First (OSPF) routes
  rip     Routing Information Protocol (RIP) routes
  static  Static routes
  unr     User network routes
<AR1>dis ip routing-table protocol ospf 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
         Destinations : 6        Routes : 6        

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

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        2.2.2.2/32  OSPF    10   48          D   12.1.1.2        Serial4/0/0
        3.3.3.3/32  OSPF    10   49          D   12.1.1.2        Serial4/0/0
        4.4.4.4/32  OSPF    10   50          D   12.1.1.2        Serial4/0/0
        5.5.5.5/32  OSPF    10   50          D   12.1.1.2        Serial4/0/0
       23.1.1.0/24  OSPF    10   49          D   12.1.1.2        Serial4/0/0
    192.168.1.0/24  OSPF    10   50          D   12.1.1.2        Serial4/0/0

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

<AR1>
查看邻居表
[AR1]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.1          Serial4/0/0                      23.1.1.2         Full        
 ----------------------------------------------------------------------------

你可能感兴趣的:(HCIE)