OSPF多区域实验

这篇具有很好参考价值的文章主要介绍了OSPF多区域实验。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

一、OSPF多区域

(一)实验介绍

1、学习目标

实现手动指定OSPF Router ID

实现OSPF多区域配置

阐明OSPF区域之间路由汇总的配置方法

阐明OSPF参考带宽的配置方法

阐明OSPF引入外部路由的配置方法

阐明OSPF引入的外部路由时进行路由汇总的方法

阐明向OSPF引入缺省路由的方法

阐明对OSPF中各类路由优先级的修改方法

2、实验组网介绍

多区域ospf配置实验,HCIP,智能路由器,网络

免费视频链接:【实战课】华为HCIA-Datacom认证实验教学-学习视频教程-腾讯课堂

                1. OSPF多区域

互联接口、IP地址如上图所示,所有设备均创建Loopback0,其IP地址为10.0.x.x/24,其中x为设备编号。

R1、R3的所有接口以及R2的GE0/0/4接口属于OSPF区域2,R2、R4的Loopback0接口及互联接口属于OSPF区域0,R4、R5的互联接口、R5的Loopback0、1、2接口属于OSPF区域1。

R2上创建Loopback1、2接口用于模拟外部网段。

3、实验背景

你是公司的网络管理员。现在公司的网络中有五台AR路由器,其中R2和R4在公司总部,R1、R3、R5在公司分部。由于网络规模较大,为了控制LSA的洪泛,你设计了多区域的OSPF。

为了明确设备的Router-ID,你配置设备使用固定的地址作为Router ID。

为了使路由器进行路由转发时效率更高,你在区域的边界配置了自动汇总。

R1路由器连接到Internet,你需要配置一条缺省路由,引入到OSPF区域,以便于OSPF区域的所有路由器都知道如何访问Internet。

同时OSPF路由信息中区分了内部路由和外部路由,你修改了OSPF路由信息的优先级信息,以避免潜在的风险。

OSPF中特定路由信息的度量值是将到达目的网络经过的所有链路的代价值进行累加得到的。而链路的代价值是路由器将接口带宽与参考带宽进行对比得到。参考带宽值为100Mbps,实际接口带宽可能为1000Mbps,而度量值都是整数,所以快速以太网接口和千兆以太网接口的OSPF代价值均为1。为了能够相互区分这些链路,你定义参考带宽值为10Gbps。

(二)实验任务

1、任务思路

  1. 设备IP地址配置。
  2. 按照规划配置OSPF区域。
  3. 检查OSPF配置结果,检查OSPF邻居关系状态,在ABR上查看OSPF LSDB。
  4. 在ABR、ASBR上配置路由汇总,减少区域间、外部路由数量。
  5. 修改OSPF的参考带宽值。
  6. 在OSPF中引入缺省路由。
  7. 修改OSPF域内、域间路由和域外路由的缺省路由优先级。

2、任务步骤

            • 2 互联接口、环回口IP地址配置

#设备命名

略。

#关闭本实验中未使用的接口

#配置R1的GE0/0/3接口、环回口IP地址

[R1]interface GigabitEthernet0/0/3

[R1-GigabitEthernet0/0/3] ip address 10.0.123.1 24

[R1-GigabitEthernet0/0/3] quit

[R1]interface LoopBack 0

[R1-LoopBack0] ip address 10.0.1.1 24

[R1-LoopBack0] quit

#配置R2的GE0/0/4、GE0/0/2接口、环回口IP地址

[R2]interface GigabitEthernet0/0/4

[R2-GigabitEthernet0/0/4] ip address 10.0.123.2 24

[R2-GigabitEthernet0/0/4] quit

[R2] interface GigabitEthernet0/0/2

[R2-GigabitEthernet0/0/2] ip address 10.0.24.2 24

[R2-GigabitEthernet0/0/2] quit

[R2]interface LoopBack 0

[R2-LoopBack0] ip address 10.0.2.2 24

[R2-LoopBack0] quit

[R2]interface LoopBack1

[R2-LoopBack1] ip address 10.2.0.1 255.255.255.0

[R2-LoopBack1] quit

[R2]interface LoopBack2

[R2-LoopBack2] ip address 10.2.1.1 255.255.255.0

[R2-LoopBack2] quit

#配置R3的GE0/0/4接口、环回口IP地址

[R3]interface GigabitEthernet0/0/4

[R3-GigabitEthernet0/0/4] ip address 10.0.123.3 24

[R3-GigabitEthernet0/0/4] quit

[R3]interface LoopBack 0

[R3-LoopBack0] ip address 10.0.3.3 24

[R3-LoopBack0] quit

[R3]interface LoopBack 1

[R3-LoopBack1] ip address 10.3.0.1 24

[R3-LoopBack1] quit

[R3]interface LoopBack 2

[R3-LoopBack2] ip address 10.3.1.1 24

[R3-LoopBack2] quit

#配置R4的GE0/0/3、GE0/0/2接口以及环回口IP地址

[R4]interface GigabitEthernet0/0/3

[R4-GigabitEthernet0/0/3] ip address 10.0.24.4 24

[R4-GigabitEthernet0/0/3] quit      

[R4]interface GigabitEthernet0/0/2

[R4-GigabitEthernet0/0/2] ip address 10.0.45.4 24

[R4-GigabitEthernet0/0/2] quit

[R4]interface LoopBack 0

[R4-LoopBack0] ip address 10.0.4.4 24

[R4-LoopBack0] quit

#配置R5的GE0/0/3接口、环回口IP地址

[R5]interface GigabitEthernet0/0/3        

[R5-GigabitEthernet0/0/3] ip address 10.0.45.5 24

[R5-GigabitEthernet0/0/3] quit

[R5]interface LoopBack 0

[R5-LoopBack0] ip address 10.0.5.5 24

[R5-LoopBack0] quit

[R5]interface LoopBack 1

[R5-LoopBack1] ip address 10.5.0.1 24 

