11.4 OSPF在帧中继网络中的配置

原理概述

        OSPF将网络分为4种不同的类型,即Point-to-Point、Broadcast、NBMA 及Point-to-MultiPoint,不同网络类型下OSPF的工作制不一样。比如在Broadcast网络中,OSPF能够直接建立邻居邻接关系;在NBMA网络中默认必须手工指定邻居等。在实际网络中,可通过配置接口的网络类型来强制改变默认的接口的网络类型。在帧中继的环境中,OSPF默认的网络类型是NBMA。

实验目的

  •         掌握OSPF在帧中继网络中的配置方法
  •         理解Hub-Spoke组网架构
  •         掌握在帧中继网络中排除OSPF故障的方法

场景

        某公司网络使用OSPF协议,该公司由一个总部和两个分支机构组成。R1为总部路由器,R2和R3分别是两个分支机构的出口路由。两个分支机构都是通过租用运营商的帧中继虚电路来与总部通信的。但为了节省成本,两个分支机构之间没有直接互联的虚电路,即典型的Hub-Spoke组网架构,R1称为Hub端设备,R2、R3为Spoke端设备。

实验编址

设备 接口   IP地址 子网掩码 默认网关 DLCI
R1 Loopback 0 10.1.1.1 255.255.255.255 N/A N/A
Serial 1/0/0 10.0.123.1 255.255.255.0 N/A 102/103
R2 Loopback 0 10.1.2.2 255.255.255.255 N/A N/A
Serial 1/0/0 10.0.123.2 255.255.255.0 N/A 201
R3 Loopback 0 10.1.3.3 255.255.255.255 N/A N/A
Serial 1/0/0 10.0.123.3 255.255.255.0 N/A

301

实验拓扑

11.4 OSPF在帧中继网络中的配置_第1张图片实验步骤

1.基本配置

        在公司总部路由器R1和两个分部的路由器R2、R3上配置帧中继接口,关闭帧中继逆向地址解析功能。

        首先根据实验编址表进行相应的基本IP地址配置,并配置帧中继静态地址映射。环回接口掩码为32位,用来模拟公司总部和分部的主机。注意:将R1设置位DR,调整其DR优先级为100.   

        [R1]int loopback 0
        [R1-LoopBack0]ip add 10.1.1.1 32
        [R1-LoopBack0]int s1/0/0
        [R1-Serial1/0/0]ip add 10.0.123.1 24
        [R1-Serial1/0/0]link-protocol fr
        Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:y
        [R1-Serial1/0/0]undo fr inarp
        [R1-Serial1/0/0]fr map ip 10.0.123.2 102
        [R1-Serial1/0/0]fr map ip 10.0.123.3 103
        [R1-Serial1/0/0]ospf dr-priority 100

        [R2]int loopback 0
        [R2-LoopBack0]ip add 10.1.2.2 32
        [R2-LoopBack0]int s1/0/0
        [R2-Serial1/0/0]ip add 10.0.123.2 24
        [R2-Serial1/0/0]link-protocol fr
        Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:y
        [R2-Serial1/0/0]undo fr inarp
        [R2-Serial1/0/0]fr map ip 10.0.123.1 201

        [R3]int loopback 0
        [R3-LoopBack0]ip add 10.1.3.3 32
        [R3-LoopBack0]int s1/0/0 
        [R3-Serial1/0/0]ip add 10.0.123.3 24
        [R3-Serial1/0/0]link-protocol fr
        Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:y
        [R3-Serial1/0/0]undo fr inarp
        [R3-Serial1/0/0]fr map ip 10.0.123.1 301

        配置完成后,检查帧中继的虚电路状态和映射表。

        dis fr pvc-info
        PVC statistics for interface Serial1/0/0 (DTE, physical UP) 
            DLCI = 102, USAGE = LOCAL (00000100), Serial1/0/0
            create time = 2021/11/17 16:05:05, status = ACTIVE
            InARP = Disable, PVC-GROUP = NONE
            in packets = 0, in bytes = 0
            out packets = 0, out bytes = 0
 
            DLCI = 103, USAGE = LOCAL (00000100), Serial1/0/0
            create time = 2021/11/17 16:05:05, status = ACTIVE
            InARP = Disable, PVC-GROUP = NONE
            in packets = 0, in bytes = 0
            out packets = 0, out bytes = 0

        可以观察到,PVC处于ACTIVE状态表示正常。

        dis fr map-info 
        Map Statistics for interface Serial1/0/0 (DTE)
          DLCI = 102, IP 10.0.123.2, Serial1/0/0
            create time = 2021/11/17 16:05:05, status = ACTIVE
            encapsulation = ietf, vlink = 1
          DLCI = 103, IP 10.0.123.3, Serial1/0/0
            create time = 2021/11/17 16:05:05, status = ACTIVE
            encapsulation = ietf, vlink = 2

        检查R1与R2,R1与R3之间的网络连通性。

        ping 10.0.123.2
          PING 10.0.123.2: 56  data bytes, press CTRL_C to break
            Reply from 10.0.123.2: bytes=56 Sequence=1 ttl=255 time=50 ms
            Reply from 10.0.123.2: bytes=56 Sequence=2 ttl=255 time=20 ms
            Reply from 10.0.123.2: bytes=56 Sequence=3 ttl=255 time=20 ms
            Reply from 10.0.123.2: bytes=56 Sequence=4 ttl=255 time=20 ms
            Reply from 10.0.123.2: bytes=56 Sequence=5 ttl=255 time=20 ms

  

        ping 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=40 ms
            Reply from 10.0.123.3: bytes=56 Sequence=2 ttl=255 time=20 ms
            Reply from 10.0.123.3: bytes=56 Sequence=3 ttl=255 time=20 ms
            Reply from 10.0.123.3: bytes=56 Sequence=4 ttl=255 time=20 ms
            Reply from 10.0.123.3: bytes=56 Sequence=5 ttl=255 time=20 ms

        此时通行正常。

