素材来源:华为防火墙配置指南
一边学习一边整理试验笔记,并与大家分享,侵权即删,谢谢支持!
附上汇总贴:玩转华为ENSP模拟器系列 | 合集_COCOgsta的博客-CSDN博客_华为模拟器实验
目标
您可以通过本举例了解IPSec隧道保护同一VPN实例下用户流量的配置方法。
组网需求
如图1所示,总部通过FW_A与Internet连接,分支机构通过FW_B与Internet连接。FW_A和FW_B之间通过IPSec方式建立安全通信隧道。为了避免FW_A上的IPSec业务受到该防火墙上其他业务的影响,企业用户要求在FW_A上新建一个VPN实例,并将IPSec隧道单独配置到该VPN实例下,以达到业务隔离的目的。
配置思路
操作步骤
配置FW_A(总部)。
配置VPN实例1。
system-view
[sysname] sysname FW_A
[FW_A] ip -instance 1
[FW_A--instance-1] route-distinguisher 100 : 1
[FW_A--instance-1] quit
复制代码
配置接口IP地址,并将接口加入安全区域。
[FW_A] interface gigabitethernet 1 / 0 / 1
[FW_A-GigabitEthernet1/0/1] ip binding -instance 1
[FW_A-GigabitEthernet1/0/1] ip address 10.1.1.1 24
[FW_A-GigabitEthernet1/0/1] quit
复制代码
[FW_A] interface gigabitethernet 1 / 0 / 2
[FW_A-GigabitEthernet1/0/2] ip binding -instance 1
[FW_A-GigabitEthernet1/0/2] ip address 1.1.3.1 24
[FW_A-GigabitEthernet1/0/2] quit
复制代码
[FW_A] firewall zone trust
[FW_A-zone-trust] add interface gigabitethernet 1 / 0 / 1
[FW_A-zone-trust] quit
复制代码
[FW_A] firewall zone untrust
[FW_A-zone-untrust] add interface gigabitethernet 1 / 0 / 2
[FW_A-zone-untrust] quit
复制代码
配置到FW_B的静态路由,假设下一跳地址为1.1.3.2。该路由用于指导FW_A转发总部访问分支的报文。
[FW_A] ip route- static -instance 1 1.1.5.0 24 1.1.3.2
[FW_A] ip route- static -instance 1 10.1.2.0 24 1.1.3.2
复制代码
配置域间安全策略。
[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
复制代码
[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
复制代码
配置IPSec。
[FW_A] acl 3000 -instance 1
[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
复制代码
[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
复制代码
[FW_A] ike proposal 1
[FW_A-ike-proposal-1] quit
复制代码
[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 -instance 1 1.1.5.1
[FW_A-ike-peer-b] sa binding -instance 1
[FW_A-ike-peer-b] quit
复制代码
[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
复制代码
[FW_A] interface gigabitethernet 1 / 0 / 2
[FW_A-GigabitEthernet1/0/2] ipsec policy map1
[FW_A-GigabitEthernet1/0/2] quit
复制代码
配置FW_B(分支)。
配置接口IP地址,并将接口加入安全区域。
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
复制代码
[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
复制代码
[FW_B] firewall zone trust
[FW_B-zone-trust] add interface gigabitethernet 1 / 0 / 1
[FW_B-zone-trust] quit
复制代码
[FW_B] firewall zone untrust
[FW_B-zone-untrust] add interface gigabitethernet 1 / 0 / 2
[FW_B-zone-untrust] quit
复制代码
配置到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
复制代码
配置域间安全策略。
[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
复制代码
[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
复制代码
配置IPSec。
[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
复制代码
[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
复制代码
[FW_B] ike proposal 1
[FW_B-ike-proposal-1] quit
复制代码
[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
复制代码
[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
复制代码
[FW_B] interface gigabitethernet 1 / 0 / 2
[FW_B-GigabitEthernet1/0/2] ipsec policy map1
[FW_B-GigabitEthernet1/0/2] quit
复制代码
结果验证
display ike sa
Ike sa information :
Conn-ID Peer VPN Flag(s) Phase
---------------------------------------------------------------
10 1.1.5.1 1 RD|ST|A V2:2
9 1.1.5.1 1 RD|ST|A V2:1
Number of SA entries : 2
Number of SA entries of all cpu : 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
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 1 ESP E:AES-256 A:SHA2-256-128
1.1.3.1 1.1.5.1 3923280450 1 ESP E:AES-256 A:SHA2-256-128