[R5-LoopBack1] quit

[R5]int LoopBack 2

[R5-LoopBack2] ip address 10.5.1.1 24

[R5-LoopBack2] quit

#在R2上检测与R1、R3、R4的互联地址连通性

<R2>ping -c 1 10.0.123.1

  PING 10.0.123.1: 56  data bytes, press CTRL_C to break

    Reply from 10.0.123.1: bytes=56 Sequence=1 ttl=255 time=70 ms

  --- 10.0.123.1 ping statistics ---

    1 packet(s) transmitted

    1 packet(s) received

    0.00% packet loss

    round-trip min/avg/max = 70/70/70 ms

<R2>ping -c 1 10.0.123.3

  PING 10.0.123.3: 56  data bytes, press CTRL_C to break

    Reply from 10.0.123.3: bytes=56 Sequence=1 ttl=255 time=110 ms

  --- 10.0.123.3 ping statistics ---

    1 packet(s) transmitted

    1 packet(s) received

    0.00% packet loss

round-trip min/avg/max = 110/110/110 ms

<R2>ping -c 1 10.0.24.4    

  PING 10.0.24.4: 56  data bytes, press CTRL_C to break

    Reply from 10.0.24.4: bytes=56 Sequence=1 ttl=255 time=40 ms

  --- 10.0.24.4 ping statistics ---

    1 packet(s) transmitted

    1 packet(s) received

    0.00% packet loss

round-trip min/avg/max = 40/40/40 ms

#在R4上检测与R5的互联地址连通性

<R4>ping -c 1 10.0.45.5

  PING 10.0.45.5: 56  data bytes, press CTRL_C to break

    Reply from 10.0.45.5: bytes=56 Sequence=1 ttl=255 time=80 ms

  --- 10.0.45.5 ping statistics ---

    1 packet(s) transmitted

    1 packet(s) received

    0.00% packet loss

round-trip min/avg/max = 80/80/80 ms

            • 3 配置多区域OSPF

#在R1上配置OSPF,在GE0/0/3接口、Loopback0接口激活OSPF,同时修改Loopback0接口的网络类型为Broadcast

[R1]ospf 1 router-id 10.0.1.1

[R1-ospf-1]area 2

[R1-ospf-1-area-0.0.0.2] network 10.0.123.1 0.0.0.0

[R1-ospf-1-area-0.0.0.2] network 10.0.1.1 0.0.0.0

[R1-ospf-1-area-0.0.0.2] quit

[R1-ospf-1]quit

[R1]interface LoopBack 0

[R1-LoopBack0] ospf network-type broadcast

[R1-LoopBack0] quit

#在R2上配置OSPF,在GE0/0/2、GE0/0/4、Loopback0接口上激活OSPF,同时修改Loopback0接口的网络类型为Broadcast

[R2]ospf 1 router-id 10.0.2.2

[R2-ospf-1]area 0

[R2-ospf-1-area-0.0.0.0] network 10.0.24.2 0.0.0.0

[R2-ospf-1-area-0.0.0.0] network 10.0.2.2 0.0.0.0

[R2-ospf-1-area-0.0.0.0] quit

[R2-ospf-1]area 2

[R2-ospf-1-area-0.0.0.2] network 10.0.123.2 0.0.0.0

[R2-ospf-1-area-0.0.0.2] quit

[R2-ospf-1]quit

[R2]interface LoopBack 0

[R2-LoopBack0] ospf network-type broadcast

[R2-LoopBack0] quit

#在R3上配置OSPF,在GE0/0/4、Loopback0、Loopback1、Loopback2接口上激活OSPF,同时修改Loopback0、1、2接口的网络类型为Broadcast

[R3]ospf 1 router-id 10.0.3.3

[R3-ospf-1]area 2

[R3-ospf-1-area-0.0.0.2] network 10.0.123.3 0.0.0.0

[R3-ospf-1-area-0.0.0.2] network 10.0.3.3 0.0.0.0

[R3-ospf-1-area-0.0.0.2] network 10.3.0.1 0.0.0.0

[R3-ospf-1-area-0.0.0.2] network 10.3.1.1 0.0.0.0

[R3-ospf-1-area-0.0.0.2] quit

[R3-ospf-1]quit

[R3]interface LoopBack 0

[R3-LoopBack0] ospf network-type broadcast

[R3-LoopBack0] quit

[R3]interface LoopBack 1

[R3-LoopBack1] ospf network-type broadcast

[R3-LoopBack1] quit

[R3]interface LoopBack 2

[R3-LoopBack2] ospf network-type broadcast

[R3-LoopBack2] quit

#在R4上配置OSPF,在GE0/0/2、GE0/0/3、Loopback0接口上激活OSPF,同时修改Loopback0接口的网络类型为Broadcast

[R4]ospf 1 router-id 10.0.4.4

[R4-ospf-1]area 0

[R4-ospf-1-area-0.0.0.0] network 10.0.24.4 0.0.0.0

[R4-ospf-1-area-0.0.0.0] network 10.0.4.4 0.0.0.0

[R4-ospf-1-area-0.0.0.0] quit

[R4-ospf-1]area 1

[R4-ospf-1-area-0.0.0.1] network 10.0.45.4 0.0.0.0

[R4-ospf-1-area-0.0.0.1] quit

[R4-ospf-1]quit

[R4]interface LoopBack 0

[R4-LoopBack0] ospf network-type broadcast

[R4-LoopBack0] quit

#在R5上配置OSPF,在GE0/0/3、Loopback0、Loopback1、Loopback2接口上激活OSPF,同时修改Loopback0、1、2接口的网络类型为Broadcast

[R5]ospf 1 router-id 10.0.5.5

[R5-ospf-1]area 1

[R5-ospf-1-area-0.0.0.1] network 10.0.5.5 0.0.0.0

[R5-ospf-1-area-0.0.0.1] network 10.5.0.1 0.0.0.0

