HUAWEI防火墙通过IPSec隧道使总部与分部在多业务场景下实现业务隔离互访

组网图形

    

组网需求

如图所示,总部通过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

 

posted @ 2021-05-18 08:59  讲文张字  阅读(875)  评论(0编辑  收藏  举报
返回顶部