赞
踩
素材来源:华为防火墙配置指南
一边学习一边整理试验笔记,并与大家分享,侵权即删,谢谢支持!
附上汇总贴:玩转华为ENSP模拟器系列 | 合集_COCOgsta的博客-CSDN博客_华为模拟器实验
目标
介绍通过在Tunnel接口上建立IPSec隧道实现跨VPN转发报文。
组网需求
FW_A为运营商部署的IPSec网关。FW_A租用给多个小公司,分别为每个公司创建VPN实例。各个公司的VPN网络相互独立,每个公司的分公司员工或出差员工可以安全地访问公司总部的网络。此举例以FW为A公司提供IPSec服务为例,说明如何配置IPSec多实例以及实现跨VPN转发。
如图1所示,PC1位于A公司分公司网络,分公司通过一个安全网关与Internet相连,本例中安全网关以FW_B为例进行说明。通过FW_A为A公司创建VPN1,实现PC1可以安全地访问VPN1。其中FW_A与FW_B之间路由可达。
配置思路
操作步骤
在FW_A上配置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
- 复制代码
- [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
- 复制代码
- [FW_A] interface gigabitethernet 1 / 0 / 3
- [FW_A-GigabitEthernet1/0/3] ip address 1.1.3.1 24
- [FW_A-GigabitEthernet1/0/3] quit
- 复制代码
- [FW_A] interface Tunnel 0
- [FW_A-tunnel0] tunnel-protocol ipsec
- [FW_A-tunnel0] ip binding vpn-instance vpn1
- [FW_A-tunnel0] ip address 10.10.1.2 24
- [FW_A-tunnel0] source 1.1.3.1
- [FW_A-tunnel0] destination 1.1.5.1
- [FW_A-tunnel0] 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 tunnel 0
- [FW_A-zone-untrust] add interface gigabitethernet 1 / 0 / 3
- [FW_A-zone-untrust] quit
- 复制代码
- [FW_A] security-policy
- [FW_A-policy-security] rule name policy1
- [FW_A-policy-security-rule-policy1] source-zone local
- [FW_A-policy-security-rule-policy1] destination-zone untrust
- [FW_A-policy-security-rule-policy1] source-address 1.1.3.1 32
- [FW_A-policy-security-rule-policy1] destination-address 1.1.5.1 32
- [FW_A-policy-security-rule-policy1] action permit
- [FW_A-policy-security-rule-policy1] quit [FW_A-policy-security] rule name policy2
- [FW_A-policy-security-rule-policy2] source-zone untrust
- [FW_A-policy-security-rule-policy2] destination-zone local
- [FW_A-policy-security-rule-policy2] source-address 1.1.5.1 32
- [FW_A-policy-security-rule-policy2] destination-address 1.1.3.1 32
- [FW_A-policy-security-rule-policy2] action permit
- [FW_A-policy-security-rule-policy2] quit
- 复制代码
- [FW_A] security-policy
- [FW_A-policy-security] rule name policy3
- [FW_A-policy-security-rule-policy3] source-zone trust
- [FW_A-policy-security-rule-policy3] destination-zone untrust
- [FW_A-policy-security-rule-policy3] source-address 10.1.1.0 24
- [FW_A-policy-security-rule-policy3] destination-address 10.1.3.0 24
- [FW_A-policy-security-rule-policy3] action permit
- [FW_A-policy-security-rule-policy3] quit [FW_A-policy-security] rule name policy4
- [FW_A-policy-security-rule-policy4] source-zone untrust
- [FW_A-policy-security-rule-policy4] destination-zone trust
- [FW_A-policy-security-rule-policy4] source-address 10.1.3.0 24
- [FW_A-policy-security-rule-policy4] destination-address 10.1.1.0 24
- [FW_A-policy-security-rule-policy4] action permit
- [FW_A-policy-security-rule-policy4] quit
- [FW_A-policy-security] quit
- 复制代码
- [FW_A] ip route- static vpn-instance vpn1 10.1.3.0 255.255.255.0 tunnel0
- 复制代码
在FW_A上配置IPSec策略,并在Tunnel接口上应用此IPSec策略。
- [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.3.0 0.0.0.255
- [FW_A-acl-adv-3000] quit
- 复制代码
- [FW_A] ipsec proposal tran1
- [FW_A-ipsec-proposal-tran1] quit
- 复制代码
- [FW_A] ike proposal 10
- [FW_A-ike-proposal-10] quit
- 复制代码
- [FW_A] ike peer vpn1
- [FW_A-ike-peer-vpn1] ike-proposal 10
- [FW_A-ike-peer-vpn1] remote-address 1.1.5.1
- [FW_A-ike-peer-vpn1] pre-shared-key Test ! 123
- [FW_A-ike-peer-vpn1] sa binding vpn-instance vpn1
- [FW_A-ike-peer-vpn1] quit
- 复制代码
- [FW_A] ipsec policy map1 10 isakmp
- [FW_A-ipsec-policy-isakmp-map1-10] security acl 3000
- [FW_A-ipsec-policy-isakmp-map1-10] proposal tran1
- [FW_A-ipsec-policy-isakmp-map1-10] ike-peer vpn1
- [FW_A-ipsec-policy-isakmp-map1-10] tunnel local 1.1.3.1
- [FW_A-ipsec-policy-isakmp-map1-10] quit
- 复制代码
- [FW_A] interface tunnel 0
- [FW_A-tunnel0] ipsec policy map1
- [FW_A-tunnel0] quit
- 复制代码
配置FW_B的基础配置。
配置接口IP地址。
- <sysname> system-view
- [sysname] sysname FW_B
- [FW_B] interface gigabitethernet 1 / 0 / 3
- [FW_B-GigabitEthernet1/0/3] ip address 10.1.3.1 24
- [FW_B-GigabitEthernet1/0/3] quit
- 复制代码
- [FW_B] interface gigabitethernet 1 / 0 / 1
- [FW_B-GigabitEthernet1/0/1] ip address 1.1.5.1 24
- [FW_B-GigabitEthernet1/0/1] quit
- 复制代码
配置接口加入相应安全区域。
- [FW_A] firewall zone trust
- [FW_A-zone-trust] add interface gigabitethernet 1 / 0 / 3
- [FW_A-zone-trust] quit
- 复制代码
- [FW_A] firewall zone untrust
- [FW_A-zone-untrust] add interface gigabitethernet 1 / 0 / 1
- [FW_A-zone-untrust] quit
- 复制代码
配置域间安全策略。
- [FW_B] security-policy
- [FW_B-policy-security] rule name policy1
- [FW_B-policy-security-rule-policy1] source-zone trust
- [FW_B-policy-security-rule-policy1] destination-zone untrust
- [FW_B-policy-security-rule-policy1] source-address 10.1.3.0 24
- [FW_B-policy-security-rule-policy1] destination-address 10.1.1.0 24
- [FW_B-policy-security-rule-policy1] action permit
- [FW_B-policy-security-rule-policy1] quit [FW_B-policy-security] rule name policy2
- [FW_B-policy-security-rule-policy2] source-zone untrust
- [FW_B-policy-security-rule-policy2] destination-zone trust
- [FW_B-policy-security-rule-policy2] source-address 10.1.1.0 24
- [FW_B-policy-security-rule-policy2] destination-address 10.1.3.0 24
- [FW_B-policy-security-rule-policy2] action permit
- [FW_B-policy-security-rule-policy2] quit
- 复制代码
- [FW_B-policy-security] rule name policy3
- [FW_B-policy-security-rule-policy3] source-zone local
- [FW_B-policy-security-rule-policy3] destination-zone untrust
- [FW_B-policy-security-rule-policy3] source-address 1.1.5.1 32
- [FW_B-policy-security-rule-policy3] destination-address 1.1.3.1 32
- [FW_B-policy-security-rule-policy3] action permit
- [FW_B-policy-security-rule-policy3] quit [FW_B-policy-security] rule name policy4
- [FW_B-policy-security-rule-policy4] source-zone untrust
- [FW_B-policy-security-rule-policy4] destination-zone local
- [FW_B-policy-security-rule-policy4] source-address 1.1.3.1 32
- [FW_B-policy-security-rule-policy4] destination-address 1.1.5.1 32
- [FW_B-policy-security-rule-policy4] action permit
- [FW_B-policy-security-rule-policy4] quit
- [FW_B-policy-security] quit
- 复制代码
- [FW_B] ip route- static 10.1.1.0 255.255.255.0 1.1.5.2
- 复制代码
在FW_B上配置IPSec策略,并在接口上应用此安全策略。
- [FW_B] acl 3000
- [FW_B-acl-adv-3000] rule 5 permit ip source 10.1.3.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] quit
- 复制代码
- [FW_B] ike proposal 10
- [FW_B-ike-proposal-10] quit
- 复制代码
- [FW_B] ike peer vpn1
- [FW_B-ike-peer-vpn1] ike-proposal 10
- [FW_B-ike-peer-vpn1] remote-address 1.1.3.1
- [FW_B-ike-peer-vpn1] pre-shared-key Test ! 123
- [FW_B-ike-peer-vpn1] quit
- 复制代码
- [FW_B] ipsec policy map1 10 isakmp
- [FW_B-ipsec-policy-isakmp-map1-10] security acl 3000
- [FW_B-ipsec-policy-isakmp-map1-10] proposal tran1
- [FW_B-ipsec-policy-isakmp-map1-10] ike-peer vpn1
- [FW_B-ipsec-policy-isakmp-map1-10] quit
- 复制代码
- [FW_B] interface gigabitethernet 1 / 0 / 1
- [FW_B-GigabitEthernet1/0/1] ipsec policy map1
- [FW_B-GigabitEthernet1/0/1] quit
- 复制代码
结果验证
在PC1上执行ping操作。可以ping通VPN1的Server1。
- <FW_A> display ike sa
-
- Ike sa information:
- ------------------------------------------------------------
- Conn-ID Peer VPN Flag(s) Phase
- ---------------------------------------------------------
- 117477244 1.1.5.1 RD|A v2:2
- 117477243 1.1.5.1 RD|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
- <FW_A> display ipsec sa
-
- ===============================
- Interface: Tunnel0
- ===============================
-
- -----------------------------
- IPSec policy name: "map1"
- Sequence number : 10
- Acl group : 3000
- Acl rule : 5
- Mode : ISAKMP
- -----------------------------
- Connection ID : 150994963
- Encapsulation mode: Tunnel
- Tunnel local : 1.1.3.1
- Tunnel remote : 1.1.5.1
- Flow source : 10.1.1.0/255.255.255.0 0/0
- Flow destination : 10.1.3.0/255.255.255.0 0/0
- Flow vpn : vpn1
- [Outbound ESP SAs]
- SPI: 120037772 (0x727a18c)
- Proposal: ESP-ENCRYPT-AES-256 SHA2-256-128
- SA remaining key duration (kilobytes/sec): 1843200/1031
- Max sent sequence-number: 9
- UDP encapsulation used for NAT traversal: N
- SA decrypted packets (number/kilobytes): 4/0
-
- [Inbound ESP SAs]
- SPI: 215352593 (0xcd60511)
- Proposal: ESP-ENCRYPT-AES-256 SHA2-256-128
- SA remaining key duration (kilobytes/sec): 1843196/1031
- Max received sequence-number: 49
- UDP encapsulation used for NAT traversal: N
- SA decrypted packets (number/kilobytes): 4/0
- Anti-replay : Enable
- Anti-replay window size: 1024
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。