[R5-ospf-1-area-0.0.0.1] network 10.5.1.1 0.0.0.0

[R5-ospf-1-area-0.0.0.1] network 10.0.45.5 0.0.0.0

[R5-ospf-1-area-0.0.0.1] quit

[R5-ospf-1]quit

[R5]interface LoopBack 0

[R5-LoopBack0] ospf network-type broadcast

[R5-LoopBack0] quit

[R5]interface LoopBack 1

[R5-LoopBack1] ospf network-type broadcast

[R5-LoopBack1] quit

[R5]interface LoopBack 2

[R5-LoopBack2] ospf network-type broadcast

[R5-LoopBack2] quit

            • 4 检查OSPF配置结果

#在R2上检查OSPF邻居关系的概要信息

<R2>display ospf peer brief

      OSPF Process 1 with Router ID 10.0.2.2

                 Peer Statistic Information

 ----------------------------------------------------------------------------

 Area Id          Interface                     Neighbor id      State   

 0.0.0.0          GigabitEthernet0/0/2             10.0.4.4         Full       

 0.0.0.2          GigabitEthernet0/0/4             10.0.1.1         Full       

 0.0.0.2          GigabitEthernet0/0/4             10.0.3.3         Full       

 ----------------------------------------------------------------------------

#在R5上检查邻居关系的概要信息和OSPF路由表

<R5>display ospf peer brief

      OSPF Process 1 with Router ID 10.0.5.5

                 Peer Statistic Information

 ----------------------------------------------------------------------------

 Area Id          Interface                      Neighbor id      State   

 0.0.0.1          GigabitEthernet0/0/3             10.0.4.4         Full       

 ----------------------------------------------------------------------------

<R5>display ospf routing

      OSPF Process 1 with Router ID 10.0.5.5

                 Routing Tables

 Routing for Network

 Destination        Cost  Type       NextHop      AdvRouter       Area

 10.0.5.0/24        0     Stub       10.0.5.5        10.0.5.5        0.0.0.1

 10.0.45.0/24       1     Transit     10.0.45.5       10.0.5.5        0.0.0.1

 10.5.0.0/24        0     Stub       10.5.0.1        10.0.5.5        0.0.0.1

 10.5.1.0/24        0     Stub       10.5.1.1        10.0.5.5        0.0.0.1

 10.0.1.0/24        3     Inter-area   10.0.45.4       10.0.4.4        0.0.0.1

 10.0.2.0/24        2     Inter-area   10.0.45.4       10.0.4.4        0.0.0.1

 10.0.3.0/24        3     Inter-area   10.0.45.4       10.0.4.4        0.0.0.1

 10.0.4.0/24        1     Inter-area   10.0.45.4       10.0.4.4        0.0.0.1

 10.0.24.0/24       2     Inter-area   10.0.45.4       10.0.4.4        0.0.0.1

 10.0.123.0/24      3     Inter-area   10.0.45.4       10.0.4.4        0.0.0.1

 10.3.0.0/24        3     Inter-area   10.0.45.4       10.0.4.4        0.0.0.1

 10.3.1.0/24        3     Inter-area   10.0.45.4       10.0.4.4        0.0.0.1

 Total Nets: 12

 Intra Area: 4  Inter Area: 8  ASE: 0  NSSA: 0

#在R2上查看OSPF LSDB

<R2>display   ospf  lsdb  

               OSPF     Process      1       with     Router        ID     10.0.2.2

                        Link  State     Database   

                                                                                           Area: 0.0.0.0

     Type                                            LinkState   ID                             AdvRouter                                                                             Age        Len                 Sequence                  Metric

     Router                                         10.0.4.4                                                               10.0.4.4                                                                                                    54                    48                             8000000B                                                      0

     Router                                         10.0.2.2                                                               10.0.2.2                                                                                                    54                    48                             80000008                                                      0

     Network                            10.0.24.4                                                   10.0.4.4                                                                                                    54                    32                             80000003                                                      0

     Sum-Net                   10.3.1.0                                                              10.0.2.2                                                                                  1332                28                             80000001                                                      1

     Sum-Net                   10.3.0.0                                                              10.0.2.2                                                                                  1332                28                             80000001                                                      1

     Sum-Net                   10.5.1.0                                                              10.0.4.4                                                                                           259                  28                             80000002                                                      1

     Sum-Net                   10.0.3.0                                                              10.0.2.2                                                                                  1332                28                             80000001                                                      1

     Sum-Net                   10.5.0.0                                                              10.0.4.4                                                                                           268                  28                             80000002                                                      1

     Sum-Net                   10.0.1.0                                                              10.0.2.2                                                                                           244                  28                             80000001                                                      1

     Sum-Net                   10.0.5.0                                                              10.0.4.4                                                                                           278                  28                             80000002                                                      1

     Sum-Net                   10.0.45.0                                                   10.0.4.4                                                                                           500                  28                             80000002                                                      1

     Sum-Net                   10.0.123.0                                            10.0.2.2                                                                                                 45                        28                             80000002                                                   1

    

                                                                                           Area: 0.0.0.2

     Type                                            LinkState   ID                             AdvRouter                                                                    Age        Len                           Sequence                  Metric

     Router                                        10.0.3.3                                                               10.0.3.3                                                                                           247                  72                             80000017                                                      0

     Router                                        10.0.2.2                                                               10.0.2.2                                                                                           247                  36                             80000008                                                      1

     Router                                        10.0.1.1                                                               10.0.1.1                                                                                           246                  48                             80000008                                                      1

     Network                            10.0.123.3                                            10.0.3.3                                                                                       247                      36                             80000006                                                   0

     Sum-Net                   10.0.24.0                                                   10.0.2.2                                                                                                    45                    28                             80000002                                                      1

     Sum-Net                   10.5.1.0                                                              10.0.2.2                                                                                                    45                    28                             80000002                                                      2

     Sum-Net                   10.5.0.0                                                              10.0.2.2                                                                                                    45                    28                             80000002                                                      2

     Sum-Net                   10.0.2.0                                                              10.0.2.2                                                                                                    45                    28                             80000002                                                      0

     Sum-Net                   10.0.5.0                                                              10.0.2.2                                                                                                    45                    28                             80000002                                                      2

     Sum-Net                   10.0.4.0                                                              10.0.2.2                                                                                                    45                    28                             80000002                                                      1

     Sum-Net                   10.0.45.0                                                   10.0.2.2                                                                                                    45                    28                             80000002                                                      2

