1. 程式人生 > >Juniper srx 240 埠對映\\N個ISP出口 之 “浮動路由+指定資源走指定線路”

Juniper srx 240 埠對映\\N個ISP出口 之 “浮動路由+指定資源走指定線路”

172.18.18.42 port 2020、2009 ISP_IP Port XXXX、XXXX
172.18.18.45 port 2020、2009 ISP_IP Port XXXX、XXXX

步驟一:定義全域性地址
set security address-book global address Nutanix_Cluster 172.18.18.50/32
步驟二:定義協議埠
set applications application tcp-2020 protocol tcp
set applications application tcp-2020 destination-port 2020
set applications application tcp-2009 protocol tcp
set applications application tcp-2009 destination-port 2009
步驟三:定義目的NAT+Port之定義內網IP匹配埠
set security nat destination pool DP_Nutanix_Cluster_2020 address 172.18.18.50/32
set security nat destination pool DP_Nutanix_Cluster_2020 address port 2020
set security nat destination pool DP_Nutanix_Cluster_2009 address 172.18.18.50/32
set security nat destination pool DP_Nutanix_Cluster_2009 address port 2009
步驟三:定義目的NAT+Port之定義內外網NAT規則
set security nat destination rule-set DNAT_FROM_ISP6 rule ISP6_TO_Nutanix_2020_Owenli match destination-address-name WAN3006_162
set security nat destination rule-set DNAT_FROM_ISP6 rule ISP6_TO_Nutanix_2020_Owenli match destination-port 2020
set security nat destination rule-set DNAT_FROM_ISP6 rule ISP6_TO_Nutanix_2020_Owenli then destination-nat pool DP_Nutanix_Cluster_2020
set security nat destination rule-set DNAT_FROM_ISP6 rule ISP6_TO_Nutanix_2009_Owenli match destination-address-name WAN3006_162
set security nat destination rule-set DNAT_FROM_ISP6 rule ISP6_TO_Nutanix_2009_Owenli match destination-port 2009
set security nat destination rule-set DNAT_FROM_ISP6 rule ISP6_TO_Nutanix_2009_Owenli then destination-nat pool DP_Nutanix_Cluster_2009

步驟四:定義源區域訪問內網特定區域的控制策略
set security policies from-zone ISP6 to-zone trust policy Nutanix_Cluster-OWEN-EDIT match source-address any destination-address Nutanix_Cluster application tcp-2020 application tcp-2009
set security policies from-zone ISP6 to-zone trust policy Nutanix_Cluster-OWEN-EDIT then permit
set security policies from-zone ISP6 to-zone trust policy Nutanix_Cluster-OWEN-EDIT then log session-init
set security policies from-zone ISP6 to-zone trust policy Nutanix_Cluster-OWEN-EDIT then log session-close
set security policies from-zone ISP6 to-zone trust policy Nutanix_Cluster-OWEN-EDIT then count
步驟五:新定義之策略插入拒絕策略之前,即調整策略優先順序
insert security policies from-zone ISP6 to-zone trust policy Nutanix_Cluster-OWEN-EDIT before policy DENY

set security policies from-zone trust to-zone ISP6 policy Nutanix_Cluster-OWEN-EDIT match source-address Nutanix_Cluster destination-address any application tcp-2020 application tcp-2009
set security policies from-zone trust to-zone ISP6 policy Nutanix_Cluster-OWEN-EDIT then permit
set security policies from-zone trust to-zone ISP6 policy Nutanix_Cluster-OWEN-EDIT then log session-init
set security policies from-zone trust to-zone ISP6 policy Nutanix_Cluster-OWEN-EDIT then log session-close
set security policies from-zone trust to-zone ISP6 policy Nutanix_Cluster-OWEN-EDIT then count
步驟六:定義網段或特定IP從那條ISP線路訪問外網資源

INGRESS_FROM_TRUST---- 在內網介面應用過濾器filter [reth3.500 zone trust]

set firewall family inet filter INGRESS_FROM_TRUST term Nutanix_Cluster from source-address 172.18.18.45/32
set firewall family inet filter INGRESS_FROM_TRUST term Nutanix_Cluster from source-address 172.18.18.50/32
set firewall family inet filter INGRESS_FROM_TRUST term Nutanix_Cluster from source-address 172.18.18.42/32
set firewall family inet filter INGRESS_FROM_TRUST term Nutanix_Cluster from source-address 172.18.18.48/32
set firewall family inet filter INGRESS_FROM_TRUST term Nutanix_Cluster from source-address 172.18.18.52/32
set firewall family inet filter INGRESS_FROM_TRUST term Nutanix_Cluster from source-address 172.18.18.55/32
set firewall family inet filter INGRESS_FROM_TRUST term Nutanix_Cluster from source-address 172.18.18.58/32
set firewall family inet filter INGRESS_FROM_TRUST term Nutanix_Cluster from destination-address 0.0.0.0/0
set firewall family inet filter INGRESS_FROM_TRUST term Nutanix_Cluster then routing-instance FORWARD_TO_ISP6
步驟七:新定義之firewall filter策略執行 then acceppt,若之前已有跳至步驟八;
set firewall family inet filter INGRESS_FROM_TRUST term ACCEPT_ALL then accept
步驟八:把步驟六插入步驟七之前,即調整策略優先順序;
insert firewall family inet filter INGRESS_FROM_TRUST term Nutanix_Cluster before term ACCEPT_ALL
步驟九:查詢NAT會話,確定IN AND OUT雙向策略是否正確;

show security flow session nat destination-port 2020
node0:

Session ID: 91904, Policy name: LEGACY_ID_15/89, State: Backup, Timeout: 14342, Valid
In: 172.18.18.45/46082 --> 202.82.130.199/2020;tcp, If: reth3.500, Pkts: 0, Bytes: 0
Out: 202.82.130.199/2020 --> 119.145.16.241/24323;tcp, If: reth15.3001, Pkts: 0, Bytes: 0

Session ID: 234948, Policy name: Nutanix_Cluster-OWEN-EDIT/263, State: Backup, Timeout: 14292, Valid
In: 202.82.130.199/6688 --> 210.21.218.163/2020;tcp, If: reth15.3006, Pkts: 0, Bytes: 0
Out: 172.18.18.50/2020 --> 202.82.130.199/6688;tcp, If: reth3.500, Pkts: 0, Bytes: 0
Total sessions: 2