2.在帧中继上搭建OSPF网络

        在R1、R2和R3上配置OSPF协议。采用OSPF单区域配置,指定各自的环回接口地址为Router-ID,所有网段都属于区域0。

        [R1]ospf 1 router-id 10.1.1.1
        [R1-ospf-1]area 0
        [R1-ospf-1-area-0.0.0.0]network 10.0.123.1 0.0.0.255
        [R1-ospf-1-area-0.0.0.0]network 10.1.1.1 0.0.0.0

        [R2]ospf 1 router-id 10.1.2.2
        [R2-ospf-1]area 0
        [R2-ospf-1-area-0.0.0.0]network 10.0.123.2 0.0.0.255
        [R2-ospf-1-area-0.0.0.0]network 10.1.2.2 0.0.0.0

        [R3]ospf 1 router-id 10.1.3.3
        [R3-ospf-1]area 0
        [R3-ospf-1-area-0.0.0.0]network 10.0.123.3 0.0.0.255
        [R3-ospf-1-area-0.0.0.0]network 10.1.3.3 0.0.0.0

        配置完成后,查看OSPF邻居建立情况。

        dis ospf peer

             OSPF Process 1 with Router ID 10.1.1.1

        发现无法正常建立邻居,这是明显网络故障,现在需要立刻进行分析排除故障。排障时需注意遵从从底层逐步往上层排查的顺序,即先检查物理层线路是否正常,然后检查二层链路的连通性,再检查三层路由协议的运行情况,最后检查高层相关应用是否正常。

        测试直连线路的连通性。

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

        ping 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=30 ms
            Reply from 10.0.123.3: bytes=56 Sequence=2 ttl=255 time=20 ms
            Reply from 10.0.123.3: bytes=56 Sequence=3 ttl=255 time=20 ms
            Reply from 10.0.123.3: bytes=56 Sequence=4 ttl=255 time=20 ms
            Reply from 10.0.123.3: bytes=56 Sequence=5 ttl=255 time=20 ms

        直连链路连通性没有问题。再查看三层路由协议,即相应接口是否被通告到OSPF进程中。

        

        dis ospf int

             OSPF Process 1 with Router ID 10.1.1.1
                 Interfaces 

         Area: 0.0.0.0          (MPLS TE not enabled)
         IP Address      Type         State    Cost    Pri   DR              BDR 
         10.1.1.1        P2P          P-2-P    0       1     0.0.0.0         0.0.0.0
         10.0.123.1      NBMA         DR       48      100   10.0.123.1      0.0.0.0

        观察到,所有接口已经被通告进入OSPF进程。

        此时可以对R1的S1/0/0接口进行抓包分析,产看协议的运行情况。