R2作为ABR,维护两个区域的LSDB,分别用来描述区域0和区域2的路由。

            • 5 配置OSPF区域间、外部路由汇总

#在R2、R4上查看OSPF路由表

<R2>display ospf routing

      OSPF Process 1 with Router ID 10.0.2.2

                 Routing Tables

 Routing for Network

 Destination        Cost  Type       NextHop      AdvRouter       Area

 10.0.2.0/24        0     Stub       10.0.2.2        10.0.2.2        0.0.0.0

 10.0.24.0/24       1     Transit     10.0.24.2       10.0.2.2        0.0.0.0

 10.0.123.0/24      1     Transit     10.0.123.2      10.0.2.2        0.0.0.2

 10.0.1.0/24        1     Stub       10.0.123.1      10.0.1.1        0.0.0.2

 10.0.3.0/24        1     Stub       10.0.123.3      10.0.3.3        0.0.0.2

 10.0.4.0/24        1     Stub       10.0.24.4       10.0.4.4        0.0.0.0

 10.0.5.0/24        2     Inter-area   10.0.24.4       10.0.4.4        0.0.0.0

 10.0.45.0/24       2     Inter-area   10.0.24.4       10.0.4.4        0.0.0.0

 10.3.0.0/24        1     Stub       10.0.123.3      10.0.3.3        0.0.0.2

 10.3.1.0/24        1     Stub       10.0.123.3      10.0.3.3        0.0.0.2

 10.5.0.0/24        2     Inter-area   10.0.24.4       10.0.4.4        0.0.0.0

 10.5.1.0/24        2     Inter-area   10.0.24.4       10.0.4.4        0.0.0.0

 Total Nets: 12

<R4>display ospf routing

      OSPF Process 1 with Router ID 10.0.4.4

                 Routing Tables

 Routing for Network

 Destination        Cost  Type       NextHop       AdvRouter       Area

 10.0.4.0/24        0     Stub       10.0.4.4        10.0.4.4        0.0.0.0

 10.0.24.0/24       1     Transit     10.0.24.4       10.0.4.4        0.0.0.0

 10.0.45.0/24       1     Transit     10.0.45.4       10.0.4.4        0.0.0.1

 10.0.1.0/24        2     Inter-area   10.0.24.2       10.0.2.2        0.0.0.0

 10.0.2.0/24        1     Stub       10.0.24.2       10.0.2.2        0.0.0.0

 10.0.3.0/24        2     Inter-area   10.0.24.2       10.0.2.2        0.0.0.0

 10.0.5.0/24        1     Stub       10.0.45.5       10.0.5.5        0.0.0.1

 10.0.123.0/24      2     Inter-area   10.0.24.2       10.0.2.2        0.0.0.0

 10.3.0.0/24        2     Inter-area   10.0.24.2       10.0.2.2        0.0.0.0

 10.3.1.0/24        2     Inter-area   10.0.24.2       10.0.2.2        0.0.0.0

 10.5.0.0/24        1     Stub       10.0.45.5       10.0.5.5        0.0.0.1

 10.5.1.0/24        1     Stub       10.0.45.5       10.0.5.5        0.0.0.1

 Total Nets: 12

 Intra Area: 7  Inter Area: 5  ASE: 0  NSSA: 0

R2 OSPF路由表中的R5 Loopback1、2接口的OSPF区域间路由,R4 OSPF路由表中的R3 Loopback1、2接口的OSPF区域间路由都可以进行区域间汇总,之后再向其他区域发送。一方面减少其他区域的路由条目,另外一方面还可以减少路由振荡的发生。

#R4上对R5的Loopback1、Loopback2接口路由进行汇总

[R4]ospf 1

[R4-ospf-1]area 1

[R4-ospf-1-area-0.0.0.1] abr-summary 10.5.0.0 255.255.254.0

[R4-ospf-1-area-0.0.0.1] quit

#在R2上查看OSPF路由表

<R2>display ospf routing

      OSPF Process 1 with Router ID 10.0.2.2

                 Routing Tables

 Routing for Network

 Destination        Cost  Type       NextHop      AdvRouter       Area

 10.0.2.0/24        0     Stub       10.0.2.2        10.0.2.2        0.0.0.0

 10.0.24.0/24       1     Transit     10.0.24.2       10.0.2.2        0.0.0.0

 10.0.123.0/24      1     Transit     10.0.123.2      10.0.2.2        0.0.0.2

 10.0.1.0/24        1     Stub       10.0.123.1      10.0.1.1        0.0.0.2

 10.0.3.0/24        1     Stub       10.0.123.3      10.0.3.3        0.0.0.2

 10.0.4.0/24        1     Stub       10.0.24.4       10.0.4.4        0.0.0.0

 10.0.5.0/24        2     Inter-area   10.0.24.4       10.0.4.4        0.0.0.0

 10.0.45.0/24       2     Inter-area   10.0.24.4       10.0.4.4        0.0.0.0

 10.3.0.0/24        1     Stub       10.0.123.3      10.0.3.3        0.0.0.2

 10.3.1.0/24        1     Stub       10.0.123.3      10.0.3.3        0.0.0.2

 10.5.0.0/23        2     Inter-area   10.0.24.4       10.0.4.4        0.0.0.0

 Total Nets: 11

 Intra Area: 8  Inter Area: 3  ASE: 0  NSSA: 0

