1、定義
SLA 服務水平協議(簡稱:SLA,全稱:service level agreement)是在必定開銷下爲保障服務的性能和可靠性,服務提供商與用戶間定義的一種雙方承認的協定。一般這個開銷是驅動提供服務質量的主要因素。
簡單點說就是經過發送測試報文,對網絡性能,服務質量進行分析,併爲用戶提供網絡服務質量的各類參數,例如:抖動延遲,文件傳輸速率,TCP時延等等
2、主要配置命令
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運行的時間
3、實驗
拓撲
實驗要求:
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。