11.4 OSPF在帧中继网络中的配置_第2张图片

         发现R1始终没有向外发送OSPF数据包。这是由于OSPF在帧中继上默认的网络类型为NBMA,即非广播多路访问。这种网络类型的特定是不支持广播和组播的数据包,而OSPF协议默认是采用组播方式发送报文,所以设备的OSPF报文无法在帧中继链路上进行发送,导致没有成功建立邻居关系。

        这时可采用peer命令手工指定OSPF邻居,才用单播方式发送报文。

        [R1]ospf 1
        [R1-ospf-1]area 0
        [R1-ospf-1-area-0.0.0.0]peer 10.0.123.2 
        [R1-ospf-1]peer 10.0.123.3

        [R2]ospf 1
        [R2-ospf-1]area 0
        [R2-ospf-1-area-0.0.0.0]peer 10.0.123.1

        [R3]ospf 1
        [R3-ospf-1]area 0
        [R3-ospf-1-area-0.0.0.0]peer 10.0.123.1

        配置完成后,再次检查OSPF的邻居关系状态。

        dis ospf p b

             OSPF Process 1 with Router ID 10.1.1.1
                  Peer Statistic Information
         ----------------------------------------------------------------------------
         Area Id          Interface                        Neighbor id      State    
         0.0.0.0          Serial1/0/0                      10.1.2.2         Full        
         0.0.0.0          Serial1/0/0                      10.1.3.3         Full        
         ----------------------------------------------------------------------------

        可以观察到,这时R1与R2、R3都建立了完全的邻接关系。再查看R1、R2、R3的路由表。

        dis ip routing protocol ospf
        Route Flags: R - relay, D - download to fib
        ------------------------------------------------------------------------------
        Public routing table : OSPF
                 Destinations : 2        Routes : 2        

        OSPF routing table status :
                 Destinations : 2        Routes : 2

        Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

               10.1.2.2/32  OSPF    10   48          D   10.0.123.2      Serial1/0/0
               10.1.3.3/32  OSPF    10   48          D   10.0.123.3      Serial1/0/0

        OSPF routing table status :
                 Destinations : 0        Routes : 0

        dis ip routing protocol ospf
        Route Flags: R - relay, D - download to fib
        ------------------------------------------------------------------------------
        Public routing table : OSPF
                 Destinations : 2        Routes : 2        

        OSPF routing table status :
                 Destinations : 2        Routes : 2

        Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

               10.1.1.1/32  OSPF    10   48          D   10.0.123.1      Serial1/0/0
               10.1.3.3/32  OSPF    10   48          D   10.0.123.3      Serial1/0/0

        OSPF routing table status :
                 Destinations : 0        Routes : 0

        dis ip routing protocol ospf
        Route Flags: R - relay, D - download to fib
        ------------------------------------------------------------------------------
        Public routing table : OSPF
                 Destinations : 2        Routes : 2        

        OSPF routing table status :
                 Destinations : 2        Routes : 2

        Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

               10.1.1.1/32  OSPF    10   48          D   10.0.123.1      Serial1/0/0
               10.1.2.2/32  OSPF    10   48          D   10.0.123.2      Serial1/0/0

        OSPF routing table status :
                 Destinations : 0        Routes : 0

        可以观察到此时的R1、R2、R3路由表中都互相接收到了各自环回口所在网段的路由条目。测试环回口之间的连通性。

        ping 10.1.2.2
          PING 10.1.2.2: 56  data bytes, press CTRL_C to break
            Reply from 10.1.2.2: bytes=56 Sequence=1 ttl=255 time=20 ms
            Reply from 10.1.2.2: bytes=56 Sequence=2 ttl=255 time=10 ms
            Reply from 10.1.2.2: bytes=56 Sequence=3 ttl=255 time=10 ms
            Reply from 10.1.2.2: bytes=56 Sequence=4 ttl=255 time=10 ms
            Reply from 10.1.2.2: bytes=56 Sequence=5 ttl=255 time=10 ms

        ......

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

        此时,R1与R2,R1与R3之间的环回口通信正常。再次测试R2与R3环回口之间的通行情况。

        ping 10.1.3.3
          PING 10.1.3.3: 56  data bytes, press CTRL_C to break
            Request time out
            Request time out
            Request time out
            Request time out
            Request time out

        发现R2无法连通R3的环回口,再次进行排障。物理链路和二层链路的连通性测试省略。首先查看R2的OSPF路由条目,观察到去往10.1.3.3的网段下一跳地址是10.0.123.3。

        dis ip routing protocol ospf
        Route Flags: R - relay, D - download to fib
        ------------------------------------------------------------------------------
        Public routing table : OSPF
                 Destinations : 2        Routes : 2        

        OSPF routing table status :
                 Destinations : 2        Routes : 2

        Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

               10.1.1.1/32  OSPF    10   48          D   10.0.123.1      Serial1/0/0
               10.1.3.3/32  OSPF    10   48          D   10.0.123.3      Serial1/0/0

        OSPF routing table status :
                 Destinations : 0        Routes : 0

        然后在R2上查看帧中继映射关系。

        dis fr map-info 
        Map Statistics for interface Serial1/0/0 (DTE)
         DLCI = 201, IP 10.0.123.1, Serial1/0/0
            create time = 2021/11/17 16:05:09, status = ACTIVE
            encapsulation = ietf, vlink = 1

        可以观察到,此时没有关于10.0.123.3的映射,如果R2要发送数据包至下一跳10.0.123.3,但无法知晓该从哪条PVC上进行发送和封装,可以使用PVC复用技术解决此问题。这时需要在R2的S1/0/0接口下添加一条帧中继静态映射,通过R1与R2的PVC去往10.0.123.3。

        [R2]int s1/0/0
        [R2-Serial1/0/0]fr map ip 10.0.123.3 201

        在R3上也添加关于10.0.123.2的相关映射。

        [R3]int s1/0/0
        [R3-Serial1/0/0]fr map ip 10.0.123.2 301

        配置完成后,再在R2上查看帧中继映射关系。

        dis fr map-info
        Map Statistics for interface Serial1/0/0 (DTE)
          DLCI = 201, IP 10.0.123.1, Serial1/0/0
            create time = 2021/11/17 16:05:09, status = ACTIVE
            encapsulation = ietf, vlink = 1
          DLCI = 201, IP 10.0.123.3, Serial1/0/0
            create time = 2021/11/17 16:56:50, status = ACTIVE
            encapsulation = ietf, vlink = 2

        此时已经添加上相关映射,再次测试R2与R3环回口的连通性。

        ping 10.1.3.3
          PING 10.1.3.3: 56  data bytes, press CTRL_C to break
            Reply from 10.1.3.3: bytes=56 Sequence=1 ttl=254 time=30 ms
            Reply from 10.1.3.3: bytes=56 Sequence=2 ttl=254 time=30 ms
            Reply from 10.1.3.3: bytes=56 Sequence=3 ttl=254 time=30 ms
            Reply from 10.1.3.3: bytes=56 Sequence=4 ttl=254 time=30 ms
            Reply from 10.1.3.3: bytes=56 Sequence=5 ttl=254 time=20 ms

        此时通信正常。

        

         

 

你可能感兴趣的:(HCIA,网络,网络)