R5上的Loopback1、Loopback2接口路由被汇总成了一条区域间路由。

#R2上对R3的Loopback1、Loopback2接口路由进行汇总

[R2]ospf 1

[R2-ospf-1]area 2

[R2-ospf-1-area-0.0.0.2] abr-summary 10.3.0.0 255.255.254.0

#在R4上查看OSPF路由表

<R4>display ospf routing

      OSPF Process 1 with Router ID 10.0.4.4

                 Routing Tables

 Routing for Network

 Destination        Cost  Type       NextHop       AdvRouter      Area

 10.0.4.0/24        0     Stub       10.0.4.4        10.0.4.4        0.0.0.0

 10.0.24.0/24       1     Transit     10.0.24.4       10.0.4.4        0.0.0.0

 10.0.45.0/24       1     Transit     10.0.45.4       10.0.4.4        0.0.0.1

 10.0.1.0/24        2     Inter-area   10.0.24.2       10.0.2.2        0.0.0.0

 10.0.2.0/24        1     Stub       10.0.24.2       10.0.2.2        0.0.0.0

 10.0.3.0/24        2     Inter-area   10.0.24.2       10.0.2.2        0.0.0.0

 10.0.5.0/24        1     Stub       10.0.45.5       10.0.5.5        0.0.0.1

 10.0.123.0/24      2     Inter-area   10.0.24.2       10.0.2.2        0.0.0.0

 10.3.0.0/23        2     Inter-area   10.0.24.2       10.0.2.2        0.0.0.0

 10.5.0.0/24        1     Stub       10.0.45.5       10.0.5.5        0.0.0.1

 10.5.1.0/24        1     Stub       10.0.45.5       10.0.5.5        0.0.0.1

 Total Nets: 11

 Intra Area: 7  Inter Area: 4  ASE: 0  NSSA: 0

R3上的Loopback1、Loopback2接口路由被汇总成了一条区域间路由。

#在R2上将Loopback1、Loopback2接口路由引入到OSPF中

[R2]ospf 1

[R2-ospf-1] import-route direct

#在R4上查看OSPF路由表

<R4>display   ospf     routing      

               OSPF     Process      1       with     Router        ID     10.0.4.4

                             Routing      Tables       

     Routing      for     Network    

     Destination                                                         Cost           Type                                                NextHop                                                    AdvRouter                                                     Area

     10.0.4.0/24                                                         0                                        Stub                                                      10.0.4.4                                                                10.0.4.4                                                               0.0.0.0

     10.0.24.0/24                                                       1                                        Transit                                        10.0.24.4                                                   10.0.4.4                                                              0.0.0.0

     10.0.45.0/24                                                       1                                        Transit                                        10.0.45.4                                                   10.0.4.4                                                              0.0.0.1

     10.0.1.0/24                                                         2                                        Inter-area                 10.0.24.2                                                   10.0.2.2                                                              0.0.0.0

     10.0.2.0/24                                                         1                                        Stub                                                      10.0.24.2                                                    10.0.2.2                                                              0.0.0.0

     10.0.3.0/24                                                         2                                        Inter-area                 10.0.24.2                                                   10.0.2.2                                                              0.0.0.0

     10.0.5.0/24                                                         1                                        Stub                                                      10.0.45.5                                                    10.0.5.5                                                              0.0.0.1

     10.0.123.0/24                                                2                                        Inter-area                      10.0.24.2                                                   10.0.2.2                                                              0.0.0.0

     10.3.0.0/23                                                         2                                        Inter-area                 10.0.24.2                                                   10.0.2.2                                                              0.0.0.0

     10.5.0.0/24                                                         1                                        Stub                                                      10.0.45.5                                                    10.0.5.5                                                              0.0.0.1

     10.5.1.0/24                                                         1                                        Stub                                                      10.0.45.5                                                    10.0.5.5                                                              0.0.0.1

     Routing      for     ASEs

     Destination                                                         Cost                                             Type                                                     Tag                                                                           NextHop                                                    AdvRouter

10.2.0.0/24                                                                       1                                                           Type2                                                        1                                                                                            10.0.24.2                                                   10.0.2.2

     10.2.1.0/24                                                                   1                                                           Type2                                                       1                                                                                             10.0.24.2                                                   10.0.2.2

     Total Nets: 13    

     Intra  Area: 7            Inter  Area: 4            ASE: 2            NSSA:       0      

在R4的OSPF路由表中可以看到R2的Loopback1、2接口路由。

#在R2上执行外部路由汇总

[R2]ospf 1

[R2-ospf-1] asbr-summary 10.2.0.0 255.255.254.0 

#再次在R4上查看OSPF路由表

<R4>display   ospf     routing      

               OSPF     Process      1       with     Router        ID     10.0.4.4

                             Routing      Tables       

     Routing      for     Network    

     Destination                                                         Cost           Type                                                NextHop                                                    AdvRouter                                                     Area

     10.0.4.0/24                                                         0                                        Stub                                                      10.0.4.4                                                                10.0.4.4                                                               0.0.0.0

     10.0.24.0/24                                                       1                                        Transit                                        10.0.24.4                                                   10.0.4.4                                                              0.0.0.0

     10.0.45.0/24                                                       1                                        Transit                                        10.0.45.4                                                   10.0.4.4                                                              0.0.0.1

     10.0.1.0/24                                                         2                                        Inter-area                 10.0.24.2                                                   10.0.2.2                                                              0.0.0.0

     10.0.2.0/24                                                         1                                        Stub                                                      10.0.24.2                                                    10.0.2.2                                                              0.0.0.0

     10.0.3.0/24                                                         2                                        Inter-area                 10.0.24.2                                                   10.0.2.2                                                              0.0.0.0

     10.0.5.0/24                                                         1                                        Stub                                                      10.0.45.5                                                    10.0.5.5                                                              0.0.0.1

     10.0.123.0/24                                                2                                        Inter-area                      10.0.24.2                                                   10.0.2.2                                                              0.0.0.0

     10.3.0.0/23                                                         2                                        Inter-area                 10.0.24.2                                                   10.0.2.2                                                              0.0.0.0

     10.5.0.0/24                                                         1                                        Stub                                                      10.0.45.5                                                    10.0.5.5                                                              0.0.0.1

     10.5.1.0/24                                                         1                                        Stub                                                      10.0.45.5                                                    10.0.5.5                                                              0.0.0.1

     Routing      for     ASEs

     Destination                                                         Cost                                             Type                                                     Tag                                                                      NextHop                                                    AdvRouter

     10.2.0.0/23                                                         2                                                                Type2                                                   1                                                                                         10.0.24.2                                                   10.0.2.2

     Total Nets: 12    

     Intra  Area: 7            Inter  Area: 4            ASE: 1            NSSA:       0

     R2上的Loopback1、Loopback2接口路由被汇总成了一条外部路由。

            • 6 修改OSPF的参考带宽值

