一、定义
SLA 服务水平协议(简称:SLA,全称:service level agreement)是在一定开销下为保障服务的性能和可靠性,服务提供商与用户间定义的一种双方认可的协定。通常这个开销是驱动提供服务质量的主要因素。
简单点说就是通过发送测试报文,对网络性能,服务质量进行分析,并为用户提供网络服务质量的各种参数,例如:抖动延迟,文件传输速率,TCP时延等等
二、主要配置命令
ip sla monitor operation-number//定义SLA的编号
type echo protocol ipIcmpEcho {destination-ip-address |destination-hostname} [source-ipaddr {ip-address |hostname} | source-interface interface-name]//定义icmp测试的目的地址和源地址(我这里做实验的是用icmp 其实type后可以用很多协议的…很强大)
ip sla monitor schedule operation-number [life {forever| seconds}] [start-time {hh:mm[:ss] [month day | daymonth] | pending | now | after hh:mm:ss] [ageoutseconds] [recurring]//调用SLA运行的时间
三、实验
拓扑
实验要求:
R1连接到ISP-1和ISP-2,其中连到ISP-1的是主路径,到ISP-2是备用路径。当连接到ISP-1链路出现故障时,正常的数据流量可以通过ISP-2过。
R1配置如下:
interface FastEthernet1/0
ip address 192.168.2.1 255.255.255.0
interface FastEthernet1/1
ip address 192.168.1.1 255.255.255.0
ip sla monitor 10
type echo protocol ipIcmpEcho 192.168.2.2 source-interface FastEthernet1/0
frequency 5 //每隔5秒测试一次
ip sla monitor schedule 10 life forever start-time now
ip sla monitor 11
type echo protocol ipIcmpEcho 192.168.1.1 source-interface FastEthernet1/1
frequency 5
ip sla monitor schedule 11 life forever start-time now
track 1 rtr 10 reachability//定义一个track跟踪目的地的可达性以便在静态路由的时候调用
track 2 rtr 11 reachability//同上
浮动路由:
ip route 0.0.0.0 0.0.0.0 192.168.2.2 track 1//主链路
ip route 0.0.0.0 0.0.0.0 192.168.1.2 2 track 2//备份链路
实验调试:
R1#debug ip sla monitor trace //打开sla跟踪调试
R1#debug ip routing //打开路由调试 等下会看到路由表的变化
IP routing debugging is on
R1#debug ip sla monitor trace
IP SLA Monitor TRACE debugging for all operation is on
R1#
*Mar 1 01:02:56.663: IP SLA Monitor(11) Scheduler: Starting an operation
*Mar 1 01:02:56.667: IP SLA Monitor(11) echo operation: Sending an echo operation
*Mar 1 01:02:56.675: IP SLA Monitor(11) echo operation: RTT=8
*Mar 1 01:02:56.679: IP SLA Monitor(11) Scheduler: Updating result
*Mar 1 01:02:56.915: IP SLA Monitor(10) Scheduler: Starting an operation
*Mar 1 01:02:56.915: IP SLA Monitor(10) echo operation: Sending an echo operation
*Mar 1 01:02:56.923: IP SLA Monitor(10) echo operation: RTT=4
*Mar 1 01:02:56.927: IP SLA Monitor(10) Scheduler: Updating result
R1#
*Mar 1 01:03:01.663: IP SLA Monitor(11) Scheduler: Starting an operation
*Mar 1 01:03:01.667: IP SLA Monitor(11) echo operation: Sending an echo operation
*Mar 1 01:03:01.675: IP SLA Monitor(11) echo operation: RTT=8
*Mar 1 01:03:01.675: IP SLA Monitor(11) Scheduler: Updating result
*Mar 1 01:03:01.915: IP SLA Monitor(10) Scheduler: Starting an operation
*Mar 1 01:03:01.915: IP SLA Monitor(10) echo operation: Sending an echo operation
R1#
*Mar 1 01:03:04.459: RT: NET-RED 0.0.0.0/0
R1#
*Mar 1 01:03:06.663: IP SLA Monitor(11) Scheduler: Starting an operation
*Mar 1 01:03:06.667: IP SLA Monitor(11) echo operation: Sending an echo operation
*Mar 1 01:03:06.675: IP SLA Monitor(11) echo operation: RTT=8
*Mar 1 01:03:06.679: IP SLA Monitor(11) Scheduler: Updating result
*Mar 1 01:03:06.919: IP SLA Monitor(10) echo operation: Timeout //跟踪出现timeout
*Mar 1 01:03:06.919: IP SLA Monitor(10) Scheduler: Updating result
R1#
*Mar 1 01:03:11.331: RT: del 0.0.0.0 via 192.168.2.2, static metric [1/0]
*Mar 1 01:03:11.335: RT: delete network route to 0.0.0.0
*Mar 1 01:03:11.339: RT: NET-RED 0.0.0.0/0
*Mar 1 01:03:11.339: RT: NET-RED 0.0.0.0/0
*Mar 1 01:03:11.339: RT: SET_LAST_RDB for 0.0.0.0/0
NEW rdb: via 192.168.1.2
*Mar 1 01:03:11.343: RT: add 0.0.0.0/0 via 192.168.1.2, static metric [2/0]
*Mar 1 01:03:11.343: RT: NET-RED 0.0.0.0/0
*Mar 1 01:03:11.343: RT: default path is now 0.0.0.0 via 192.168.1.2
*Mar 1 01:03:11.343: RT: new default network 0.0.0.0
*Mar 1 01:03:11.343: RT: NET-RED 0.0.0.0/0 //静态路由变成了备用路径
*Mar 1 01:03:11.663: IP SLA Monitor(11) Scheduler: Starting an operation
R1#
*Mar 1 01:03:11.663: IP SLA Monitor(11) echo operation: Sending an echo operation
*Mar 1 01:03:11.675: IP SLA Monitor(11) echo operation: RTT=8
*Mar 1 01:03:11.679: IP SLA Monitor(11) Scheduler: Updating result
*Mar 1 01:03:11.919: IP SLA Monitor(10) Scheduler: Starting an operation
*Mar 1 01:03:11.919: IP SLA Monitor(10) echo operation: Sending an echo operation
R1#
*Mar 1 01:03:16.663: IP SLA Monitor(11) Scheduler: Starting an operation
*Mar 1 01:03:16.667: IP SLA Monitor(11) echo operation: Sending an echo operation
*Mar 1 01:03:16.675: IP SLA Monitor(11) echo operation: RTT=8
*Mar 1 01:03:16.679: IP SLA Monitor(11) Scheduler: Updating result
*Mar 1 01:03:16.919: IP SLA Monitor(10) echo operation: Timeout
*Mar 1 01:03:16.919: IP SLA Monitor(10) Scheduler: Updating result
R1#u all
All possible debugging has been turned off
R1#
*Mar 1 01:03:21.663: IP SLA Monitor(11) Scheduler: Starting an operation
*Mar 1 01:03:21.663: IP SLA Monitor(11) echo operation: Sending an echo operation
*Mar 1 01:03:21.663: IP SLA Monitor(11) echo operation: RTT=1
*Mar 1 01:03:21.663: IP SLA Monitor(11) Scheduler: Updating result
R1#sho ip rou
R1#sho 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 192.168.1.2 to network 0.0.0.0
C 192.168.1.0/24 is directly connected, FastEthernet1/1
C 192.168.2.0/24 is directly connected, FastEthernet1/0
S* 0.0.0.0/0 [2/0] via 192.168.1.2 //备用路径出现在路由表、
注:当主链路恢复时又会重新出现时,主路径又会替换掉备用路径!!!
实验的主要思想:结合SLA能测试链路的各种参数,来实现路径的控制,或者是冗余路径。
SLA的功能肯定不是这一点点,鉴于本人也只是刚刚开始看SLA,这个小实验提供给大家初步了解SLA。