华为 HCIP 实验 - BFD特性与配置 _ BFD与OSPF联动配置实验

目录

实验 6-2 BFD与OSPF联动配置实验

实验目标

拓扑图

场景

学习任务

步骤一.IP编址与基本配置

步骤二.OSPF配置

步骤三.配置BFD session


实验 6-2 BFDOSPF联动配置实验

实验目标

·掌握BFD在OSPF环境下的快速配置

拓扑图

场景

        两台路由器R1和R2经过S1彼此互连,并将各自的接口运行于OSPF区域0,由于不是接口直接相连,若其中一台的接口Down,另一台不会立即感知,需要等待4倍的Hello时间来删除邻居,在这段时间内,数据转发都会处于非正常状态。在这种场景下,可以通过BFD检测来加快OSPF的收敛速度。

学习任务

步骤一.IP编址与基本配置

给所有路由器配置IP地址信息。

<Huawei>system-view

Enter system view, return user view with Ctrl+Z.

[Huawei]sysname R1

[R1]interface GigabitEthernet 0/0/1

[R1-GigabitEthernet0/0/1]ip address 10.0.12.1 24

[R1-GigabitEthernet0/0/1]quit

[R1]interface loopback 0

[R1-LoopBack0]ip address 10.0.1.1 32

[R1-LoopBack0]quit

配置好地址立即在每台路由器进行检查。

[R1]display ip interface brief

*down: administratively down

^down: standby

(l): loopback

(s): spoofing

(E): E-Trunk down

The number of interface that is UP in Physical is 3

The number of interface that is DOWN in Physical is 9

The number of interface that is UP in Protocol is 3

The number of interface that is DOWN in Protocol is 9

Interface                         IP Address/Mask      Physical   Protocol  

Cellular0/0/0                     unassigned            down       down      

Cellular0/0/1                     unassigned           down       down      

GigabitEthernet0/0/0             unassigned            *down      down      

GigabitEthernet0/0/1             10.0.12.1/24            up         up        

GigabitEthernet0/0/2             unassigned           *down      down      

GigabitEthernet0/0/3             unassigned           *down      down      

LoopBack0                       10.0.1.1/32         up         up(s)     

NULL0                           unassigned             up         up(s)     

Serial1/0/0                       unassigned           *down      down      

Serial2/0/0                       unassigned           *down      down      

Serial3/0/0                       unassigned           *down      down      

Serial4/0/0                       unassigned           *down      down

<Huawei>system-view

Enter system view, return user view with Ctrl+Z.

[Huawei]sysname R2

[R2]interface GigabitEthernet 0/0/1

[R2-GigabitEthernet0/0/1]ip address 10.0.12.2 24

[R2-GigabitEthernet0/0/1]quit

[R2]interface loopback 0

[R2-LoopBack0]ip address 10.0.2.2 32

[R2-LoopBack0]quit

[R2]display ip interface brief

*down: administratively down

^down: standby

(l): loopback

(s): spoofing

(E): E-Trunk down

The number of interface that is UP in Physical is 3

The number of interface that is DOWN in Physical is 10

The number of interface that is UP in Protocol is 3

The number of interface that is DOWN in Protocol is 10

Interface                         IP Address/Mask      Physical   Protocol  

Cellular0/0/0                     unassigned            down       down      

Cellular0/0/1                     unassigned            down       down      

Ethernet4/0/0                     unassigned           *down      down      

Ethernet4/0/1                     unassigned           *down      down      

GigabitEthernet0/0/0              unassigned           *down      down      

GigabitEthernet0/0/1              10.0.12.2/24           up         up        

GigabitEthernet0/0/2              unassigned           *down      down      

GigabitEthernet0/0/3              unassigned           *down      down      

LoopBack0                       10.0.2.2/32            up         up(s)     

NULL0                            unassigned           up         up(s)     

Serial1/0/0                       unassigned           *down      down      

Serial2/0/0                       unassigned           *down      down      

Serial3/0/0                       unassigned           *down      down      

检查R1到R2的连通性:

[R1]ping 10.0.12.2

  PING 10.0.12.2: 56  data bytes, press CTRL_C to break

    Request time out

    Reply from 10.0.12.2: bytes=56 Sequence=2 ttl=255 time=1 ms

    Reply from 10.0.12.2: bytes=56 Sequence=3 ttl=255 time=1 ms

    Reply from 10.0.12.2: bytes=56 Sequence=4 ttl=255 time=1 ms

    Reply from 10.0.12.2: bytes=56 Sequence=5 ttl=255 time=1 ms

  --- 10.0.12.2 ping statistics ---

    5 packet(s) transmitted

    4 packet(s) received

    20.00% packet loss

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

步骤二.OSPF配置

按照拓扑将R1和R2路由器的接口包括环回口0划入OSPF区域0:

[R1]ospf 1

[R1-ospf-1]area 0

[R1-ospf-1-area-0.0.0.0]network 10.0.12.0 0.0.0.255

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

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

[R1-ospf-1]quit

[R2]ospf 1

[R2-ospf-1]area 0

[R2-ospf-1-area-0.0.0.0]network 10.0.12.0 0.0.0.255

[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]quit

检查OSPF接口状态和邻居状态:

[R1]display ospf interface      

         OSPF Process 1 with Router ID 10.0.12.1

                 Interfaces

 Area: 0.0.0.0          (MPLS TE not enabled)

 IP Address      Type         State    Cost    Pri   DR              BDR

10.0.12.1       Broadcast    BDR      1       1     10.0.12.2       10.0.12.1

 10.0.1.1        P2P           P-2-P    0       1     0.0.0.0         0.0.0.0

[R2]display ospf interface

         OSPF Process 1 with Router ID 10.0.12.2

                 Interfaces

 Area: 0.0.0.0          (MPLS TE not enabled)

 IP Address      Type         State    Cost    Pri   DR              BDR

10.0.12.2       Broadcast    DR       1       1     10.0.12.2       10.0.12.1

10.0.2.2        P2P          P-2-P    0       1     0.0.0.0         0.0.0.0

检查OSPF邻居状态:

[R1]display ospf peer brief

         OSPF Process 1 with Router ID 10.0.12.1

                  Peer Statistic Information

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

 Area Id          Interface                        Neighbor id      State    

 0.0.0.0          GigabitEthernet0/0/1             10.0.12.2        Full        

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

 Total Peer(s):     1

[R2]display ospf peer brief

         OSPF Process 1 with Router ID 10.0.12.2

                  Peer Statistic Information

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

 Area Id          Interface                        Neighbor id      State    

 0.0.0.0          GigabitEthernet0/0/1             10.0.12.1        Full        

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

 Total Peer(s):     1

邻居已经是Full的状态,OSPF配置完毕。

步骤三.配置BFD session

需要在系统全局下开启BFD,并且在OSPF视图下启用联动BFD。

[R1]bfd

[R1-bfd]quit

[R1]ospf 1

[R1-ospf-1]bfd all-interfaces enable

[R1-ospf-1]quit

[R2]bfd

[R2-bfd]quit

[R2]ospf 1

[R2-ospf-1]bfd all-interfaces enable

[R2-ospf-1]quit

在两端都配置完毕后检查BFD session状态:

[R1]display bfd session all

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

Local Remote     PeerIpAddr      State     Type         InterfaceName           

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

8192  8192       10.0.12.2       Up        D_IP_IF      GigabitEthernet0/0/1    

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

     Total UP/DOWN Session Number : 1/0

[R2]display bfd session all

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

Local Remote     PeerIpAddr      State     Type         InterfaceName           

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

8192  8192       10.0.12.1       Up        D_IP_IF      GigabitEthernet0/0/1    

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

     Total UP/DOWN Session Number : 1/0

[R1]display ospf bfd session all

         OSPF Process 1 with Router ID 10.0.12.1

  Area 0.0.0.0 interface 10.0.12.1(GigabitEthernet0/0/1)'s BFD Sessions

 NeighborId:10.0.12.2        AreaId:0.0.0.0          Interface:GigabitEthernet0/0/1

 BFDState:up                 rx    :1000             tx       :1000          

 Multiplier:3                BFD Local Dis:8192      LocalIpAdd:10.0.12.1

 RemoteIpAdd:10.0.12.2       Diagnostic Info:No diagnostic information

测试BFD效果,在R2接口上shutdown:

[R2]interface GigabitEthernet 0/0/1

[R2-GigabitEthernet0/0/1]shutdown

如果在R1上开启了debug功能,在R1上若观察debug日志,会出现如下内容:

<R1>debug ospf bfd

Sep 23 2016 03:39:25+00:00 R1 %%01BFD/4/STACHG_TODWN(l)[23]:BFD session changed to Down. (SlotNumber=0, Discriminator=8192, Diagnostic=DetectDown, Applications=OSPF, ProcessPST=False, BindInterfaceName=GigabitEthernet0/0/1, InterfacePhysicalState=Up, InterfaceProtocolState=Up)

<R1>

Sep 23 2016 03:39:25+00:00 R1 %%01OSPF/3/NBR_CHG_DOWN(l)[24]:Neighbor event:neighbor state changed to Down. (ProcessId=1, NeighborAddress=10.0.12.2, NeighborEvent=KillNbr, NeighborPreviousState=Full, NeighborCurrentState=Down)

<R1>

Sep 23 2016 03:39:25+00:00 R1 %%01OSPF/3/NBR_DOWN_REASON(l)[25]:Neighbor state leaves full or changed to Down. (ProcessId=1, NeighborRouterId=10.0.12.2, NeighborAreaId=0, NeighborInterface=GigabitEthernet0/0/1,NeighborDownImmediate reason=Neighbor Down Due to Kill Neighbor, NeighborDownPrimeReason=BFD Session Down, NeighborChangeTime=2016-09-23 03:39:25)

还有其他关联性日志,此处略,重点是以上的第三条日志。

重新开启接口:

[R2-GigabitEthernet0/0/1]undo shutdown

再次查看BFD会话和OSPF邻居关系:

[R1]display bfd session all

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

Local Remote     PeerIpAddr      State     Type         InterfaceName           

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

8193  8193       10.0.12.2       Up        D_IP_IF      GigabitEthernet0/0/1    

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

     Total UP/DOWN Session Number : 1/0

[R1]display ospf bfd session all

         OSPF Process 1 with Router ID 10.0.12.1

  Area 0.0.0.0 interface 10.0.12.1(GigabitEthernet0/0/1)'s BFD Sessions

 NeighborId:10.0.12.2        AreaId:0.0.0.0          Interface:GigabitEthernet0/0/1

 BFDState:up                 rx    :1000             tx       :1000          

 Multiplier:3                BFD Local Dis:8193      LocalIpAdd:10.0.12.1

 RemoteIpAdd:10.0.12.2       Diagnostic Info:No diagnostic information

[R2]display bfd session all

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

Local Remote     PeerIpAddr      State     Type         InterfaceName           

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

8193  8193       10.0.12.1       Up        D_IP_IF      GigabitEthernet0/0/1    

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

     Total UP/DOWN Session Number : 1/0

[R2]display ospf bfd session all

         OSPF Process 1 with Router ID 10.0.12.2

  Area 0.0.0.0 interface 10.0.12.2(GigabitEthernet0/0/1)'s BFD Sessions

 NeighborId:10.0.12.1        AreaId:0.0.0.0          Interface:GigabitEthernet0/0/1

 BFDState:up                 rx    :1000             tx       :1000          

 Multiplier:3                BFD Local Dis:8193      LocalIpAdd:10.0.12.2

 RemoteIpAdd:10.0.12.1       Diagnostic Info:No diagnostic information

BFD重新建立。

配置文件参考

<R1>display current-configuration

[V200R007C00SPC600]

#

 sysname R1

#

bfd

#

interface GigabitEthernet0/0/1

 ip address 10.0.12.1 255.255.255.0

#

interface LoopBack0

 ip address 10.0.1.1 255.255.255.255

#

ospf 1

 bfd all-interfaces enable

 area 0.0.0.0                             

  network 10.0.1.1 0.0.0.0

  network 10.0.12.0 0.0.0.255

#

return

<R2>display current-configuration

[V200R007C00SPC600]

#

 sysname R2

#

bfd

#

interface GigabitEthernet0/0/1

 ip address 10.0.12.2 255.255.255.0

#

interface LoopBack0

 ip address 10.0.2.2 255.255.255.255

#

ospf 1                                    

 bfd all-interfaces enable

 area 0.0.0.0

  network 10.0.2.2 0.0.0.0

  network 10.0.12.0 0.0.0.255

#

return

猜你喜欢

转载自blog.csdn.net/weixin_57099902/article/details/131808466