11
2024
04
15:23:26

华为防火墙 VPN对接配置指南



推荐点击下面图片,通过本站淘宝优惠价购买:

image.png

https://support.huawei.com/enterprise/zh/doc/EDOC1000154804?section=j01l


配置华为防火墙与华为AR系列路由器采用ISAKMP方式IPSec安全策略建立IPSec隧道

关于本章

组网需求

图2-39所示,华为AR路由器为企业分支网关,华为防火墙为企业总部网关,分支和总部网关都采用固定IP地址接入Internet。

现企业需要在华为AR路由器和华为防火墙之间建立IPSec隧道,实现分支和总部间的业务安全互通。

图2-39 配置华为AR路由器与华为防火墙采用ISAKMP方式IPSec安全策略建立IPSec隧道组网图

数据规划

配置项

华为AR路由器

华为防火墙

IPSec安全提议

封装模式

隧道模式

隧道模式

安全协议

ESP

ESP

ESP协议验证算法

SHA2-256

SHA2-256

ESP协议加密算法

AES-256

AES-256

IKE安全提议

认证方法

预共享密钥

预共享密钥

加密算法

AES-256

AES-256

认证算法

SHA2-256

SHA2-256

DH组

Group14

Group14

IKE对等体

IKE版本

V1

V1(需要加载IKEv1 MOD)

协商模式

主模式

主模式

预共享密钥

Huawei@123

Huawei@123

身份类型

IP

IP

配置思路

  1. 配置接口的IP地址和到对端的静态路由,保证两端路由可达。

    华为防火墙还需要配置接口加入安全区域、域间安全策略。

  2. 配置ACL,以定义需要IPSec保护的数据流。

  3. 配置IPSec安全提议,定义IPSec的保护方法。

  4. 配置IKE安全提议,定义IKE协商的参数。

  5. 配置IKE对等体,定义对等体间IKE协商时的属性。

  6. 配置IPSec安全策略,确定对何种数据流采取何种保护方法。

  7. 在接口上应用IPSec安全策略,使接口具有IPSec的保护功能。

配置注意事项

  • 如果两端使用缺省参数协商建立IPSec隧道,必须确保两端的缺省值都一样,否则将会导致IPSec隧道建立失败。如果对双方的缺省值不清楚,建议手工进行配置。

  • MD5、SHA-1、DES和3DES算法存在安全隐患,请谨慎使用。

  • 使用Ping方式检测连通性,需要在华为防火墙接口视图下执行命令service-manage ping permit将防火墙接口的Ping服务设置为允许。

  • 两端的IPSec安全提议中都使用SHA2算法时,如果设备之间能建立IPSec隧道,但设备之间的流量不通,则可能是两端设备的SHA2加密解密方式不一致导致设备之间的流量不通。此时,建议根据实际情况在AR路由器上执行命令ipsec authentication sha2 compatible enable/undo ipsec authentication sha2 compatible enable使两端设备使用相同的SHA2加密解密方式。

  • 此例中设备使用IKEv1协商,缺省情况下,华为防火墙不支持通过IKEv1协商SA,使用IKEv1相关功能需要加载IKEv1模块文件,具体步骤如下:

    1. 请登录华为技术支持网站,在软件下载专区中搜索对应产品和版本,下载Product_Version_IKEv1_MOD00X.MOD。

    2. 上传模块文件到存储介质中(必须存放在$_install_mod目录下)。

    3. 使用命令install-module Product_Version_IKEv1_MOD00X.MOD配置在线加载模块文件。

