IP SLA是 Internet Protocol Service-Level Agreement的縮寫,意思是互聯網協議服務等級協議。
IP SLA主要有以下三種應用場合:
2.HSRP出接口檢測。
3.PBR策略路由下一跳檢測。
簡單來說就是利用以下各種途徑測試可靠性,下文主要以icmp ping測試來說明
實驗拓撲圖
拓撲說明:R1 fa0/0接口192.168.0.0/24,s1/0接口12.1.1.0/24,s1/1接口13.1.1.0/24,最後一位爲路由器編號,後續不再說明;R2 s1/0接口12.1.1.0/24,s1/1接口24.1.1.0/24;R3 s1/1接口13.1.1.0/24,s1/0接口34.1.1.0/24;R4 s1/1接口24.1.1.0/24,s1/0接口34.1.1.0/24,fa0/0接口192.168.1.0/24。R1 R2 R3 R4起ospf路由協議。
(config)#ip sla monitor 124
創建SLA條目
(config-sla-monitor)#type echo protocolipicmpecho 24.1.1.4 source-interface s1/0
設置檢測類型爲icmp ping,測試到24.1.1.4的連通性,走s1/0源接口
(config-sla-monitor-echo)#frequency 5
設置頻率爲5秒一個包
(config-sla-monitor-echo)#threshold 2
設置閥值爲2次
(config-sla-monitor-echo)#timeout 1000
單位爲ms,超時時間爲1s
(config)#ip sla monitor schedule 124 start-timenow life forever
設置sla 立刻生效,有效期無限(默認3600s)
(config)#track 124 rtr 124 reachability
設置track條目和lsa條目關聯,track可達性
(config)#ip route 0.0.0.0 0.0.0.0 12.1.1.210 track 124
設置路由ad值爲10,使用track條目124監測
附上R1的相關配置:
ip sla monitor 124
typeecho protocol ipIcmpEcho 24.1.1.4 source-interface Serial1/0
timeout 1000
threshold 2
frequency 5
ip sla monitor schedule 124 start-time now
ip sla monitor 134
typeecho protocol ipIcmpEcho 34.1.1.4 source-interface Serial1/1
timeout 1000
threshold 2
frequency 5
ip sla monitor schedule 134 start-time now
track 124 rtr 124 reachability
track 134 rtr 134 reachability
ip route 0.0.0.0 0.0.0.0 12.1.1.2 2 track124
ip route 0.0.0.0 0.0.0.0 13.1.1.3 3 track134
實驗結果:
可用show track和show ip sla monitor configuration驗證實驗結果,192.168.1.0到192.168.2.0默認走R1-R2-R4,當R2接口S1/1或者R4接口S1/1狀態爲down狀態,會走另外一條路R1-R3-R4。