SLA-BFD故障检测

 

浮动路由

浮动路由又称为路由备份,两条或多条链路组成浮动路由,相同的目的地址,不同的下一跳地址,另一条下一跳的优先级低

image

Router1 F0/0 <----> Router2 F1/0 
Router2 F0/0 <----> Router3 F1/0 
Router3 F0/0 <----> Router4 F1/0 

SLA是秒级检测,BFD是毫秒级检测 BFD是公有的,SLA是思科私有的,所以在华为上没有SLA

静态路由+SLA故障检测

GW(config)#ip sla monitor 123 
GW(config-sla-monitor)#type e
GW(config-sla-monitor)#type echo pro
GW(config-sla-monitor)#type echo protocol ipi
GW(config-sla-monitor)#type echo protocol ipicmpEcho 100.1.1.1
GW(config-sla-monitor-echo)#freq
GW(config-sla-monitor-echo)#frequency 5
GW(config-sla-monitor-echo)#end           
GW#show run         
Building configuration...

Current configuration : 723 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname GW
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
!
!
ip cef
!
!
ip sla monitor 123
 type echo protocol ipIcmpEcho 100.1.1.1

GW(config)#ip sla monitor schedule 123 start-time now life forever 
GW(config)#track 321 rtr 123
GW(config-track)#end
GW#
*Mar  1 04:07:23.926: %SYS-5-CONFIG_I: Configured from console by console
GW#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
GW(config)#no ip route 0.0.0.0 0.0.0.0 100.1.1.1
GW(config)#ip route 0.0.0.0 0.0.0.0 100.1.1.1 track 321

GW#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is 100.1.1.1 to network 0.0.0.0

     100.0.0.0/24 is subnetted, 1 subnets
C       100.1.1.0 is directly connected, FastEthernet1/0
C    200.1.1.0/24 is directly connected, FastEthernet0/0
S*   0.0.0.0/0 [1/0] via 100.1.1.1

GW#ping 123.1.1.1 repeat 500

ping 的同时在 Telecom路由器down掉接口观察效果,再up接口

Telecom#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Telecom(config)#int f0/0
Telecom(config-if)#sh
Telecom(config-if)#
*Mar  1 04:18:04.726: %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to administratively down
*Mar  1 04:18:05.726: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to down
Telecom(config-if)#no sh
Telecom(config-if)#
*Mar  1 04:19:30.486: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 04:19:31.486: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Telecom(config-if)#

image

CEF表—cisco express forwarding 思科快速转发 //show ip cef CEF基于路由表

image

静态路由+BFD故障检测

按需路由选择ODR(On Demand Routing),ODR基于Cisco发现协议CDP(Cisco discovery protocol),检测设备与设备之间的互联。

image

CDP可以发现相连的对端设备

GW#show cdp neighbors detail 
-------------------------
Device ID: Unicom
Entry address(es): 
  IP address: 200.1.1.1
Platform: Cisco 3640,  Capabilities: Router Switch IGMP 
Interface: FastEthernet0/0,  Port ID (outgoing port): FastEthernet1/0
Holdtime : 127 sec

Version :
Cisco IOS Software, 3600 Software (C3640-IK9O3S-M), Version 12.4(10), RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2006 by Cisco Systems, Inc.
Compiled Wed 16-Aug-06 04:04 by prod_rel_team

advertisement version: 2
VTP Management Domain: ''
Duplex: full

-------------------------
Device ID: Telecom
Entry address(es): 
  IP address: 100.1.1.1
Platform: Cisco 3640,  Capabilities: Router Switch IGMP 
Interface: FastEthernet1/0,  Port ID (outgoing port): FastEthernet0/0
Holdtime : 134 sec
          
Version : 
Cisco IOS Software, 3600 Software (C3640-IK9O3S-M), Version 12.4(10), RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2006 by Cisco Systems, Inc.
Compiled Wed 16-Aug-06 04:04 by prod_rel_team
          
advertisement version: 2
VTP Management Domain: ''
Duplex: full

ODR

image

GW(config)#router odr  ##在核心设备出口开启odr,就可以给下层设备下发odr路由,就不用在下层设备配置默认路由。

image

华为

image