操作步骤

  • 配置华为AR路由器

    1. 配置接口的IP地址和到对端的静态路由。

      # 配置接口的IP地址。

      <HUAWEI> system-view [HUAWEI] sysname DeviceA [DeviceA] interface gigabitethernet 1/0/1 [DeviceA-GigabitEthernet1/0/1] ip address 1.1.1.1 255.255.255.0 [DeviceA-GigabitEthernet1/0/1] quit [DeviceA] interface gigabitethernet 1/0/2 [DeviceA-GigabitEthernet1/0/2] ip address 10.1.1.1 255.255.255.0 [DeviceA-GigabitEthernet1/0/2] quit

      # 配置到对端的静态路由,此处假设到对端的下一跳地址为1.1.1.2。

      [DeviceA] ip route-static 0.0.0.0 0.0.0.0 1.1.1.2
    2. 配置ACL,定义需要保护的数据流 。

      [DeviceA] acl number 3101 [DeviceA-acl-adv-3101] rule permit ip source 10.1.1.0 0.0.0.255 destination 10.1.2.0 0.0.0.255 [DeviceA-acl-adv-3101] quit
    3. 配置IPSec安全提议。

      [DeviceA] ipsec proposal tran1 [DeviceA-ipsec-proposal-tran1] encapsulation-mode tunnel [DeviceA-ipsec-proposal-tran1] transform esp [DeviceA-ipsec-proposal-tran1] esp authentication-algorithm sha2-256 [DeviceA-ipsec-proposal-tran1] esp encryption-algorithm aes-256 [DeviceA-ipsec-proposal-tran1] quit
    4. 配置IKE安全提议。

      [DeviceA] ike proposal 5 [DeviceA-ike-proposal-5] authentication-method pre-share [DeviceA-ike-proposal-5] encryption-algorithm aes-256 [DeviceA-ike-proposal-5] authentication-algorithm sha2-256 [DeviceA-ike-proposal-5] dh group14 [DeviceA-ike-proposal-5] quit
    5. 配置IKE对等体。

      [DeviceA] ike peer spub [DeviceA-ike-peer-spub] undo version 2 [DeviceA-ike-peer-spub] exchange-mode main [DeviceA-ike-peer-spub] ike-proposal 5 [DeviceA-ike-peer-spub] pre-shared-key Huawei@123 [DeviceA-ike-peer-spub] local-id-type ip [DeviceA-ike-peer-spub] remote-address 2.1.1.1 [DeviceA-ike-peer-spub] quit
    6. 配置IPSec安全策略。

      [DeviceA] ipsec policy map1 10 isakmp [DeviceA-ipsec-policy-isakmp-map1-10] ike-peer spub [DeviceA-ipsec-policy-isakmp-map1-10] proposal tran1 [DeviceA-ipsec-policy-isakmp-map1-10] security acl 3101 [DeviceA-ipsec-policy-isakmp-map1-10] sa trigger-mode auto [DeviceA-ipsec-policy-isakmp-map1-10] quit
    7. 在接口上应用IPSec安全策略。

      [DeviceA] interface gigabitethernet 1/0/1 [DeviceA-GigabitEthernet1/0/1] ipsec policy map1 [DeviceA-GigabitEthernet1/0/1] quit
  • 配置华为防火墙

    1. 安装IKEv1模块文件包。

      <HUAWEI> install-module Product_Version_IKEv1_MOD00X.MOD
    2. 配置接口的IP地址、接口加入安全区域、域间安全策略和到对端的静态路由。

      # 配置接口的IP地址,并将接口加入安全区域。

      [HUAWEI] interface ge 1/0/1 [HUAWEI-GE1/0/1] ip address 2.1.1.1 255.255.255.0 [HUAWEI-GE1/0/1] quit [HUAWEI] interface ge 1/0/2 [HUAWEI-GE1/0/2] ip address 10.1.2.1 255.255.255.0 [HUAWEI-GE1/0/2] quit [HUAWEI] firewall zone trust [HUAWEI-zone-trust] add interface ge 1/0/2 [HUAWEI-zone-trust] quit [HUAWEI] firewall zone untrust [HUAWEI-zone-untrust] add interface ge 1/0/1 [HUAWEI-zone-untrust] quit

      # 配置域间安全策略。

      # 配置untrust和trust之间的安全策略,保证分支和总部能够进行互访。 [HUAWEI] security-policy [HUAWEI-policy-security] rule name policy1 [HUAWEI-policy-security-rule-policy1] source-zone trust [HUAWEI-policy-security-rule-policy1] destination-zone untrust [HUAWEI-policy-security-rule-policy1] source-address 10.1.2.0 24 [HUAWEI-policy-security-rule-policy1] destination-address 10.1.1.0 24 [HUAWEI-policy-security-rule-policy1] action permit [HUAWEI-policy-security-rule-policy1] quit [HUAWEI-policy-security] rule name policy2 [HUAWEI-policy-security-rule-policy2] source-zone untrust [HUAWEI-policy-security-rule-policy2] destination-zone trust [HUAWEI-policy-security-rule-policy2] source-address 10.1.1.0 24 [HUAWEI-policy-security-rule-policy2] destination-address 10.1.2.0 24 [HUAWEI-policy-security-rule-policy2] action permit [HUAWEI-policy-security-rule-policy2] quit # 配置local与untrust之间的安全策略,保证防火墙能够发起和接收IPSec隧道建立请求,源、目的IP地址为两端的出口公网地址。 [HUAWEI-policy-security] rule name policy3 [HUAWEI-policy-security-rule-policy3] source-zone local [HUAWEI-policy-security-rule-policy3] destination-zone untrust [HUAWEI-policy-security-rule-policy3] source-address 2.1.1.1 32 [HUAWEI-policy-security-rule-policy3] destination-address 1.1.1.1 32 [HUAWEI-policy-security-rule-policy3] action permit [HUAWEI-policy-security-rule-policy3] quit [HUAWEI-policy-security] rule name policy4 [HUAWEI-policy-security-rule-policy4] source-zone untrust [HUAWEI-policy-security-rule-policy4] destination-zone local [HUAWEI-policy-security-rule-policy4] source-address 1.1.1.1 32 [HUAWEI-policy-security-rule-policy4] destination-address 2.1.1.1 32 [HUAWEI-policy-security-rule-policy4] action permit [HUAWEI-policy-security-rule-policy4] quit [HUAWEI-policy-security] quit

      # 配置到对端的静态路由,此处假设到对端的下一跳地址为2.1.1.2。

      [HUAWEI] ip route-static 0.0.0.0 0.0.0.0 2.1.1.2
    3. 配置ACL,定义需要保护的数据流 。

      [HUAWEI] acl number 3101 [HUAWEI-acl4-advance-3101] rule permit ip source 10.1.2.0 0.0.0.255 destination 10.1.1.0 0.0.0.255 [HUAWEI-acl4-advance-3101] quit
    4. 配置IPSec安全提议。

      [HUAWEI] ipsec proposal tran1 [HUAWEI-ipsec-proposal-tran1] encapsulation-mode tunnel [HUAWEI-ipsec-proposal-tran1] transform esp [HUAWEI-ipsec-proposal-tran1] esp authentication-algorithm sha2-256 [HUAWEI-ipsec-proposal-tran1] esp encryption-algorithm aes-256 [HUAWEI-ipsec-proposal-tran1] quit
    5. 配置IKE安全提议。

      [HUAWEI] ike proposal 5 [HUAWEI-ike-proposal-5] authentication-method pre-share [HUAWEI-ike-proposal-5] encryption-algorithm aes-256 [HUAWEI-ike-proposal-5] authentication-algorithm sha2-256 [HUAWEI-ike-proposal-5] dh group14 [HUAWEI-ike-proposal-5] quit
    6. 配置IKE对等体。

      [HUAWEI] ike peer spub [HUAWEI-ike-peer-spub] undo version 2 [HUAWEI-ike-peer-spub] exchange-mode main [HUAWEI-ike-peer-spub] ike-proposal 5 [HUAWEI-ike-peer-spub] pre-shared-key Huawei@123 [HUAWEI-ike-peer-spub] local-id-type ip [HUAWEI-ike-peer-spub] remote-address 1.1.1.1 [HUAWEI-ike-peer-spub] quit
    7. 配置IPSec安全策略。

      [HUAWEI] ipsec policy map1 10 isakmp [HUAWEI-ipsec-policy-isakmp-map1-10] ike-peer spub [HUAWEI-ipsec-policy-isakmp-map1-10] proposal tran1 [HUAWEI-ipsec-policy-isakmp-map1-10] security acl 3101 [HUAWEI-ipsec-policy-isakmp-map1-10] sa trigger-mode auto [HUAWEI-ipsec-policy-isakmp-map1-10] quit
    8. 在接口上应用IPSec安全策略。

      [HUAWEI] interface ge 1/0/1 [HUAWEI-GE1/0/1] ipsec policy map1 [HUAWEI-GE1/0/1] quit

