关于IP SLA及与EEM联动的探讨<3>

在上一篇文章中《 关于IP SLA及与EEM联动的探讨<2> 》,我们发现了第一种解决方案有问题,那么如何才能规避这种问题?或者说如何顺利满足要求呢?
其实在track中有非常方便的方法实现客户的要求,如下所示。

Config:

ip sla monitor 17
 type echo protocol ipIcmpEcho 12.1.1.2
 timeout 3000
 frequency 10
ip sla monitor schedule 17 life forever start-time now
!
track 1 rtr 17
 delay down 30
<---用这个可以很简单的实现客户的需求
!

event manager session cli username "username"
event manager applet test_track_17
 event track 1 state down
 action 1.0 cli command "enable"
 action 2.0 cli command "conf t"
 action 3.0 cli command "int s1/0"
 action 3.1 cli command "shut"
 action 3.2 cli command "no shut"
 action 4.0 cli command "end"

Debug information:

1. default config and no action

R1#debug ip sla monitor trace
 IP SLA Monitor TRACE debugging for all operations is on
R1#
R1#
R1#debug track

*Feb 25 11:06:04.091: IP SLA Monitor(17) Scheduler: Starting an operation
*Feb 25 11:06:04.091: IP SLA Monitor(17) echo operation: Sending an echo operation
*Feb 25 11:06:04.135: Track: 1 Adding rtr object
*Feb 25 11:06:04.139: Track: Initialise
*Feb 25 11:06:04.143: Track: 1 New rtr 17, state Down
*Feb 25 11:06:04.147: Track: Starting process
*Feb 25 11:06:04.155: IP SLA Monitor(17) echo operation: RTT=59
*Feb 25 11:06:04.159: IP SLA Monitor(17) Scheduler: Updating result
*Feb 25 11:06:09.143: Track: 1 Change #2 rtr 17, state Down->Up
R1(config-applet)#
R1(config-applet)#
R1(config-applet)#
R1(config-applet)#
R1(config-applet)#
*Feb 25 11:06:14.091: IP SLA Monitor(17) Scheduler: Starting an operation
*Feb 25 11:06:14.091: IP SLA Monitor(17) echo operation: Sending an echo operation
*Feb 25 11:06:14.159: IP SLA Monitor(17) echo operation: RTT=63
*Feb 25 11:06:14.163: IP SLA Monitor(17) Scheduler: Updating result
*Feb 25 11:06:32.743: Track: 1 Start tracking by  - 166397635de

R1#sh track
Track 1
 Response Time Reporter 17 state
  State is Up
    2 changes, last change 00:08:33
  Delay down 30 secs
  Latest operation return code: OK
  Latest RTT (millisecs) 44
  Tracked by:
     applet test_track_17

2. the link down and not recovery in 30
注意:由于上面设备出了点问题,现在换成别的设备,配置基本一样,只不过ip sla monitor 被 ip sla取代了。

