欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

静态路由调用BFD

程序员文章站 2022-06-21 18:53:53
...
BFD:双向转发检查

作用:毫秒级故障检查,通常结合三层协议(如静态路由、vrrp、ospf、BGP等)实现链路故障快速检查

静态路由调用BFD

R1
<Huawei>system-view     //进入全局模式 
[Huawei]sysname R1     //改名
[R1]undo info-center enable     //关闭信息告警提示
[R1]interface LoopBack 0     //进入LoopBack 0接口
[R1-LoopBack0]ip address 1.1.1.1 24     //设置IP地址
[R1-LoopBack0]interface g0/0/0     //进入接口
[R1-GigabitEthernet0/0/0]ip address 12.1.1.1 24     //设置IP地址
[R1-GigabitEthernet0/0/0]interface g0/0/1     //进入接口
[R1-GigabitEthernet0/0/1]ip address 21.1.1.1 24     //设置IP地址
[R1-GigabitEthernet0/0/1]quit     //退出
[R1]ip route-static 2.2.2.0 255.255.255.0 21.1.1.2     //配置静态路由
[R1]ip route-static 2.2.2.0 255.255.255.0 12.1.1.2 preference 70     //配置静态路由及优先级(默认为60)
R2
<Huawei>system-view     //进入全局模式
[Huawei]sysname R2     //改名
[R2]undo info-center en     //关闭信息告警提示	
[R2]interface LoopBack 0     //进入LoopBack 0接口
[R2-LoopBack0]ip address 2.2.2.2 24     //设置IP地址
[R2-LoopBack0]interface g0/0/0     //进入接口
[R2-GigabitEthernet0/0/0]ip address 12.1.1.2 24     //设置IP地址
[R2-GigabitEthernet0/0/0]interface g0/0/1     //进入接口
[R2-GigabitEthernet0/0/1]ip address 21.1.1.2 24     //设置IP地址
[R2-GigabitEthernet0/0/1]quit     //退出
[R2]ip route-static 1.1.1.0 255.255.255.0 21.1.1.1     //配置静态路由
[R2]ip route-static 1.1.1.0 255.255.255.0 12.1.1.1 preference 70     //配置静态路由以及优先级(默认为60)
R1
R1
[R1]dis ip routing-table     //查看路由表 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 16       Routes : 14       

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.0/24  Static  60   0          RD   21.1.1.2        GigabitEthernet     默认优先级的线路
0/0/1
       12.1.1.0/24  Direct  0    0           D   12.1.1.1        GigabitEthernet
0/0/0
       12.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
     12.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
       21.1.1.0/24  Direct  0    0           D   21.1.1.1        GigabitEthernet
0/0/1
       21.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
     21.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
      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
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

[R1]
R1
[R1]bfd     //全局使能BFD 
[R1-bfd]quit     //退出 
[R1]bfd 1 bind peer-ip 21.1.1.2 source-ip 21.1.1.1     //配置BFD组1
[R1-bfd-session-1]discriminator local 1     //本地标识1(标识需要相互堆成)
[R1-bfd-session-1]discriminator remote 2     //对端标识2
[R1-bfd-session-1]commit     //确认提交
[R1-bfd-session-1]quit     //退出
[R1]ip route-static 2.2.2.0 24 21.1.1.2 track bfd-session 1     //静态路由调用BFD
R2
[R2]bfd     //全局使能BFD
[R2-bfd]quit     // 退出
[R2]bfd 1 bind peer-ip 21.1.1.1 source-ip 21.1.1.2     //配置BFD组1
[R2-bfd-session-1]discriminator local 2     //本地标识2(标识需要相互堆成)
[R2-bfd-session-1]discriminator remote 1     //对端标识1
[R2-bfd-session-1]commit     //确认提交
[R2-bfd-session-1]quit     //退出
[R2]ip route-static 1.1.1.0 24 21.1.1.1 track bfd-session 1     //静态路由调用BFD

静态路由调用BFD

R1
[R1]dis ip routing-table     //查看路由表 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 16       Routes : 14       

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.0/24  Static  70   0          RD   12.1.1.2        GigabitEthernet     //线路已切换过来
0/0/0
       12.1.1.0/24  Direct  0    0           D   12.1.1.1        GigabitEthernet
0/0/0
       12.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
     12.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/0
       21.1.1.0/24  Direct  0    0           D   21.1.1.1        GigabitEthernet
0/0/1
       21.1.1.1/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
     21.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet
0/0/1
      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
255.255.255.255/32  Direct  0    0           D   127.0.0.1       InLoopBack0

[R1]
R1
[R1]dis bfd session all     //查看BFD信息 
--------------------------------------------------------------------------------
Local Remote     PeerIpAddr      State     Type        InterfaceName            
--------------------------------------------------------------------------------

1     2          21.1.1.2        Down      S_IP_PEER         -                  
--------------------------------------------------------------------------------
     Total UP/DOWN Session Number : 0/1
[R1]
[R1]dis bfd session all verbose     //查看BFD详细信息
--------------------------------------------------------------------------------
Session MIndex : 256       (Multi Hop) State : Down      Name : 1              
--------------------------------------------------------------------------------
  Local Discriminator    : 1                Remote Discriminator   : 2         
  Session Detect Mode    : Asynchronous Mode Without Echo Function             
  BFD Bind Type          : Peer IP Address                                     
  Bind Session Type      : Static                                              
  Bind Peer IP Address   : 21.1.1.2                                            
  Bind Interface         : -                                                   
  Track Interface        : -                                                   
  Bind Source IP Address : 21.1.1.1                                            
  FSM Board Id           : 0                TOS-EXP                : 7         
  Min Tx Interval (ms)   : 1000             Min Rx Interval (ms)   : 1000      
  Actual Tx Interval (ms): 10500            Actual Rx Interval (ms): 10500     
  Local Detect Multi     : 3                Detect Interval (ms)   : -         
  Echo Passive           : Disable          Acl Number             : -         
  Destination Port       : 3784             TTL                    : 254       
  Proc Interface Status  : Disable          Process PST            : Disable   
  WTR Interval (ms)      : -                                                   
  Active Multi           : 3                                                   
  Last Local Diagnostic  : Control Detection Time Expired                      
  Bind Application       : No Application Bind
  Session TX TmrID       : 1036             Session Detect TmrID   : -         
  Session Init TmrID     : -                Session WTR TmrID      : -         
  Session Echo Tx TmrID  : -                                                   
  PDT Index              : FSM-0 | RCV-0 | IF-0 | TOKEN-0                      
  Session Description    : -                                                   
--------------------------------------------------------------------------------

     Total UP/DOWN Session Number : 0/1
[R1]