能夠與HSRP,static靜態路由等協議聯動服務器
IP SLA(Internet Protocol Service-Level Agreement)互聯網服務等級協議,本實驗裏經過發送測試報文,測試下一跳是否可達,結合Track實現冗餘靜態路由的切換。網絡
實驗環境:ide
模擬器:GNS3測試
路由器:C3640-JK9O3S-M-12.4(7a).BINip
終端:VPCS路由
R4模擬某公司專線接入路由器,R3模擬對端銀行網絡設備。it
R4和R3之間經過兩條專線互聯,聯通專線爲主鏈路,電信專線爲備鏈路。ast
PC1模擬公司客戶端服務器,PC2模擬銀行服務端服務器。PC1經過專線訪問銀行服務端PC2。class
實驗目的:配置
當主鏈路出問題時,自動切換到備份鏈路。
網絡配置:
R4:
R4#show ip int b
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.193.1 YES manual up up
FastEthernet1/0 192.168.194.1 YES manual up up
FastEthernet2/0 192.168.40.254 YES manual up up
R3:
R3#show ip int b
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 192.168.193.2 YES manual up up
FastEthernet1/0 192.168.194.2 YES manual up up
FastEthernet2/0 192.168.206.254 YES manual up up
VPCS:
PC1> ip 192.168.40.41/24 192.168.40.254
PC2> ip 192.168.206.1/24 192.168.206.254
IP SLA配置命令:
R4:
R4#conf t
R4(config)#ip sla monitor 11
R4(config-sla-monitor)#type echo protocol ipIcmpEcho 192.168.193.2 source-interface f0/0
R4(config-sla-monitor-echo)#timeout 1000
R4(config-sla-monitor-echo)#frequency 3
R4(config-sla-monitor-echo)#exit
R4(config)#ip sla monitor schedule 11 life forever start-time now
R4(config)#track 1 rtr 11 reachability
R4(config-track)#exit
// 靜態路由(主鏈路):
R4(config)#ip route 192.168.206.1 255.255.255.255 192.168.193.2 track 1
// 浮動靜態路由(備份鏈路):
R4(config)#ip route 192.168.206.1 255.255.255.255 192.168.194.2 10
R3:
R3#conf t
R3(config)#ip sla monitor 11
R3(config-sla-monitor)#type echo protocol ipIcmpEcho 192.168.193.1 source-interface f0/0
R3(config-sla-monitor-echo)#timeout 1000
R3(config-sla-monitor-echo)#frequency 3
R3(config-sla-monitor-echo)#exit
R3(config)#ip sla monitor schedule 11 life forever start-time now
R3(config)#track 1 rtr 11 reachability
R3(config-track)#exit
// 靜態路由(主鏈路):
R3(config)#ip route 192.168.40.41 255.255.255.255 192.168.193.1 track 1
// 浮動靜態路由(備份鏈路):
R3(config)#ip route 192.168.40.41 255.255.255.255 192.168.194.1 10
測試:
// 當前主鏈路靜態路由
R4#show ip route static
192.168.206.0/32 is subnetted, 1 subnets
S 192.168.206.1 [1/0] via 192.168.193.2
R3# show ip route static
192.168.40.0/32 is subnetted, 1 subnets
S 192.168.40.41 [1/0] via 192.168.193.1
// 把主鏈路一邊端口down掉
R4#conf t
R4(config)#int f0/0
R4(config-if)#shutdown
R4(config-if)#end
// 3秒後已切換爲備用靜態路由
R4#show ip route static
192.168.206.0/32 is subnetted, 1 subnets
S 192.168.206.1 [10/0] via 192.168.194.2
R3#show ip route static
192.168.40.0/32 is subnetted, 1 subnets
S 192.168.40.41 [10/0] via 192.168.194.1