C7304_CE2#config ter
Enter configuration commands, one per line.  End with CNTL/Z.
C7304_CE2(config)#int g0/0
C7304_CE2(config-if)#shut
C7304_CE2(config-if)#end
C7304_CE2#
C7304_CE2#
C7304_CE2#
02:44:06: %SYS-5-CONFIG_I: Configured from console by console
02:44:08: %LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to administratively down
02:44:09: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to down
02:44:09: IP SLAs (17) Scheduler: saaSchedulerEventWakeup
02:44:09: IP SLAs (17) Scheduler: Starting an operation
02:44:09: IP SLAs (17) echo operation: Sending an echo operation
02:44:12: IP SLAs (17) echo operation: Timeout
02:44:12: IP SLAs (17) Scheduler: Updating result
02:44:15: Track: 1 Down change delayed for 30 secs
02:44:19: IP SLAs (17) Scheduler: saaSchedulerEventWakeup
02:44:19: IP SLAs (17) Scheduler: Starting an operation
02:44:19: IP SLAs (17) echo operation: Sending an echo operation
02:44:22: IP SLAs (17) echo operation: Timeout
02:44:22: IP SLAs (17) Scheduler: Updating result
02:44:29: IP SLAs (17) Scheduler: saaSchedulerEventWakeup
02:44:29: IP SLAs (17) Scheduler: Starting an operation
02:44:29: IP SLAs (17) echo operation: Sending an echo operation
02:44:32: IP SLAs (17) echo operation: Timeout
02:44:32: IP SLAs (17) Scheduler: Updating result
02:44:39: IP SLAs (17) Scheduler: saaSchedulerEventWakeup
02:44:39: IP SLAs (17) Scheduler: Starting an operation
02:44:39: IP SLAs (17) echo operation: Sending an echo operation
02:44:42: IP SLAs (17) echo operation: Timeout
02:44:42: IP SLAs (17) Scheduler: Updating result
02:44:45: Track: 1 Down change delay expired
02:44:45: Track: 1 Change #4 rtr 17, state Up->Down
02:44:45: %TRACKING-5-STATE: 1 rtr 17 state Up->Down
02:44:45: %HA_EM-6-LOG: test_track_17 : DEBUG(cli_lib) : : CTL : cli_open called.
02:44:45: %HA_EM-6-LOG: test_track_17 : DEBUG(cli_lib) : : OUT : C7304_CE2>
02:44:45: %HA_EM-6-LOG: test_track_17 : DEBUG(cli_lib) : : IN  : C7304_CE2>enable
02:44:45: %HA_EM-6-LOG: test_track_17 : DEBUG(cli_lib) : : OUT : C7304_CE2#
02:44:45: %HA_EM-6-LOG: test_track_17 : DEBUG(cli_lib) : : IN  : C7304_CE2#conf t
02:44:45: %HA_EM-6-LOG: test_track_17 : DEBUG(cli_lib) : : OUT : Enter configuration commands, one per line.  End with CNTL/Z.
02:44:45: %HA_EM-6-LOG: test_track_17 : DEBUG(cli_lib) : : OUT : C7304_CE2(config)#
02:44:45: %HA_EM-6-LOG: test_track_17 : DEBUG(cli_lib) : : IN  : C7304_CE2(config)#int g0/0
02:44:45: %HA_EM-6-LOG: test_track_17 : DEBUG(cli_lib) : : OUT : C7304_CE2(config-if)#
02:44:45: %HA_EM-6-LOG: test_track_17 : DEBUG(cli_lib) : : IN  : C7304_CE2(config-if)#shut
02:44:45: %HA_EM-6-LOG: test_track_17 : DEBUG(cli_lib) : : OUT : C7304_CE2(config-if)#
02:44:45: %HA_EM-6-LOG: test_track_17 : DEBUG(cli_lib) : : IN  : C7304_CE2(config-if)#no shut
02:44:45: %HA_EM-6-LOG: test_track_17 : DEBUG(cli_lib) : : OUT : C7304_CE2(config-if)#
02:44:45: %HA_EM-6-LOG: test_track_17 : DEBUG(cli_lib) : : IN  : C7304_CE2(config-if)#end
02:44:45: %SYS-5-CONFIG_I: Configured from console by name on vty0 (EEM:test_track_17)
02:44:45: %HA_EM-6-LOG: test_track_17 : DEBUG(cli_lib) : : OUT : C7304_CE2#
02:44:45: %HA_EM-6-LOG: test_track_17 : DEBUG(cli_lib) : : CTL : cli_close called.
02:44:47: %LINK-3-UPDOWN: Interface GigabitEthernet0/0, changed state to up
02:44:48: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
02:44:49: IP SLAs (17) Scheduler: saaSchedulerEventWakeup
02:44:49: IP SLAs (17) Scheduler: Starting an operation
02:44:49: IP SLAs (17) echo operation: Sending an echo operation
02:44:49: IP SLAs (17) echo operation: RTT=1
02:44:49: IP SLAs (17) Scheduler: Updating result
02:44:50: Track: 1 Change #5 rtr 17, state Down->Up
02:44:50: %TRACKING-5-STATE: 1 rtr 17 state Down->Up
C7304_CE2#
C7304_CE2#
C7304_CE2#un all
02:44:59: IP SLAs (17) Scheduler: saaSchedulerEventWakeup
02:44:59: IP SLAs (17) Scheduler: Starting an operation
02:44:59: IP SLAs (17) echo operation: Sending an echo operation
02:44:59: IP SLAs (17) echo operation: RTT=1
02:44:59: IP SLAs (17) Scheduler: Updating result
All possible debugging has been turned off
C7304_CE2#
C7304_CE2#sh track
Track 1
  Response Time Reporter 17 state
  State is Up
    5 changes, last change 00:00:14
  Delay down 30 secs
  Latest operation return code: OK
  Latest RTT (millisecs) 1
  Tracked by:
EEM applet test_track_17

3. the link down, but recovery in 30s.

C7304_CE2#config ter
Enter configuration commands, one per line.  End with CNTL/Z.
C7304_CE2(config)#int g0/0
C7304_CE2(config-if)#
C7304_CE2(config-if)#
02:51:49: IP SLAs (17) Scheduler: saaSchedulerEventWakeup
02:51:49: IP SLAs (17) Scheduler: Starting an operation
02:51:49: IP SLAs (17) echo operation: Sending an echo operation
02:51:49: IP SLAs (17) echo operation: RTT=1
02:51:49: IP SLAs (17) Scheduler: Updating result
C7304_CE2(config-if)#
C7304_CE2(config-if)#
C7304_CE2(config-if)#shut
C7304_CE2(config-if)#
C7304_CE2(config-if)#
02:51:58: %LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to administratively down
02:51:59: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to down
02:51:59: IP SLAs (17) Scheduler: saaSchedulerEventWakeup
02:51:59: IP SLAs (17) Scheduler: Starting an operation
02:51:59: IP SLAs (17) echo operation: Sending an echo operation
02:52:02: IP SLAs (17) echo operation: Timeout
02:52:02: IP SLAs (17) Scheduler: Updating result
02:52:05: Track: 1 Down change delayed for 30 secs
C7304_CE2(config-if)#
C7304_CE2(config-if)#
C7304_CE2(config-if)#
C7304_CE2(config-if)#
C7304_CE2(config-if)#do sh track
Track 1
  Response Time Reporter 17 state
  State is Up, delayed Down (24 secs remaining)
    7 changes, last change 00:00:30
  Delay down 30 secs
  Latest operation return code: OK
  Latest RTT (millisecs) 1
  Tracked by:
    EEM applet test_track_17
C7304_CE2(config-if)#
C7304_CE2(config-if)#
C7304_CE2(config-if)#
02:52:09: IP SLAs (17) Scheduler: saaSchedulerEventWakeup
02:52:09: IP SLAs (17) Scheduler: Starting an operation
02:52:09: IP SLAs (17) echo operation: Sending an echo operation
02:52:12: IP SLAs (17) echo operation: Timeout
02:52:12: IP SLAs (17) Scheduler: Updating result
C7304_CE2(config-if)#
C7304_CE2(config-if)#
C7304_CE2(config-if)#no shut
C7304_CE2(config-if)#
C7304_CE2(config-if)#
C7304_CE2(config-if)#do sh track
Track 1
  Response Time Reporter 17 state
  State is Up, delayed Down (15 secs remaining)
    7 changes, last change 00:00:39
  Delay down 30 secs
  Latest operation return code: OK
  Latest RTT (millisecs) 1
  Tracked by:
    EEM applet test_track_17
C7304_CE2(config-if)#
02:52:18: %LINK-3-UPDOWN: Interface GigabitEthernet0/0, changed state to up
02:52:19: IP SLAs (17) Scheduler: saaSchedulerEventWakeup
02:52:19: IP SLAs (17) Scheduler: Starting an operation
02:52:19: IP SLAs (17) echo operation: Sending an echo operation
02:52:19: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
02:52:22: IP SLAs (17) echo operation: Timeout
02:52:22: IP SLAs (17) Scheduler: Updating result
C7304_CE2(config-if)#
C7304_CE2(config-if)#
C7304_CE2(config-if)#
C7304_CE2(config-if)#
C7304_CE2(config-if)#do sh track
Track 1
  Response Time Reporter 17 state
State is Up, delayed Down (6 secs remaining)
    7 changes, last change 00:00:48
  Delay down 30 secs
  Latest operation return code: OK
  Latest RTT (millisecs) 1
  Tracked by:
    EEM applet test_track_17
C7304_CE2(config-if)#
C7304_CE2(config-if)#
C7304_CE2(config-if)#do sh track
Track 1
  Response Time Reporter 17 state
  State is Up
    7 changes, last change 00:00:50
  Delay down 30 secs
  Latest operation return code: OK
  Latest RTT (millisecs) 1
  Tracked by:
    EEM applet test_track_17
C7304_CE2(config-if)#
02:52:29: IP SLAs (17) Scheduler: saaSchedulerEventWakeup
02:52:29: IP SLAs (17) Scheduler: Starting an operation
02:52:29: IP SLAs (17) echo operation: Sending an echo operation
02:52:29: IP SLAs (17) echo operation: RTT=1
02:52:29: IP SLAs (17) Scheduler: Updating result
02:52:30: Track: 1 Down change delay cancelled
C7304_CE2(config-if)#
C7304_CE2(config-if)#do sh track
Track 1
  Response Time Reporter 17 state
  State is Up
    7 changes, last change 00:00:53
  Delay down 30 secs
  Latest operation return code: OK
  Latest RTT (millisecs) 1
  Tracked by:
    EEM applet test_track_17
C7304_CE2(config-if)#
C7304_CE2(config-if)#
C7304_CE2(config-if)#end
C7304_CE2#un all
All possible debugging has been turned off
C7304_CE2#

OK,问题解决了,其实SLA与EEM能做很多事,举两个例子:
1. 如果在2层网络中使用浮动静态路由做backup,可能造成路由无法切换
7206-1(L3)—-(L2)3500(L2)—-(L2)3500(L2)—-(L3)7206-2

在7206之间存在两条线路,所以指两个静态到7206-2
这时有一个是浮动的,两个路由的下一跳都是7206-2的三层接口地址
如果7206-2出现问题,7206-1自动切换到浮动静态上
但实际上是不行的,主要原因就是7206-1和7206-2在一个网段中,所以只要7206-1的端口不down,那么浮动静态永远都不能激活。
此时只能用SLA的icmp echo来达成目的:

track 22 rtr 11
ip route 0.0.0.0 0.0.0.0 1.1.1.1 track 22

ip sla 11
 icmp-echo 1.1.1.1
 timeout 1000
 frequency 5
ip sla schedule 11 life forever start-time now

2.定时采集信息
如果客户想在cpu利用率超过70%时,报出一些自定义的信息,或30秒采集某个端口的信息,这是就需要EEM出马了,用它可以简单实现客户的需求,在此配置就忽略了。

本文出自 Frank's Blog

版权声明:


本文链接:关于IP SLA及与EEM联动的探讨<3>
版权声明:本文为原创文章,仅代表个人观点,版权归 Frank Zhao 所有,转载时请注明本文出处及文章链接
你可以留言,或者trackback 从你的网站

No Responses to “关于IP SLA及与EEM联动的探讨<3>”

  1. Wan Lingyang说道:

    你好,看了你的文章收益匪浅,想请教你一个问题,目前我遇到的情况是这样的。
    TOPOLOGY链接图:7609 G1/0—-G1/0 NE80 G2/0—–Internet—–WEB Server
    客户的7609设备是接在出口路由器NE80的内网口上的,目前客户希望通过CISCO SLA协议来检测G1/0口的状态情况,由于在INTERNET这条到WEB Sever 的路径上是禁PING的,因此判断接口状态无法用PING的方式来实现。
    问题1:客户希望通过HTTP的访问方式来判断是否7609到WEB SERVER这条路径是没有问题的,这种判断方式是否可行。
    问题2:若判断这条路径上有问题,则触发EEM脚本,脚本内容客户是希望TELNET到NE80的设备上来对NE80做一些操作比如关闭端口或者重新定义出口流量这一系列的操作,请问是否可以在EEM中来定义?

  2. frank说道:

    不好意思,最近太忙了。关于你的问题:
    1. 好像是可以的,但是我没做过,你可以查查文档,官方是这么定义sla的:
    “IP SLAs packets have configurable IP and application layer options such as source and destination IP address, User Datagram Protocol (UDP)/TCP port numbers, a type of service (ToS) byte (including Differentiated Services Code Point [DSCP] and IP Prefix bits), Virtual Private Network (VPN) routing/forwarding instance (VRF), and URL web address.”

    2. 关于EEM就是一个自动触发事件的一个工具,只要你可以操作的,EEM都可以操作,但是它只能执行事先编好的动作。

留言哦

blonde teen swallows load.xxx videos