天天看點

ensp-BFD實驗簡介簡單實驗拓撲ospf 調用bfd 加快收斂

簡介

BFD:BFD:BidirectionalForwarding Detection,雙向轉發檢查 作用:毫秒級故障檢查,通常結合三層協定(如靜态路由、vrrp、ospf、BGP等)實作鍊路故障快速檢查

簡單實驗拓撲

ensp-BFD實驗簡介簡單實驗拓撲ospf 調用bfd 加快收斂

AR1:

[AR1]ip route-static 2.2.2.0 24 12.1.1.2
[AR1]ip route-static 2.2.2.0 24 21.1.1.2 preference 70
           

AR2:

[AR2]ip route-static 1.1.1.0 24 12.1.1.1
[AR2]ip route-static 1.1.1.1 24 21.1.1.1 preference 70
           
[AR1]ping -a 1.1.1.1 2.2.2.2
  PING 2.2.2.2: 56  data bytes, press CTRL_C to break
    Reply from 2.2.2.2: bytes=56 Sequence=1 ttl=255 time=470 ms
    Reply from 2.2.2.2: bytes=56 Sequence=2 ttl=255 time=60 ms
    Reply from 2.2.2.2: bytes=56 Sequence=3 ttl=255 time=40 ms
    Reply from 2.2.2.2: bytes=56 Sequence=4 ttl=255 time=40 ms
    Reply from 2.2.2.2: bytes=56 Sequence=5 ttl=255 time=40 ms

  --- 2.2.2.2 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 40/130/470 ms
           

R1:

[AR1]bfd
[AR1]bfd 1 bind peer-ip 12.1.1.2 source-ip 12.1.1.1
[AR1-bfd-session-1]discriminator local 1 #配置本地辨別
[AR1-bfd-session-1]discriminator remote 2 #配置遠端辨別
[AR1-bfd-session-1]comm	
[AR1-bfd-session-1]commit  #送出
           

R2:

bfd
bfd 1 bind peer-ip 12.1.1.1 source-ip 12.1.1.2  
 	discriminator local 2
	discriminator remote 1 
    commit 
           

在靜态路由上配置bfd:

R1:

[AR1]ip route-static 2.2.2.0 24 12.1.1.2 track bfd-session 1
           

R2:

[AR2]ip route-static 1.1.1.0 24 12.1.1.1 track bfd-session 1
1
           
檢視bfd資訊
[AR1]dis bfd session all
--------------------------------------------------------------------------------
Local Remote     PeerIpAddr      State     Type        InterfaceName            
--------------------------------------------------------------------------------

1     2          12.1.1.2        Up        S_IP_PEER         -                  
--------------------------------------------------------------------------------
     Total UP/DOWN Session Number : 1/0
           

檢視更加詳細的bfd資訊:

[AR1]dis bfd session all verbose 
--------------------------------------------------------------------------------
Session MIndex : 256       (Multi Hop) State : Up        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   : 12.1.1.2                                            
  Bind Interface         : -                                                   
  Track Interface        : -                                                   
  Bind Source IP Address : 12.1.1.1                                            
  FSM Board Id           : 0                TOS-EXP                : 7         
  Min Tx Interval (ms)   : 1000             Min Rx Interval (ms)   : 1000      
  Actual Tx Interval (ms): 1000             Actual Rx Interval (ms): 1000      
  Local Detect Multi     : 3                Detect Interval (ms)   : 3000      
  Echo Passive           : Disable          Acl Number             : -         
           

ospf 調用bfd 加快收斂

前言:ospf預設的hello封包是10秒鐘發一次,檢測到故障是40秒也就是需要四十秒才能将那個有問題的路由清除,在ospf上調用bfd可以起到快速收斂的作用

實驗拓撲:

ensp-BFD實驗簡介簡單實驗拓撲ospf 調用bfd 加快收斂

AR1:

[AR1]ospf 1
[AR1-ospf-1]area 0
[AR1-ospf-1-area-0.0.0.0]network 12.1.1.0 0.0.0.255
[AR1-ospf-1-area-0.0.0.0]network 1.1.1.0 0.0.0.255
[AR1]ospf 1
[AR1-ospf-1]bfd all-interfaces enable
           

AR2:

[AR2]ospf 1
[AR2-ospf-1]area 0
[AR2-ospf-1-area-0.0.0.0]net	
[AR2-ospf-1-area-0.0.0.0]network 12.1.1.0 0.0.0.255 
[AR2-ospf-1-area-0.0.0.0]network 2.2.2.0 0.0.0.255
[AR2]ospf 1
[AR2-ospf-1]bfd all-interfaces enable
           

如果我們把右邊的網線斷開,如果通過ospf去收斂的話需要幾十秒,但是通過調用bfd幾秒就可以收斂完成

[AR1]dis ospf peer brief 

	 OSPF Process 1 with Router ID 12.1.1.1
		  Peer Statistic Information
 ----------------------------------------------------------------------------
 Area Id          Interface                        Neighbor id      State    
 0.0.0.0          GigabitEthernet0/0/0             12.1.1.2         Full        
 ----------------------------------------------------------------------------
           

繼續閱讀