組網圖形
組網需求
如圖所示,總部通過FW_A與Internet連線,分支機構通過FW_B與Internet連線。FW_A和FW_B之間通過IPSec方式建立安全通訊隧道。為了避免FW_A上的IPSec業務受到該防火牆上其他業務的影響,企業使用者要求在FW_A上新建一個VPN例項,並將IPSec隧道單獨配置到該VPN例項下,以達到業務隔離的目的。
配置思路
根據使用者需求,配置思路如下:
- 1.在FW_A上新建一個VPN例項(vpn1)。
- 2.配置VPN例項下的路由。
- 3.配置VPN例項下的IPSec策略相關引數。
配置IKE對等體時,需要指定IPSec與VPN例項的繫結關係,詳見配置FW_A中的步驟。
操作步驟
- 1.配置FW_A(總部)。
1.1 配置VPN例項vpn1。
<sysname> system-view [sysname] sysname FW_A [FW_A] ip vpn-instance vpn1 [FW_A-vpn-instance-vpn1] route-distinguisher 100:1 [FW_A-vpn-instance-vpn1] quit
1.2 配置介面IP地址,並將介面加入安全區域。
1.2.1 配置GigabitEthernet 1/0/1的IP地址。
[FW_A] interface GigabitEthernet 1/0/1 [FW_A-GigabitEthernet1/0/1] ip binding vpn-instance vpn1 [FW_A-GigabitEthernet1/0/1] ip address 10.1.1.1 24 [FW_A-GigabitEthernet1/0/1] quit
1.2.2 配置GigabitEthernet 1/0/2的IP地址。
[FW_A] interface GigabitEthernet 1/0/2 [FW_A-GigabitEthernet1/0/2] ip binding vpn-instance vpn1 [FW_A-GigabitEthernet1/0/2] ip address 1.1.3.1 24 [FW_A-GigabitEthernet1/0/2] quit
1.2.3 配置GigabitEthernet 1/0/1加入Trust安全區域。
[FW_A] firewall zone trust [FW_A-zone-trust] add interface GigabitEthernet 1/0/1 [FW_A-zone-trust] quit
1.2.4 配置GigabitEthernet 1/0/2加入Untrust安全區域。
[FW_A] firewall zone untrust [FW_A-zone-untrust] add interface GigabitEthernet 1/0/2 [FW_A-zone-untrust] quit
1.3.配置到FW_B的靜態路由,假設下一跳地址為1.1.3.2。該路由用於指導FW_A轉發總部訪問分支的報文。
[FW_A] ip route-static vpn-instance vpn1 1.1.5.0 24 1.1.3.2 [FW_A] ip route-static vpn-instance vpn1 10.1.2.0 24 1.1.3.2
1.4.配置域間安全策略。
1.4.1 配置Trust域與Untrust域的轉發策略,允許封裝前和解封后的報文能通過FW_A。
[FW_A] security-policy [FW_A-policy-security] rule name 1 [FW_A-policy-security-rule-1] source-zone untrust [FW_A-policy-security-rule-1] destination-zone trust [FW_A-policy-security-rule-1] source-address 10.1.2.0 24 [FW_A-policy-security-rule-1] destination-address 10.1.1.0 24 [FW_A-policy-security-rule-1] action permit [FW_A-policy-security-rule-1] quit [FW_A-policy-security] rule name 2 [FW_A-policy-security-rule-2] source-zone trust [FW_A-policy-security-rule-2] destination-zone untrust [FW_A-policy-security-rule-2] source-address 10.1.1.0 24 [FW_A-policy-security-rule-2] destination-address 10.1.2.0 24 [FW_A-policy-security-rule-2] action permit [FW_A-policy-security-rule-2] quit
1.4.2 配置Local域與Untrust域的本地策略,允許IKE協商報文能正常通過FW_A。
[FW_A-policy-security] rule name 3 [FW_A-policy-security-rule-3] source-zone local [FW_A-policy-security-rule-3] destination-zone untrust [FW_A-policy-security-rule-3] source-address 1.1.3.1 32 [FW_A-policy-security-rule-3] destination-address 1.1.5.1 32 [FW_A-policy-security-rule-3] action permit [FW_A-policy-security-rule-3] quit [FW_A-policy-security] rule name 4 [FW_A-policy-security-rule-4] source-zone untrust [FW_A-policy-security-rule-4] destination-zone local [FW_A-policy-security-rule-4] source-address 1.1.5.1 32 [FW_A-policy-security-rule-4] destination-address 1.1.3.1 32 [FW_A-policy-security-rule-4] action permit [FW_A-policy-security-rule-4] quit [FW_A-policy-security] quit
1.5.配置IPSec。
1.5.1 配置訪問控制列表,定義需要保護的資料流,並與VPN例項繫結。
[FW_A] acl 3000 vpn-instance vpn1 [FW_A-acl-adv-3000] rule 5 permit ip source 10.1.1.0 0.0.0.255 destination 10.1.2.0 0.0.0.255 [FW_A-acl-adv-3000] quit
1.5.2 配置IPSec安全提議。
[FW_A] ipsec proposal tran1 [FW_A-ipsec-proposal-tran1] transform esp [FW_A-ipsec-proposal-tran1] encapsulation-mode tunnel [FW_A-ipsec-proposal-tran1] esp authentication-algorithm sha2-256 [FW_A-ipsec-proposal-tran1] esp encryption-algorithm aes-256 [FW_A-ipsec-proposal-tran1] quit
1.5.3 建立IKE安全提議,預設引數可不用配置。
[FW_A] ike proposal 1 [FW_A-ike-proposal-1] dh group14 [FW_A-ike-proposal-1] quit
1.5.4 配置IKE peer。
[FW_A] ike peer b [FW_A-ike-peer-b] ike-proposal 1 [FW_A-ike-peer-b] pre-shared-key Key123 [FW_A-ike-peer-b] remote-address vpn-instance vpn1 1.1.5.1 [FW_A-ike-peer-b] sa binding vpn-instance vpn1 [FW_A-ike-peer-b] quit
1.5.5 配置非模板方式的IPSec安全策略。
[FW_A] ipsec policy map1 1 isakmp [FW_A-ipsec-policy-isakmp-map1-1] ike-peer b [FW_A-ipsec-policy-isakmp-map1-1] proposal tran1 [FW_A-ipsec-policy-isakmp-map1-1] security acl 3000 [FW_A-ipsec-policy-isakmp-map1-1] quit
1.5.6 在介面GigabitEthernet 1/0/2上應用IPSec安全策略。
[FW_A] interface GigabitEthernet 1/0/2 [FW_A-GigabitEthernet1/0/2] ipsec policy map1 [FW_A-GigabitEthernet1/0/2] quit
- 2.配置FW_B(分支)。
2.1 配置介面IP地址,並將介面加入安全區域。
2.1.1 配置GigabitEthernet 1/0/1的IP地址。
<sysname> system-view [sysname] sysname FW_B [FW_B] interface GigabitEthernet 1/0/1 [FW_B-GigabitEthernet1/0/1] ip address 10.1.2.1 24 [FW_B-GigabitEthernet1/0/1] quit
2.1.2 配置GigabitEthernet 1/0/2的IP地址。
[FW_B] interface GigabitEthernet 1/0/2 [FW_B-GigabitEthernet1/0/2] ip address 1.1.5.1 24 [FW_B-GigabitEthernet1/0/2] quit
2.1.3 配置GigabitEthernet 1/0/1加入Trust安全區域。
[FW_B] firewall zone trust [FW_B-zone-trust] add interface GigabitEthernet 1/0/1 [FW_B-zone-trust] quit
2.1.4 配置GigabitEthernet 1/0/2加入Untrust安全區域
[FW_B] firewall zone untrust [FW_B-zone-untrust] add interface GigabitEthernet 1/0/2 [FW_B-zone-untrust] quit
2.2 配置到FW_A的靜態路由,假設下一跳地址為1.1.5.2。該路由用於指導FW_B轉發分支發往總部的報文。
[FW_B] ip route-static 10.1.1.0 24 1.1.5.2 [FW_B] ip route-static 1.1.3.0 24 1.1.5.2
2.3 配置域間安全策略。
2.3.1 配置Trust域與Untrust域的轉發策略,允許封裝前和解封后的報文能通過FW_B。
[FW_B] security-policy [FW_B-policy-security] rule name 1 [FW_B-policy-security-rule-1] source-zone untrust [FW_B-policy-security-rule-1] destination-zone trust [FW_B-policy-security-rule-1] source-address 10.1.1.0 24 [FW_B-policy-security-rule-1] destination-address 10.1.2.0 24 [FW_B-policy-security-rule-1] action permit [FW_B-policy-security-rule-1] quit [FW_B-policy-security] rule name 2 [FW_B-policy-security-rule-2] source-zone trust [FW_B-policy-security-rule-2] destination-zone untrust [FW_B-policy-security-rule-2] source-address 10.1.2.0 24 [FW_B-policy-security-rule-2] destination-address 10.1.1.0 24 [FW_B-policy-security-rule-2] action permit [FW_B-policy-security-rule-2] quit
2.3.2 配置Local域與Untrust域的本地策略,允許IKE協商報文能正常通過FW_B。
[FW_B-policy-security] rule name 3 [FW_B-policy-security-rule-3] source-zone local [FW_B-policy-security-rule-3] destination-zone untrust [FW_B-policy-security-rule-3] source-address 1.1.5.1 32 [FW_B-policy-security-rule-3] destination-address 1.1.3.1 32 [FW_B-policy-security-rule-3] action permit [FW_B-policy-security-rule-3] quit [FW_B-policy-security] rule name 4 [FW_B-policy-security-rule-4] source-zone untrust [FW_B-policy-security-rule-4] destination-zone local [FW_B-policy-security-rule-4] source-address 1.1.3.1 32 [FW_B-policy-security-rule-4] destination-address 1.1.5.1 32 [FW_B-policy-security-rule-4] action permit [FW_B-policy-security-rule-4] quit [FW_B-policy-security] quit
2.4 配置IPSec。
2.4.1 配置訪問控制列表,定義需要保護的資料流。
[FW_B] acl 3000 [FW_B-acl-adv-3000] rule 5 permit ip source 10.1.2.0 0.0.0.255 destination 10.1.1.0 0.0.0.255 [FW_B-acl-adv-3000] quit
2.4.2 配置IPSec安全提議。
[FW_B] ipsec proposal tran1 [FW_B-ipsec-proposal-tran1] transform esp [FW_B-ipsec-proposal-tran1] encapsulation-mode tunnel [FW_B-ipsec-proposal-tran1] esp authentication-algorithm sha2-256 [FW_B-ipsec-proposal-tran1] esp encryption-algorithm aes-256 [FW_B-ipsec-proposal-tran1] quit
2.4.3 建立IKE安全提議,預設引數可不用配置。
[FW_B] ike proposal 1 [FW_B-ike-proposal-1] dh group14 [FW_B-ike-proposal-1] quit
2.4.4 配置IKE peer。
[FW_B] ike peer a [FW_B-ike-peer-a] ike-proposal 1 [FW_B-ike-peer-a] pre-shared-key Key123 [FW_B-ike-peer-a] remote-address 1.1.3.1 [FW_B-ike-peer-a] quit
2.4.5 配置非模板方式的IPSec安全策略。
[FW_B] ipsec policy map1 1 isakmp [FW_B-ipsec-policy-isakmp-map1-1] ike-peer a [FW_B-ipsec-policy-isakmp-map1-1] proposal tran1 [FW_B-ipsec-policy-isakmp-map1-1] security acl 3000 [FW_B-ipsec-policy-isakmp-map1-1] quit
2.4.6 在介面GigabitEthernet 1/0/2上應用IPSec安全策略。
[FW_B] interface GigabitEthernet 1/0/2 [FW_B-GigabitEthernet1/0/2] ipsec policy map1 [FW_B-GigabitEthernet1/0/2] quit
結果驗證
- 1.配置成功後,總部下的使用者可以與分支下的使用者相互訪問。分別在FW_A、FW_B執行display ike sa、display ipsec sa brief會顯示安全聯盟的建立情況。以FW_A為例,出現以下顯示說明IKE安全聯盟、IPSec安全聯盟建立成功。
<FW_A> display ike sa IKE SA information : Conn-ID Peer VPN Flag(s) Phase RemoteType RemoteID ----------------------------------------------------------------------------- 10 1.1.5.1:500 vpn1 RD|ST|A V2:2 IP 1.1.5.1 9 1.1.5.1:500 vpn1 RD|ST|A V2:1 IP 1.1.5.1 Number of IKE SA : 2 ------------------------------------------------------------------------------- Flag Description: RD--READY ST--STAYALIVE RL--REPLACED FD--FADING TO--TIMEOUT HRT--HEARTBEAT LKG--LAST KNOWN GOOD SEQ NO. BCK--BACKED UP M--ACTIVE S--STANDBY A--ALONE NEG--NEGOTIATING <FW_A> display ipsec sa brief Current ipsec sa num:2 Spu board slot 1, cpu 0 ipsec sa information: Number of SAs:4 Src address Dst address SPI VPN Protocol Algorithm ------------------------------------------------------------------------------- 1.1.5.1 1.1.3.1 4001819557 vpn1 ESP E:AES-256 A:SHA2-256-128 1.1.3.1 1.1.5.1 3923280450 vpn1 ESP E:AES-256 A:SHA2-256-128