<Huawei>sys
[Huawei]sys Telecom
[Telecom]int e0/0/0
[Telecom-Ethernet0/0/0]ip add 100.1.1.1 255.255.255.0
[Telecom-Ethernet0/0/0]q
[Telecom]interface LoopBack 0
[Telecom-LoopBack0]ip add 123.1.1.1 255.255.255.0
[Telecom-LoopBack0] q
[Huawei]sys 
[Huawei]sys Unicom
[Unicom]int e0/0/0
[Unicom-Ethernet0/0/0]ip add 200.1.1.1 255.255.255.0
[Unicom-Ethernet0/0/0]q
[Unicom]interface LoopBack 0
[Unicom-LoopBack0] ip add 123.1.1.1 255.255.255.0
[Telecom-LoopBack0] q
<Huawei>sys
[Huawei]sys GW
[GW]int e0/0/0
[GW-Ethernet0/0/0]ip add 100.1.1.2 255.255.255.0
[GW-Ethernet0/0/0]q
[GW]int e0/0/1
[GW-Ethernet0/0/1]ip add 200.1.1.2 255.255.255.0
[GW-Ethernet0/0/1]q
[GW]ip route-static 0.0.0.0 0.0.0.0 100.1.1.1     ##华为默认路由是60,而思科是1
[GW]ip route-static 0.0.0.0 0.0.0.0 200.1.1.1 preference 70

[GW]display ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 7        Routes : 7        

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   Static  60   0          RD   100.1.1.1       Ethernet0/0/0
      100.1.1.0/24  Direct  0    0           D   100.1.1.2       Ethernet0/0/0
      100.1.1.2/32  Direct  0    0           D   127.0.0.1       Ethernet0/0/0
      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
      200.1.1.0/24  Direct  0    0           D   200.1.1.2       Ethernet0/0/1
      200.1.1.2/32  Direct  0    0           D   127.0.0.1       Ethernet0/0/1

[GW]int e0/0/0
[GW-Ethernet0/0/0]shutdown 
[GW-Ethernet0/0/0]display ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 5        Routes : 5        

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   Static  70   0          RD   200.1.1.1       Ethernet0/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
      200.1.1.0/24  Direct  0    0           D   200.1.1.2       Ethernet0/0/1
      200.1.1.2/32  Direct  0    0           D   127.0.0.1       Ethernet0/0/1

[GW-Ethernet0/0/0]undo shutdown 
[GW-Ethernet0/0/0]display ip routing-table 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 7        Routes : 7        

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   Static  60   0          RD   100.1.1.1       Ethernet0/0/0
      100.1.1.0/24  Direct  0    0           D   100.1.1.2       Ethernet0/0/0
      100.1.1.2/32  Direct  0    0           D   127.0.0.1       Ethernet0/0/0
      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
      200.1.1.0/24  Direct  0    0           D   200.1.1.2       Ethernet0/0/1
      200.1.1.2/32  Direct  0    0           D   127.0.0.1       Ethernet0/0/1

[GW-Ethernet0/0/0]ping -c 20 123.1.1.1

电信接口模拟down,发现无法故障切换路由

[Telecom]int e0/0/0
[Telecom-Ethernet0/0/0]shutdown 

image

[Telecom-Ethernet0/0/0]undo shutdown
[GW-Ethernet0/0/0]q
[GW]bfd ##全局开启bfd
[GW-bfd]q
[GW]bfd CCIE bind peer-ip 100.1.1.1 interface e0/0/0 one-arm-echo  ##开启bfd,网关e0/0/0接口检测对端100.1.1.1,单臂回声模式
[GW-bfd-session-CCIE]min-echo-rx-interval 100  ##100ms
[GW-bfd-session-CCIE]discriminator local 123  ##本地回声标识符
[GW-bfd-session-CCIE]commit ##生效开启
[GW-bfd-session-CCIE]q
[GW]undo ip route-static 0.0.0.0 0.0.0.0 100.1.1.1 ##取消静态路由
[GW]ip route-static 0.0.0.0 0.0.0.0 100.1.1.1 track bfd-session CCIE ##重新设置静态路由挂接bfd
[GW]ping -c 20 123.1.1.1
[Telecom]int e0/0/0
[Telecom-Ethernet0/0/0]shutdown

