华为CE交换机-配置BFD for IPv4多跳检测

配置BFD for IPv4多跳检测

组网需求

为快速检测和监控网络中的多跳路径,可以配置BFD会话。如图1所示,使用BFD异步模式检测DeviceA和DeviceC之间的多跳路径。

图1 配置BFD for IPv4多跳检测组网图

华为CE交换机-配置BFD for IPv4多跳检测

本例中interface1,interface2分别代表100GE1/0/1,100GE1/0/2。

华为CE交换机-配置BFD for IPv4多跳检测

配置思路

采用如下思路配置BFD多跳检测:

  1. 配置DeviceA、DeviceB和DeviceC的接口IPv4地址,使设备之间路由可达。

  2. 在DeviceA上配置BFD会话,检测DeviceA到DeviceC的多跳路径;在DeviceC上配置BFD会话,检测DeviceC到DeviceA的多跳路径。

操作步骤

  1. 配置DeviceA、DeviceB和DeviceC之间的相互路由可达。

    # 配置DeviceA的接口IPv4地址。

    <HUAWEI> system-view
    [~HUAWEI] sysname DeviceA
    [*HUAWEI] commit
    [~DeviceA] interface 100ge 1/0/1 
    [~DeviceA-100GE1/0/1] undo portswitch
    [*DeviceA-100GE1/0/1] ip address 10.1.1.1 24
    [*DeviceA-100GE1/0/1] quit
    [*DeviceA] commit

    # 配置DeviceB的接口IPv4地址。

    <HUAWEI> system-view
    [~HUAWEI] sysname DeviceB
    [*HUAWEI] commit
    [~DeviceB] interface 100ge 1/0/1
    [~DeviceB-100GE1/0/1] undo portswitch
    [*DeviceB-100GE1/0/1] ip address 10.1.1.2 24
    [*DeviceB-100GE1/0/1] quit
    [*DeviceB] commit
    [~DeviceB] interface 100ge 1/0/2
    [~DeviceB-100GE1/0/2] undo portswitch
    [*DeviceB-100GE1/0/2] ip address 10.2.1.1 24
    [*DeviceB-100GE1/0/2] quit
    [*DeviceB] commit

    # 配置DeviceC的接口IPv4地址。

    <HUAWEI> system-view
    [~HUAWEI] sysname DeviceC
    [*HUAWEI] commit
    [~DeviceC] interface 100ge 1/0/1
    [~DeviceC-100GE1/0/1] undo portswitch
    [*DeviceC-100GE1/0/1] ip address 10.2.1.2 24
    [*DeviceC-100GE1/0/1] quit
    [*DeviceC] commit

    # 配置静态路由。

    [~DeviceA] ip route-static 10.2.1.0 255.255.255.0 10.1.1.2
    [*DeviceA] commit
    [~DeviceC] ip route-static 10.1.1.0 255.255.255.0 10.2.1.1
    [*DeviceC] commit
  2. 配置DeviceA和DeviceC之间的多跳路径检测。

    # 在DeviceA上使能BFD,并配置与DeviceC之间的BFD会话。不需要绑定接口。

    [~DeviceA] bfd
    [*DeviceA-bfd] quit
    [*DeviceA] bfd atoc bind peer-ip 10.2.1.2
    [*DeviceA-bfd-session-atoc] discriminator local 10
    [*DeviceA-bfd-session-atoc] discriminator remote 20
    [*DeviceA-bfd-session-atoc] quit
    [*DeviceA] commit

    # 在DeviceC上使能BFD,并配置与DeviceA之间的BFD会话。不需要绑定接口。

    [~DeviceC] bfd
    [*DeviceC-bfd] quit
    [*DeviceC] bfd ctoa bind peer-ip 10.1.1.1
    [*DeviceC-bfd-session-ctoa] discriminator local 20
    [*DeviceC-bfd-session-ctoa] discriminator remote 10
    [*DeviceC-bfd-session-ctoa] quit
    [*DeviceC] commit

检查配置结果

# 配置完成后,可以在DeviceA和DeviceC上查看BFD会话详细信息。以DeviceA的显示结果为例。

