juniper srx 1500 HA及雙線路自動切換配置

機房ISP提供了兩條上聯線路,分別接入ISP的兩臺核心交換機。
這兩條線路是主備模式,同一時間只能有一條工作。
恰好等保要求,買了兩臺juniper srx 1500,爲了節省設備,決定這兩個牆既作爲邊界防火牆,又做路由器,將ISP分配的公網IP的網關放在本地牆上。

爲實現上述功能,需要完成兩個配置:

  1. 兩臺SRX 1500配置HA
  2. 配置rpm檢測和路由切換

HA功能就是將兩臺防火牆組成一個邏輯設備,兩臺牆在用戶視角就是一個設備,如果一個節點死掉,另外節點會接收工作,juniper設備分爲控制平面和數據平面,因此包括nat session 等信息在兩個設備間都是同步的,用戶不會有任何感知。
類似cisco的IP SLA功能,juniper設備也可以通過配置各種探針探測指定的指標,然後根據探測結果執行一些動作,這個功能在juniper設備上叫rpm(real-time performance monitoring ),詳細可參見參考文檔2 。
常用的典型例子就是通過ping測試網絡是否可達,然後根據結果切換默認路由。,

第一部分:配置HA
1.將兩臺srx都設置爲集羣模式,集羣ID是1,兩個節點分別爲node 0和node 1,設置以後設備會自動重啓。
注意,該命令是在“>”提示符狀態下執行,不是配置模式。
*** 主設備上操作(node0):

set chassis cluster cluster-id 1 node 0 reboot

*** 從設備上操作 (node1):

set chassis cluster cluster-id 1 node 1 reboot

在主設備上執行接下來的配置,無需操作從設備,配置會自動同步。

2.配置兩個節點的主機名
set groups node0 system host-name srx-master
set groups node1 system host-name srx-slave
set apply-groups "${node}"
第三條命令是配置集羣必須的,該命令確保跟節點相關的命令,如配置主機名,只在對應的節點上執行。

3.配置redundancy group
redundancy group指的是一組在兩個節點間切換的資源,概念與linux中的HA Heartbeat配置中的資源類似,可以參考理解。
默認的redundancy group是group 0,group 0代表control plane,從group 1開始代表data plane。

set chassis cluster redundancy-group 0 node 0 priority 200
set chassis cluster redundancy-group 0 node 1 priority 100
set chassis cluster redundancy-group 1 node 0 priority 200
set chassis cluster redundancy-group 1 node 1 priority 100

4.配置集羣的FABRIC LINKS,即數據平面
set interfaces fab0 fabric-options member-interfaces xe-0/0/18
set interfaces fab1 fabric-options member-interfaces xe-7/0/18

5.配置REDUNDANCY ETHERNET INTERFACES
reth是一個邏輯設備,是兩個節點上網絡接口的疊加,概念類似linux的bounding,可以參考理解。
將對應的物理接口加入reth組中,給reth接口配置公網IP地址,該地址即內部其他服務器的網關。

set chassis cluster reth-count 1
set interfaces reth0 redundant-ether-options redundancy-group 1
set interfaces ge-0/0/0 gigether-options redundant-parent reth0
set interfaces ge-7/0/0 gigether-options redundant-parent reth0
set interfaces reth0 unit 0 family inet address 111.111.111.1/24

到這,HA就算配置完畢了,我們可以手工觸發ha切換測試
request chassis cluster failover redundancy-group 1 node 1

通過命令查看,可以看到Redundancy group: 1 發生了切換

show chassis cluster status
Cluster ID: 1
Node Priority Status Preempt Manual Monitor-failures

Redundancy group: 0 , Failover count: 1
node0 200 primary no no None
node1 100 secondary no no None

Redundancy group: 1 , Failover count: 2
node0 200 secondary no no None
node1 100 primary no no None

測試之後要清空手工ha狀態
request chassis cluster failover reset redundancy-group 1

【可選配置】配置Cluster Interface Monitoring
我們可以監控一個端口狀態,如果端口狀態發生改變,會自動發生redundancy-group的角色切換。

set chassis cluster redundancy-group 1 interface-monitor ge-0/0/3 weight 255
set chassis cluster redundancy-group 1 interface-monitor ge-7/0/3 weight 255

第二部分:配置rpm檢測和路由切換

1.配置上連ISP接口的互聯地址
set interfaces ge-0/0/3 unit 0 family inet address 10.1.0.90/30
set interfaces ge-7/0/3 unit 0 family inet address 10.1.0.94/30

2.配置默認路由
set routing-options static route 0.0.0.0/0 next-hop 10.1.0.89

3.配置rpm檢測,探測ISP對端的互聯地址
每1秒發起一次探測,每次探測發送10個包,每個包之間的間隔爲1s,在一次探測中,如果有5個包不通,則判定爲鏈路失效,鏈路失效以後將默認路由修改爲備線地址。探測使用接口ge-0/0/3.0

set services rpm probe ping-check-mainline test icmp-test target address 10.1.0.89
set services rpm probe ping-check-mainline test icmp-test probe-count 10
set services rpm probe ping-check-mainline test icmp-test probe-interval 1
set services rpm probe ping-check-mainline test icmp-test test-interval 1
set services rpm probe ping-check-mainline test icmp-test thresholds successive-loss 5
set services rpm probe ping-check-mainline test icmp-test destination-interface ge-0/0/3.0
set services rpm probe ping-check-mainline test icmp-test next-hop 10.1.0.89
set services ip-monitoring policy mainline-is-down match rpm-probe ping-check-mainline
set services ip-monitoring policy mainline-is-down then preferred-route route 0.0.0.0/0 next-hop 10.1.0.93

參考文檔:
1.https://www.juniper.net/documentation/en_US/junos/topics/concept/security-rpm-overview.html
2.https://kb.juniper.net/InfoCenter/index?page=content&id=KB25052&actp=METADATA
3.http://www.skullbox.net/junipersrxcluster.php
4.https://blog.bravi.org/?p=555
5.http://netfixpro.com/deep-dive-of-chassis-cluster-configuration-on-juniper-srx-1500-firewalls/
https://www.juniper.net/documentation/en_US/junos/topics/example/chassis-cluster-redundancy-group-interface-monitoring-configuring-cli.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章