结果验证

  1. 执行命令display ike sa,可以查看到IKE SA和IPSec SA已建立成功。以路由器为例。

    <DeviceA> display ike sa  IKE SA information :          Conn-ID     Peer            VPN   Flag(s)  Phase  RemoteType  RemoteID   -----------------------------------------------------------------------------       1679       2.1.1.1:500           RD|ST|A  v1:2   IP          2.1.1.1       1677       2.1.1.1:500           RD|ST|A  v1:1   IP          2.1.1.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
  2. PC1和PC2之间可以相互Ping通。以PC1 Ping PC2为例。

    C:\Users\huawei> ping 10.1.2.2     Pinging 10.1.2.2 with 32 bytes of data:   Reply from 10.1.2.2: bytes=32 time=9ms TTL=126   Reply from 10.1.2.2: bytes=32 time=9ms TTL=126   Reply from 10.1.2.2: bytes=32 time=9ms TTL=126   Reply from 10.1.2.2: bytes=32 time=9ms TTL=126      Ping statistics for 10.1.2.2:       Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),   Approximate round trip times in milli-seconds:       Minimum = 9ms, Maximum = 9ms, Average = 9ms

    虽然IPSec隧道建立成功了,私网可以相互Ping通,但是如何判断业务报文IPSec隧道传输呢?这里介绍常见两种办法供大家参考。

    这两种方法虽然都可以查看IPSec隧道中报文的变化,但是第一种方法可以观察到指定IPSec隧道的报文变化;而第二种方法是全局性的统计信息,观察的是整个设备的IPSec隧道报文变化。如果设备同时存在多条隧道,则第二种方法就不太适用了,所以推荐使用第一种办法查看。

    对于流量触发建立IPSec隧道,首个业务报文不会进入隧道封装,会被丢弃掉。这是因为首包发出时,IPSec隧道还未建立,无法进行转发。例如,分支用户向总部用户发送了10个ICMP报文,实际使用display ipsec statistics命令查看时,统计信息中可能显示只有9个报文,这属于正常情况。

    • 查看display ipsec sa命令回显信息中max sent sequence-number字段的值。这个字段原本是为抗重放功能设计的,设备的IPSec隧道每发出一个报文,这里的sequence-number就相应加1。这样一来,我们就可以利用该字段值的变化来判断流量是否经过这条IPSec隧道传输了。例如,分支用户向总部用户发送了5个ICMP报文,如果这5个ICMP报文是经过这条IPSec隧道传输的,那么对应这条隧道的IPSec SA中sequence-number的值将会增加5。反之,如果这里sequence-number的值没有增长或者增长数目不对,则说明这些报文没有经过这条IPSec隧道传输或者是这条IPSec隧道有异常。

    • 查看display ipsec statistics命令回显信息中input/output security packets字段的值。通过该值的变化可以判断报文是否经过IPSec隧道传输。例如,input/output security packets: 4/4,说明IPSec隧道发出去了4个报文,也收到了4个报文。