[~DeviceA] display bfd session all verbose
2020-01-01 11:21:06.8 
(w): State in WTR  
(*): State is invalid   
Total UP/DOWN Session Number : 1/0
------------------------------------------------------------------------------
  Name : atoc                         (Multiple Hops)  State : Up      
------------------------------------------------------------------------------
  Local Discriminator    : 10             Remote Discriminator    : 20
  Session Detect Mode    : Asynchronous Mode Without Echo Function
  BFD Bind Type          : Peer Ip Address
  Bind Session Type      : Static
  Bind Peer IP Address   : 10.2.1.2
  Bind Interface         : -   
  FSM Board ID           : 1               TOS-EXP               : 7
  Min Tx Interval (ms)   : 1000      Min Rx Interval (ms)   : 1000
  Actual Tx Interval (ms): 1000             Actual Rx Interval (ms): 1000
  WTR Interval (ms)      : -                Detect Interval (ms)   : 3000
  Local Detect Multi     : 3                Active Multi           : -
  Echo Passive           : Disable          Acl Number             : -
  Destination Port       : 4784             TTL                    : 254
  Proc Interface Status  : Disable          Process PST            : Disable
  Config PST             : Disable
  Last Local Diagnostic  : No Diagnostic
  Bind Application       : No Application Bind
  Session Description    : -
------------------------------------------------------------------------------

可以查看到建立了一个多跳(Multiple Hops)的BFD会话,且状态为Up。

# 对DeviceA的100GE1/0/1接口执行shutdown操作,模拟链路故障。

[~DeviceA] interface 100ge 1/0/1
[~DeviceA-100GE1/0/1] shutdown
[~DeviceA-100GE1/0/1] quit

# 在DeviceA和DeviceC上查看BFD会话的状态。以DeviceA的显示结果为例。

[DeviceA] display bfd session all verbose
2020-01-01 11:21:06.8
(w): State in WTR  
(*): State is invalid   
Total UP/DOWN Session Number : 1/0
------------------------------------------------------------------------------
  Name : atoc                         (Multiple Hops)  State : Down   
------------------------------------------------------------------------------
  Local Discriminator    : 10             Remote Discriminator    : 20
  Session Detect Mode    : Asynchronous Mode Without Echo Function
  BFD Bind Type          : Peer Ip Address
  Bind Session Type      : Static
  Bind Peer IP Address   : 10.2.1.2
  Bind Interface         : -   
  FSM Board ID           : 1               TOS-EXP               : 7
  Min Tx Interval (ms)   : 1000      Min Rx Interval (ms)   : 1000
  Actual Tx Interval (ms): 1000             Actual Rx Interval (ms): 1000
  WTR Interval (ms)      : -                Detect Interval (ms)   : 3000
  Local Detect Multi     : 3                Active Multi           : -
  Destination Port       : 4784             TTL                    : 254
  Last Local Diagnostic  : No Diagnostic
  Bind Application       : No Application Bind
  Session Not Up Reason  : In negotiation  
  Session Description    : - 
------------------------------------------------------------------------------

可以查看到BFD会话的状态为Down。

配置脚本

  • DeviceA

    #
    sysname DeviceA
    #
    bfd
    #
    interface 100GE1/0/1
     undo portswitch
     ip address 10.1.1.1 255.255.255.0
    #
    #
    ip route-static 10.2.1.0 255.255.255.0 10.1.1.2
    #
    bfd atoc bind peer-ip 10.2.1.2
     discriminator local 10
     discriminator remote 20
    #
    return
  • DeviceB

    #
    sysname DeviceB
    #
    interface 100GE1/0/1
     undo portswitch
     ip address 10.1.1.2 255.255.255.0
    #
    interface 100GE1/0/2
     undo portswitch
     ip address 10.2.1.1 255.255.255.0
    #
    return

  • DeviceC

    #
    sysname DeviceC
    #
    bfd
    #
    interface 100GE1/0/1
     undo portswitch
     ip address 10.2.1.2 255.255.255.0
    #
    ip route-static 10.1.1.0 255.255.255.0 10.2.1.1
    #
    bfd ctoa bind peer-ip 10.1.1.1
     discriminator local 20
     discriminator remote 10
    #
    return
上一篇 Linux 内核中的文件系统缓存机制:提升 I/O 性能的关键
下一篇 云服务器和物理服务器的性能有何不同?