在实际网络可能使用了千兆甚至万兆以太网。但是由于OSPF的默认参考带宽值为100Mbps,并且接口代价值仅为整数,所以OSPF无法在带宽上区分百兆以太网和千兆以太网。

在运行OSPF的多个区域内,OSPF的参考带宽值必须一致,否则OSPF无法正常工作。

#修改所有路由器的OSPF参考带宽值为10Gbps

[R1]ospf 1

[R1-ospf-1] bandwidth-reference 10000

[R1-ospf-1] quit

[R2]ospf 1

[R2-ospf-1] bandwidth-reference 10000

[R2-ospf-1] quit

[R3]ospf 1

[R3-ospf-1] bandwidth-reference 10000

[R3-ospf-1] quit

[R4]ospf 1

[R4-ospf-1] bandwidth-reference 10000

[R4-ospf-1] quit

[R5]ospf 1

[R5-ospf-1] bandwidth-reference 10000

[R5-ospf-1] quit

#以R2为例查看OSPF路由表

[R2]display     ospf     routing      

               OSPF     Process      1       with     Router        ID     10.0.2.2

                             Routing      Tables       

     Routing      for     Network    

     Destination                                                         Cost           Type                                                NextHop                                                    AdvRouter                                                     Area

     10.0.2.0/24                                                         0                                        Stub                                                      10.0.2.2                                                                10.0.2.2                                                               0.0.0.0

     10.0.24.0/24                                                       10                             Transit                                        10.0.24.2                                                   10.0.2.2                                                              0.0.0.0

     10.0.123.0/24                                                10                             Transit                                    10.0.123.2                                            10.0.2.2                                                                0.0.0.2

     10.0.1.0/24                                                         10                             Stub                                                      10.0.123.1                                        10.0.1.1                                                              0.0.0.2

     10.0.3.0/24                                                         10                             Stub                                                      10.0.123.3                                        10.0.3.3                                                              0.0.0.2

     10.0.4.0/24                                                         10                             Stub                                                      10.0.24.4                                                    10.0.4.4                                                              0.0.0.0

     10.0.5.0/24                                                         20                             Inter-area                 10.0.24.4                                                   10.0.4.4                                                              0.0.0.0

     10.0.45.0/24                                                       20                             Inter-area                 10.0.24.4                                                   10.0.4.4                                                              0.0.0.0

     10.3.0.0/24                                                         10                             Stub                                                      10.0.123.3                                        10.0.3.3                                                              0.0.0.2

     10.3.1.0/24                                                         10                             Stub                                                      10.0.123.3                                        10.0.3.3                                                              0.0.0.2

     10.5.0.0/23                                                         20                             Inter-area                 10.0.24.4                                                   10.0.4.4                                                              0.0.0.0

     Total Nets: 11    

     Intra  Area: 8            Inter  Area: 3            ASE: 0            NSSA:       0      

可以看到路由的Cost值已经发生了变化。

            • 7 OSPF引入缺省路由

#使用R1的Loopback0接口模拟Internet接入,在R1上配置缺省路由,且出接口指定为Loopback0

[R1]ip route-static 0.0.0.0 0.0.0.0 LoopBack 0

#将缺省路由引入到OSPF,指定外部路由类型为1

[R1]ospf 1

[R1-ospf-1] default-route-advertise always type 1

[R1-ospf-1] quit

#在R2上查看OSPF路由表

[R2]display ospf routing

      OSPF Process 1 with Router ID 10.0.2.2

                 Routing Tables

 Routing for Network

 Destination        Cost  Type       NextHop       AdvRouter       Area

 10.0.2.0/24        0     Stub       10.0.2.2        10.0.2.2        0.0.0.0

 10.0.24.0/24       10    Transit     10.0.24.2       10.0.2.2        0.0.0.0

 10.0.123.0/24      10    Transit     10.0.123.2      10.0.2.2        0.0.0.2

 10.0.1.0/24        10    Stub       10.0.123.1      10.0.1.1        0.0.0.2

 10.0.3.0/24        10    Stub       10.0.123.3      10.0.3.3        0.0.0.2

 10.0.4.0/24        10    Stub       10.0.24.4       10.0.4.4        0.0.0.0

 10.0.5.0/24        20    Inter-area   10.0.24.4       10.0.4.4        0.0.0.0

 10.0.45.0/24       20    Inter-area   10.0.24.4       10.0.4.4        0.0.0.0

 10.3.0.0/24        10    Stub       10.0.123.3      10.0.3.3        0.0.0.2

 10.3.1.0/24        10    Stub       10.0.123.3      10.0.3.3        0.0.0.2

 10.5.0.0/23        20    Inter-area   10.0.24.4       10.0.4.4        0.0.0.0

 Routing for ASEs

 Destination        Cost      Type       Tag         NextHop       AdvRouter

 0.0.0.0/0          11        Type1      1           10.0.123.1      10.0.1.1

 Total Nets: 12

 Intra Area: 8  Inter Area: 3  ASE: 1  NSSA: 0