配置文件

  • 华为AR路由器的配置文件

    #   sysname DeviceA  #  acl number 3101   rule 5 permit ip source 10.1.1.0 0.0.0.255 destination 10.1.2.0 0.0.0.255  #  ipsec proposal tran1   esp authentication-algorithm sha2-256    esp encryption-algorithm aes-256  #  ike proposal 5   encryption-algorithm aes-256                                                      dh group14                                                                         authentication-algorithm sha2-256                                                 authentication-method pre-share                                                #  ike peer spub   undo version 2   pre-shared-key %@%@:A(|N&D21)L2L0Z2WlVE9.-u%@%@%^%#JvZxR2g8c;a9~FPN~n'$7`DEV&=G(=Et02P/%\*!%^%#   ike-proposal 5   remote-address 2.1.1.1  #  ipsec policy map1 10 isakmp   security acl 3101   ike-peer spub   proposal tran1  #  interface GigabitEthernet1/0/1   ip address 1.1.1.1 255.255.255.0   ipsec policy map1  #  interface GigabitEthernet1/0/2   ip address 10.1.1.1 255.255.255.0  #  ip route-static 0.0.0.0 0.0.0.0 1.1.1.2  #  return
  • 华为防火墙的配置文件

    #  sysname HUAWEI  #  acl number 3101   rule 5 permit ip source 10.1.2.0 0.0.0.255 destination 10.1.1.0 0.0.0.255  #  ipsec proposal tran1   esp authentication-algorithm sha2-256    esp encryption-algorithm aes-256  #  ike proposal 5   encryption-algorithm aes-256                                                      dh group14                                                                         authentication-algorithm sha2-256                                                 authentication-method pre-share                                                #  ike peer spub   undo version 2   pre-shared-key %^%#p7,cEWZqBI<4DT7CZUP:f|LjJ\zNLTbsAAG|d,8T%^%#   ike-proposal 5   remote-address 1.1.1.1  #  ipsec policy map1 10 isakmp   security acl 3101   ike-peer spub   proposal tran1  #  interface GigabitEthernet1/0/1   undo shutdown   ip address 2.1.1.1 255.255.255.0   ipsec policy map1  #  interface GE1/0/2   undo shutdown   ip address 10.1.2.1 255.255.255.0  #  firewall zone trust   set priority 85   add interface GE1/0/2  #  firewall zone untrust    set priority 5    add interface GE1/0/1  #  ip route-static 0.0.0.0 0.0.0.0 2.1.1.2  #  security-policy   rule name policy1    source-zone trust    destination-zone untrust    source-address 10.1.2.0 mask 255.255.255.0    destination-address 10.1.1.0 mask 255.255.255.0    action permit   rule name policy2    source-zone untrust    destination-zone trust    source-address 10.1.1.0 mask 255.255.255.0    destination-address 10.1.2.0 mask 255.255.255.0    action permit   rule name policy3    source-zone local    destination-zone untrust    source-address 2.1.1.1 mask 255.255.255.255    destination-address 1.1.1.1 mask 255.255.255.255    action permit   rule name policy4    source-zone untrust    destination-zone local    source-address 1.1.1.1 mask 255.255.255.255    destination-address 2.1.1.1 mask 255.255.255.255    action permit  #  return


本文链接:https://www.hqyman.cn/post/5756.html 非本站原创文章欢迎转载,原创文章需保留本站地址!

分享到:





休息一下,本站随机推荐观看栏目:


« 上一篇 下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

您的IP地址是: