在作相關售前工做的時候,會遇到客戶需求在總部和分支之間創建主備***,一旦主鏈路出現故障業務會自動切換到備份***。這種狀況下,在兩臺Juniper srx設備之間,咱們能夠使用RPM和IP-MONITORING來配置基於路由的主備***(實驗中不涉及路由實例,因此模擬的是一旦ISP1鏈路down掉,全部流量包括***在內所有切換到IPS2)。安全
一.實驗需求:一旦主鏈路發生故障,業務流量流經備份隧道。
session
二.實驗步驟:1.在兩臺SRX設置之間配置兩個基於路由的***隧道(主備)。ide
2.配置RPM探針,目標接口爲主***的外網接口。spa
3.配置IP-MONITOR,調用RPM探針,將***流量的下一條指定爲備份的***接口。3d
三.實驗拓撲:orm
四.實驗過程:blog
1.主備***的配置:接口
srx320:ip
1.1接口地址配置:ci
interfaces {
ge-0/0/0 {
unit 0 {
family inet {
address 2.2.2.2/24;
}
}
}
ge-0/0/1 {
unit 0 {
family inet {
address 10.10.11.2/24;
}
}
}
ge-0/0/2 {
unit 0 {
family inet {
address 172.188.10.1/24;
}
}
}
st0 {
unit 1 {
family inet {
address 7.7.7.2/24;
}
}
unit 2 {
family inet {
address 8.8.8.2/24;
}
}
}
}
1.2安全區域配置:
security {
zones {
security-zone trust {
host-inbound-traffic {
system-services {
all;
}
protocols {
all;
}
}
interfaces {
ge-0/0/2.0;
}
}
security-zone untrsut {
host-inbound-traffic {
system-services {
all;
}
protocols {
all;
}
}
interfaces {
ge-0/0/0.0;
}
}
security-zone isp2 {
host-inbound-traffic {
system-services {
all;
}
protocols {
all;
}
}
interfaces {
ge-0/0/1.0;
}
}
security-zone ***-isp1 {
interfaces {
st0.1 {
host-inbound-traffic {
system-services {
all;
}
}
}
}
}
security-zone ***-isp2 {
interfaces {
st0.2 {
host-inbound-traffic {
system-services {
all;
}
}
}
}
}
}
}
1.3配置默認策略:
security {
policies {
default-policy {
permit-all;
}
}
}
1.4配置路由:
routing-options {
static {
route 0.0.0.0/0 next-hop 2.2.2.1;
route 172.16.10.0/24 next-hop st0.1;
}
}
1.5配置主備***隧道:
security {
ike {
policy p1 {
mode main;
proposal-set standard;
pre-shared-key ascii-text "$9$JWUi.QF/0BEP5BEcyW8ZUj"; ## SECRET-DATA
}
gateway G1 {
ike-policy p1;
address 1.1.1.2;
external-interface ge-0/0/0.0;
}
gateway G2 {
ike-policy p1;
address 10.10.10.2;
external-interface ge-0/0/1.0;
}
}
ipsec {
policy p1 {
proposal-set standard;
}
*** P1 {
bind-interface st0.1; ----主隧道接口st0.1
ike {
gateway G1;
ipsec-policy p1;
}
establish-tunnels immediately;
}
*** P2 {
bind-interface st0.2; ----備份隧道接口st0.2
ike {
gateway G2;
ipsec-policy p1;
}
establish-tunnels immediately;
}
}
}
1.6配置RPM探針:
services {
rpm {
probe example {
test test-1 {
probe-type icmp-ping;
target address 2.2.2.1; ----IPS1的網關地址
probe-count 3;
probe-interval 15;
test-interval 10;
thresholds {
successive-loss 3;
total-loss 3;
}
destination-interface ge-0/0/0.0;
next-hop 2.2.2.1;
}
}
}
1.7配置IP-MONITOR:
services {
ip-monitoring {
policy test {
match {
rpm-probe example;
}
then {
preferred-route {
route 172.16.10.2/32 {
next-hop 8.8.8.1; ----備份***的路由
}
route 0.0.0.0/0 {
next-hop 10.10.11.1;
}
}
}
}
}
}
srx300:
略。
五.實驗驗證:
1.首先檢查兩端設備的***狀態:
能夠看到phase1和phase2都已經up。
srx320:
srx300:
1.2 檢查***流量:
srx320:
設備上ping對端主機172.16.10.2,
查看會話,能夠看到流量經過st0.1接口也就是走了主隧道。
srx300:
流量一樣經過st0.1走主隧道:
1.3關閉ISP1,檢測RPM和IP-MONITOR狀態:
RPM檢測失敗:
IP-MONITOR的狀態切換:
1.4查看路由:
能夠看到下一條切換到了st0.2備份接口:
1.5查看***隧道:
主隧道已經down掉。
1.6查看會話:
***流量由備份接口流出:
七.實驗結論:
1.主備***切換成功。
2.切換過程當中 ***流量的丟包狀況:
一共丟了48個包:
經過查看session能夠發現,出接口從st0.1到st0.2的轉換的過程:
對此老司機的解釋是:
「ip監控只是讓路由的優先級變了,可是路由變了,有些會話尚未超時,切換的時間可能會更加長」
八.後續:
在基礎的實驗上面咱們還能夠作哪些?
1.假如客戶對於***流量的要求很高,根本沒法容忍長達一分鐘的丟包,咱們應該在RPM探針的參數設置上作哪些修改呢(inteval和threshold 值)?
2.老司機還介紹了另一種方法就是***-monitor,目前還有待嘗試。
3.假如添加路由實例,分支機構srx320的isp1出現問題,切換到備份路由,而總部的srx300上,只有到分支的***流量切換到備份鏈路,其他流量仍然走ISP1,如何操做?
4.集團單線接入,分支雙線接入(相似多種具體部署環境,包括了HA ipsec主備,HA動態***主備等等)。
5.ISP3(不可行)。