可以看到R2已经通过Type-5 LSA学习到默认路由,下一跳为R1。

            • 8 修改OSPF中两类路由的优先级

默认情况下,OSPF区域内和区域之间的路由,优先级为10。OSPF外部路由,优先级为150。

#修改R1、R3设备上的OSPF区域内和区域之间的路由优先级为20,修改OSPF外部路由的优先级为50

[R1]ospf 1

[R1-ospf-1] preference 20

[R1-ospf-1] preference ase 50

[R1-ospf-1] quit

[R3]ospf 1

[R3-ospf-1] preference 20

[R3-ospf-1] preference ase 50

[R3-ospf-1] quit

本步骤的相关配置只是向读者介绍如何在OSPF中修改内、外部路由优先级,但是本步骤的操作在本实验中并不具备实际意义。

#在R3上查看IP路由表中的OSPF路由

<R3>display   ip     routing-table     protocol     ospf 

Route     Flags:         R     -        relay, D      -     download   to      fib

------------------------------------------------------------------------------

Public    routing       table     :        OSPF

                                                                        Destinations        :     9                                                                Routes        :        9                                                                

OSPF     routing       table     status :        <Active>

                                                                        Destinations        :     9                                                                Routes        :        9

Destination/Mask                             Proto                                  Pre             Cost                                                            Flags      NextHop                                                                       Interface

                                                                   0.0.0.0/0                    O_ASE                     50                        11                                                                                 D                     10.0.123.1                                        GigabitEthernet0/0/3

                                                          10.0.1.0/24      OSPF                                          20                    10                                                                                 D                     10.0.123.1                                        GigabitEthernet0/0/3

                                                          10.0.2.0/24      OSPF                                          20                    10                                                                                 D                     10.0.123.2                                        GigabitEthernet0/0/3

                                                          10.0.4.0/24      OSPF                                          20                    20                                                                                 D                     10.0.123.2                                        GigabitEthernet0/0/3

                                                          10.0.5.0/24      OSPF                                          20                    30                                                                                 D                     10.0.123.2                                        GigabitEthernet0/0/3

                                                10.0.24.0/24             OSPF                                          20                    20                                                                                 D                     10.0.123.2                                        GigabitEthernet0/0/3

                                                10.0.45.0/24             OSPF                                          20                    30                                                                                 D                     10.0.123.2                                        GigabitEthernet0/0/3

                                                          10.2.0.0/23      O_ASE                     50                        2                                                                                        D                     10.0.123.2                                        GigabitEthernet0/0/3

                                                          10.5.0.0/23      OSPF                                         20                    30                                                                                 D                     10.0.123.2                                        GigabitEthernet0/0/3

OSPF     routing       table     status :        <Inactive>

                                                                        Destinations        :     0                                                                Routes        :        0

可以看到OSPF路由的优先级已经改变。

思考题

OSPF引入外部路由时存在两种类型:类型1与类型2,这两种不同的类型有什么区别?

(四)配置参考

R1设备配置

#

sysname R1

#

interface GigabitEthernet0/0/3

 ip address 10.0.123.1 255.255.255.0

#

interface LoopBack0

 ip address 10.0.1.1 255.255.255.0

 ospf network-type broadcast             

#

ospf 1 router-id 10.0.1.1

 default-route-advertise always type 1

 preference 20

 preference ase 50

 bandwidth-reference 10000

 area 0.0.0.2

  network 10.0.1.1 0.0.0.0

  network 10.0.123.1 0.0.0.0

#

ip route-static 0.0.0.0 0.0.0.0 LoopBack0

#

R2设备配置

#

sysname R2

#

interface GigabitEthernet0/0/2

 ip address 10.0.24.2 255.255.255.0

#

interface GigabitEthernet0/0/4

 ip address 10.0.123.2 255.255.255.0

#

interface LoopBack0

 ip address 10.0.2.2 255.255.255.0       

 ospf network-type broadcast

#

interface LoopBack1

 ip address 10.2.0.1 255.255.255.0

#

interface LoopBack2

 ip address 10.2.1.1 255.255.255.0

#

ospf 1 router-id 10.0.2.2

     asbr-summary 10.2.0.0 255.255.254.0

 import-route direct

 bandwidth-reference 10000

 area 0.0.0.0

  network 10.0.2.2 0.0.0.0

  network 10.0.24.2 0.0.0.0

 area 0.0.0.2

  abr-summary 10.3.0.0 255.255.254.0

  network 10.0.123.2 0.0.0.0

#

R3设备配置

#

sysname R3

#

interface GigabitEthernet0/0/4

 ip address 10.0.123.3 255.255.255.0

#

interface LoopBack0

 ip address 10.0.3.3 255.255.255.0       

 ospf network-type broadcast

#

interface LoopBack1

 ip address 10.3.0.1 255.255.255.0

 ospf network-type broadcast

#

interface LoopBack2

 ip address 10.3.1.1 255.255.255.0

 ospf network-type broadcast

#

ospf 1 router-id 10.0.3.3

 preference 20

 preference ase 50

 bandwidth-reference 10000

 area 0.0.0.2

  network 10.0.123.3 0.0.0.0

  network 10.0.3.3 0.0.0.0

  network 10.3.0.1 0.0.0.0

  network 10.3.1.1 0.0.0.0

#

R4设备配置

#

sysname R4

#

interface GigabitEthernet0/0/2

 ip address 10.0.45.4 255.255.255.0

#

interface GigabitEthernet0/0/3

 ip address 10.0.24.4 255.255.255.0

#

interface LoopBack0

 ip address 10.0.4.4 255.255.255.0       

 ospf network-type broadcast

#

ospf 1 router-id 10.0.4.4

 bandwidth-reference 10000

 area 0.0.0.0

  network 10.0.24.4 0.0.0.0

  network 10.0.4.4 0.0.0.0

 area 0.0.0.1

  abr-summary 10.5.0.0 255.255.254.0

  network 10.0.45.4 0.0.0.0

#

R5设备配置

#

sysname R5

#

interface GigabitEthernet0/0/3

 ip address 10.0.45.5 255.255.255.0

#

interface LoopBack0

 ip address 10.0.5.5 255.255.255.0

 ospf network-type broadcast

#                                        

interface LoopBack1

 ip address 10.5.0.1 255.255.255.0

 ospf network-type broadcast

#

interface LoopBack2

 ip address 10.5.1.1 255.255.255.0

 ospf network-type broadcast

#

ospf 1 router-id 10.0.5.5

 bandwidth-reference 10000

 area 0.0.0.0

 area 0.0.0.1

  network 10.0.5.5 0.0.0.0

  network 10.5.0.1 0.0.0.0

  network 10.5.1.1 0.0.0.0

  network 10.0.45.5 0.0.0.0

#

 文章来源地址https://www.toymoban.com/news/detail-714333.html

到了这里,关于OSPF多区域实验的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 【Cisco Packet Tracer】路由器实验 静态路由/RIP/OSPF/BGP

    本教程讲解路由器的静态IP配置、RIP、OSPF、BGP等实验内容。 绘制以下拓扑结构: PC0设置: PC1设置: Router0端口0设置: Router0端口1设置: Router1端口0设置: Router1端口1设置: PC2设置: PC3设置: PC可以ping通192.168.0.254和10.0.0.1,但是ping不通10.0.0.2: 设置Router0的静态路由: 设置

    2024年02月05日
    浏览(53)
  • HCIP路由重发布技术以及路由策略及配置---RIP与OSPF双向重发布

    重发布技术—在大型的企业中,可能在同一网内使用到多种路由协议,为了实现多种路由协议的协同工作,路由器可以使用路由重分发(route redistribution)将其学习到的一种路由协议的路由通过另一种路由协议广播出去,这样网络的所有部分都可以连通了。 为了实现重分发,

    2024年01月17日
    浏览(53)
  • 动态路由协议之OSPF基本原理、区域划分及配置

             什么是OSPF?        OSPF是我们平时使用最多的一种链路状态协议,其实OSPF协议可以视为是为了解决距离矢量协议所出现的一些系列问题而出现的(距离矢量协议RIP协议收敛慢、最大跳数为15跳、易产生环路)         1、区域划分        OSPF是可以支持单区域也可

    2024年02月09日
    浏览(42)
  • 【OSPF宣告——network命令与多区域配置实验案例】

    个人名片: 🐼 作者简介:一名大二在校生,喜欢编程🎋 🐻‍❄️ 个人主页🥇: 小新爱学习. 🐼 个人WeChat:hmmwx53 🕊️ 系列专栏:🖼️ 零基础学Java——小白入门必备 重识C语言——复习回顾 计算机网络体系———深度详讲 微信小程序开发——实战开发 🐓 每日一句:

    2024年02月07日
    浏览(45)
  • 路由器基础(五): OSPF原理与配置

             开放式最短路径优先 (Open     Shortest   Path    First,OSPF)  是一个内部网 关协议 (Interior    Gateway     Protocol,IGP), 用于在单一自治系统 (Autonomous     System,AS)   内决策 路由。 OSPF 适合小型、中型、较 大规模网络。 OSPF 采用 Dijkstra 的最短路径优先算法 (Short

    2024年02月05日
    浏览(46)
  • 华为路由器 eNSP 配置 rip OSPF 路由重发布

    1:给R1 g0/0/1 Loopback 0  R2 g0/0/1 g0/0/0 Loopback    R3 g0/0/0 配置 area1 2:给R3 g0/0/1 Loopback 0  R4 g0/0/1                                   配置area0 3: 给R4 g0/0/0 Loopback 0  R5 g0/0/0 Loopback                  配置area2 4: 给R6 R1配rip 5: 给R1 R2 R3 R4 R5 配 OSPF R1: sy int g

    2024年02月07日
    浏览(46)
  • 思科路由器BFD配置与详细解释:静态路由和OSPF路由的关联

    本文详细解释了思科路由器的BFD(双向转发检测)配置,包括如何关联静态路由和OSPF路由。通过使用BFD,我们可以快速检测两台邻接路由器之间的转发路径连通状态,从而提升网络性能。

    2024年02月11日
    浏览(54)
  • OSPF路由协议实验配置命令

    拓扑介绍 上述拓扑中配置OSPF,分为三个区域,area0、area1、area2。CR1有三个接口分别属于区域0、区域1、区域2,CR2三个接口分别属于区域0、区域1、区域2,AR1两个接口属于区域1,AR2有两个接口属于区域2;其中AR所接用户使用Loopback1 、2、3模拟外部网络。 实验任务 1 按照拓扑中

    2024年02月06日
    浏览(59)
  • HCIP OSPF实验

    任务:  1.使用三种解决ospf不规则区域的方法 2.路由器5、6、7、8、15使用mgre 3.使用各种优化 4.全网可达 5.保证更新安全 6.使用地址为172.16.0.0/16合理划分 7.每个路由器都有环回 拓扑图IP划分如下: 以R1为例,R2~R15同理 以R1为例,R2R3同理 R3 R1ping isp环回 以R7为例,R5R6R8~R15同理,

    2024年01月22日
    浏览(42)
  • HCIP---OSPF综合实验

    一:实验要求  1、R4为ISP,其上只能配置IP地址,R4与其所有直连设备间均使用公有IP 2、R3-R5/6/7为MGRE环境,R3为中心站点 3、整个OSPF环境IP基于R4的环回 4、所有设备均可访问R4的环回 5、减少LSA的更新量,加快收敛,保障更新安全 6、全网可达 二、建立拓扑图和子网划分 1:子

    2024年02月22日
    浏览(46)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包