image

image

[Telecom]int e0/0/0
[Telecom-Ethernet0/0/0]undo shutdown 

动态路由+BFD故障检测

image

[GW]undo ip route-static 0.0.0.0 0.0.0.0 200.1.1.1 preference 70
[GW]undo ip route-static 0.0.0.0 0.0.0.0 100.1.1.1 track bfd-session 
[GW]undo bfd
Warning: All BFD capability on the device will be deleted. Continue? [Y/N]y
[GW]display current-configuration  ##查看配置bfd是否消失
[GW]undo ip route-static 0.0.0.0 0.0.0.0 100.1.1.1
[Telecom]sysname R1
[Unicom]sys R2
[R1]ospf 100
[R1-ospf-100]area 0
[R1-ospf-100-area-0.0.0.0]
[R1-ospf-100-area-0.0.0.0]network 0.0.0.0 0.0.0.0 
[R1-ospf-100-area-0.0.0.0]q
[R1-ospf-100]

[R2]ospf 100
[R2-ospf-100]area 0
[R2-ospf-100-area-0.0.0.0]
[R2-ospf-100-area-0.0.0.0]network 0.0.0.0 0.0.0.0 
[R2-ospf-100-area-0.0.0.0]q
[R2-ospf-100]
[GW]ospf 100
[GW-ospf-100]area 0
[GW-ospf-100-area-0.0.0.0]network 0.0.0.0 0.0.0.0
[GW-ospf-100-area-0.0.0.0]q
[GW-ospf-100]display ospf peer brief

	 OSPF Process 100 with Router ID 100.1.1.2
		  Peer Statistic Information
 ----------------------------------------------------------------------------
 Area Id          Interface                        Neighbor id      State    
 0.0.0.0          Ethernet0/0/0                    100.1.1.1        Full        
 0.0.0.0          Ethernet0/0/1                    200.1.1.1        Full        
 ----------------------------------------------------------------------------
[GW-ospf-100]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 7        Routes : 8        

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

      100.1.1.0/24  Direct  0    0           D   100.1.1.2       Ethernet0/0/0
      100.1.1.2/32  Direct  0    0           D   127.0.0.1       Ethernet0/0/0
      123.1.1.1/32  OSPF    10   1           D   200.1.1.1       Ethernet0/0/1
                    OSPF    10   1           D   100.1.1.1       Ethernet0/0/0
      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
      200.1.1.0/24  Direct  0    0           D   200.1.1.2       Ethernet0/0/1
      200.1.1.2/32  Direct  0    0           D   127.0.0.1       Ethernet0/0/1

[R1-Ethernet0/0/0]shutdown  ##在R1的e0/0/0接口断掉
##等待40s,邻居才断掉
[GW-ospf-100]display ospf peer brief

	 OSPF Process 100 with Router ID 100.1.1.2
		  Peer Statistic Information
 ----------------------------------------------------------------------------
 Area Id          Interface                        Neighbor id      State    
 0.0.0.0          Ethernet0/0/1                    200.1.1.1        Full        
 ----------------------------------------------------------------------------
[GW-ospf-100]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
         Destinations : 7        Routes : 7        

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

      100.1.1.0/24  Direct  0    0           D   100.1.1.2       Ethernet0/0/0
      100.1.1.2/32  Direct  0    0           D   127.0.0.1       Ethernet0/0/0
      123.1.1.1/32  OSPF    10   1           D   200.1.1.1       Ethernet0/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
      200.1.1.0/24  Direct  0    0           D   200.1.1.2       Ethernet0/0/1
      200.1.1.2/32  Direct  0    0           D   127.0.0.1       Ethernet0/0/1
[GW]bfd
[GW-bfd]q
[GW]ospf 100 
[GW-ospf-100]bfd all	
[GW-ospf-100]bfd all-interfaces en	
[GW-ospf-100]bfd all-interfaces enable 
[R1]bfd
[R1-bfd]q
[R1]ospf 100
[R1-ospf-100]bfd all	
[R1-ospf-100]bfd all-interfaces en	
[R1-ospf-100]bfd all-interfaces enable 

image

image