侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

总部/分支之间建立点到多点IPSec ×××

2022-06-27 星期一 / 0 评论 / 0 点赞 / 96 阅读 / 66565 字

总部/分支之间建立点到多点IPSec ×××分支机构和总部之间通信,如果某些分支机构的公网地址固定,另外一些分支机构的公网地址不固定,可采用此方式建立IPSec隧道。组网需求图1 总部与多个分支机构之

.

总部/分支之间建立点到多点IPSec ×××

分支机构和总部之间通信,如果某些分支机构的公网地址固定,另外一些分支机构的公网地址不固定,可采用此方式建立IPSec隧道。

组网需求

图1 总部与多个分支机构之间的组网示意图

如图1所示,组网情况如下:

  • 某企业由总部和若干个分支机构组成。总部和分支机构1~分支机构n的IP地址都为固定地址,其他分支机构的IP地址为动态地址。

  • 总部和各分支机构的私网IP都属于10.0.0.0/8网段。

该企业网络需实现以下需求:

  • 每个分支机构都要访问总部的服务器设备,且传输的数据需要加密。

  • 各分支机构之间不能直接进行任何通信,只能经过总部进行通信。

网络规划

将图1的网络结构抽象为如图2所示组网,其中分支机构1的公网IP地址为动态地址,分支机构2的公网IP地址为固定地址。USG_B和USG_C分别对应IP地址不固定和IP地址固定的分支机构的×××网关。网络规划如下:

  • 总部和分支机构1、总部和分支机构2之间通信数据需要加密,需分别配置IPSec ×××。

  • 对于总部和分支机构1,由于只有分支机构1主动访问总部服务器,故在总部采用策略模板方式建立IPSec ×××即可。

  • 对于总部和分支机构2,由于要进行互访,故只能建立点到点方式的IPSec。

  • USG_A作为总部的网关设备,连接公网的接口只有一个,故要将上述两个IPSec ×××的IPSec策略都应用到此接口上。由于每个接口上只能应用一个IPSec策略,故需采用子策略方式建立IPSec隧道。

  • 由于分支机构1和分支机构2之间不能直接进行任何通信,USG_B和USG_C之间不建立任何IPSEC隧道。由于分支机构1的公网地址不固定,双方进行通信的方式如下。

  1. USG_B向总部发起连接并建立IPSec隧道。

  2. 在分支机构1、分支机构2与总部能够通过IPSec隧道安全通信之后,分支机构1和分支机构2通过USG_A进行安全通信。

图2 配置采用策略模版+子策略方式建立IPSec隧道

项目

USG_A

USG_B

USG_C

接口

(1)

GigabitEthernet 6/0/0

IP地址:10.10.1.1/24

(2)

GigabitEthernet 0/0/2

IP地址:200.1.1.1/24

(3)

GigabitEthernet 0/0/2

IP地址:位于30.1.2.1/24~30.1.2.254/24网段。

(5)

GigabitEthernet 6/0/0

IP地址:10.20.1.1/24

(4)

GigabitEthernet 0/0/2

IP地址:30.1.1.1/24

(6)

GigabitEthernet 6/0/0

IP地址:10.20.2.1/24

IPSec策略建立方式

子策略1:策略模板

子策略2:非模板

非模板

非模板

IPSec安全提议

封装模式

隧道模式

隧道模式

隧道模式

安全协议

ESP

ESP

ESP

ESP协议验证算法

SHA1

SHA1

SHA1

ESP协议加密算法

AES

AES

AES

IKE对等体

协商模式

子策略1:主模式

子策略2:主模式

主模式

主模式

预共享密钥

子策略1:Key123

子策略2:Key456

Key123

Key456

本地身份类型

子策略1:fqdn

子策略2:IP地址

fqdn

IP地址

版本

v1和v2

v1和v2

v1和v2

操作步骤

  1. 配置USG_A的IPSec功能。

    说明:

    USG_A的基础配置过程略。基础配置包括配置相关接口的IP地址,将接口加入相应的安全区域,配置域间包过滤,配置路由等。

    1. 配置访问控制列表,定义要保护的数据流。

      说明:

      总部网关USG_A配置若干个ACL,其中为所有的动态分支配置一个ACL,每一个静态分支创建一个ACL。ACL规则的源地址为总部和分支的所有网段地址范围,目的地址为某分支网段。

      # 配置源IP地址为10.0.0.0/8、目的IP地址为10.20.1.0/24的规则。

      [USG_A] acl 3000 [USG_A-acl-adv-3000] rule permit ip source 10.0.0.0 0.255.255.255 destination 10.20.1.0 0.0.0.255 [USG_A-acl-adv-3000] quit

      # 配置源IP地址为10.0.0.0/8、目的IP地址为10.20.2.0/24的规则。

      [USG_A] acl 3001 [USG_A-acl-adv-3001] rule permit ip source 10.0.0.0 0.255.255.255 destination 10.20.2.0 0.0.0.255 [USG_A-acl-adv-3001] quit
    2. 配置USG_A到达USG_B和USG_C的静态路由,假设下一跳地址为200.1.1.2/24。

      [USG_A] ip route-static 10.20.1.0 255.255.255.0 200.1.1.2
      [USG_A] ip route-static 10.20.2.0 255.255.255.0 200.1.1.2
    3. 创建IPSec安全提议。

      [USG_A] ipsec proposal tran1 [USG_A-ipsec-proposal-tran1] encapsulation-mode tunnel [USG_A-ipsec-proposal-tran1] transform esp [USG_A-ipsec-proposal-tran1] esp authentication-algorithm sha1 [USG_A-ipsec-proposal-tran1] esp encryption-algorithm aes [USG_A-ipsec-proposal-tran1] quit
      [USG_A] ipsec proposal tran2 [USG_A-ipsec-proposal-tran2] encapsulation-mode tunnel [USG_A-ipsec-proposal-tran2] transform esp [USG_A-ipsec-proposal-tran2] esp authentication-algorithm sha1 [USG_A-ipsec-proposal-tran2] esp encryption-algorithm aes [USG_A-ipsec-proposal-tran2] quit
    4. 创建IKE安全提议。

      [USG_A] ike proposal 10 [USG_A-ike-proposal-10] authentication-method pre-share [USG_A-ike-proposal-10] authentication-algorithm sha1 [USG_A-ike-proposal-10] quit
      [USG_A] ike proposal 11 [USG_A-ike-proposal-11] authentication-method pre-share [USG_A-ike-proposal-11] authentication-algorithm sha1 [USG_A-ike-proposal-11] quit
    5. 配置IKE peer。

      [USG_A] ike local-name USG_A[USG_A] ike peer a1 [USG_A-ike-peer-a1] ike-proposal 10 [USG_A-ike-peer-a1] local-id-type fqdn [USG_A-ike-peer-a1] remote-id USG_B[USG_A-ike-peer-a1] pre-shared-key Key123[USG_A-ike-peer-a1] quit
      [USG_A] ike peer a2 [USG_A-ike-peer-a2] ike-proposal 11 [USG_A-ike-peer-a2] remote-address 30.1.1.1[USG_A-ike-peer-a2] pre-shared-key Key456 [USG_A-ike-peer-a2] quit
    6. 创建安全策略。

      [USG_A] ipsec policy-template map_temp 10 [USG_A-ipsec-policy-template-map_temp-10] security acl 3000 [USG_A-ipsec-policy-template-map_temp-10] proposal tran1 [USG_A-ipsec-policy-template-map_temp-10] ike-peer a1 [USG_A-ipsec-policy-template-map_temp-10] quit[USG_A] ipsec policy map1 100 isakmp template map_temp
      [USG_A] ipsec policy map1 11 isakmp [USG_A-ipsec-policy-isakmp-map1-11] security acl 3001 [USG_A-ipsec-policy-isakmp-map1-11] proposal tran2 [USG_A-ipsec-policy-isakmp-map1-11] ike-peer a2 [USG_A-ipsec-policy-isakmp-map1-11] quit

      说明:

      同一个IPSec安全策略组中模板方式安全策略的序号必须大于直接创建的安全策略的序号。即同一个IPSec安全策略组中模板方式安全策略的优先级必须最低,否则可能导致协商失败。

    7. 在接口上引用安全策略。

      [USG_A] interface GigabitEthernet 0/0/2 [USG_A-GigabitEthernet0/0/2] ipsec policy map1

      配置完成后,可执行display ipsec policy命令查看IPSec的配置情况。出现以下显示信息说明配置成功。

      ===========================================                                     IPsec Policy Group: "map1"                                                      Using interface: {GigabitEthernet0/0/2}                               ===========================================                                                                                                                       -----------------------------                                                   IPsec policy name: "map1"                                                       sequence number: 11                                                             mode: isakmp                                                                    state: active    -----------------------------                                                     security data flow : 3001                                                       ike-peer name:  a2                                                              perfect forward secrecy: None                                                   proposal name:  tran2                                                              IPsec sa local duration(time based): 22222 seconds                              sa soft-duration time-based buffer: 22200 seconds                               sa soft-duration traffic-based buffer: 22200 kilobytes                          IPsec sa local duration(traffic based): 22222 kilobytes                         IPSec sa anti-replay: use global                                                IPSec sa anti-replay window-size: use global    -----------------------------                                                   IPsec policy name: "map1"                                                       sequence number: 100                                                             mode: template                                                                  state: active    -----------------------------                                                     policy template name: map_temp
  2. 配置USG_B的IPSec功能。

    1. 配置访问控制列表,定义要保护的数据流。

      # 配置源IP地址为10.20.1.0/24、目的地址为10.0.0.0/8的规则。

      [USG_B] acl 3000 [USG_B-acl-adv-3000] rule permit ip source 10.20.1.0 0.0.0.255 destination 10.0.0.0 0.255.255.255 [USG_B-acl-adv-3000] quit
    2. 配置USG_B到达USG_A和USG_C的静态路由。

      说明:

      假设USG_B目前的公网IP地址为30.1.2.1,到达USG_A和USG_C的下一跳地址为30.1.2.2。

      [USG_B] ip route-static 10.10.1.0 255.255.255.0 30.1.2.2[USG_B] ip route-static 10.20.2.0 255.255.255.0 30.1.2.2
    3. 创建IPSec安全提议。

      [USG_B] ipsec proposal tran1 [USG_B-ipsec-proposal-tran1] encapsulation-mode tunnel [USG_B-ipsec-proposal-tran1] transform esp [USG_B-ipsec-proposal-tran1] esp authentication-algorithm sha1 [USG_B-ipsec-proposal-tran1] esp encryption-algorithm aes[USG_B-ipsec-proposal-tran1] quit
    4. 创建IKE安全提议。

      [USG_B] ike proposal 10 [USG_B-ike-proposal-10] authentication-method pre-share [USG_B-ike-proposal-10] authentication-algorithm sha1 [USG_B-ike-proposal-10] quit
    5. 配置IKE peer。

      [USG_B] ike local-name USG_B[USG_B] ike peer b [USG_B-ike-peer-b] ike-proposal 10 [USG_B-ike-peer-b] local-id-type fqdn [USG_B-ike-peer-b] remote-id USG_A[USG_B-ike-peer-b] pre-shared-key Key123 [USG_B-ike-peer-b] remote-address 200.1.1.1[USG_B-ike-peer-b] quit
    6. 创建安全策略。

      [USG_B] ipsec policy map1 10 isakmp [USG_B-ipsec-policy-isakmp-map1-10] security acl 3000 [USG_B-ipsec-policy-isakmp-map1-10] proposal tran1 [USG_B-ipsec-policy-isakmp-map1-10] ike-peer b [USG_B-ipsec-policy-isakmp-map1-10] quit
    7. 在物理接口上引用安全策略。

      [USG_B] interface GigabitEthernet 0/0/2 [USG_B-GigabitEthernet0/0/2] ipsec policy map1

      配置完成后,可执行display ipsec policy命令查看IPSec的配置情况。出现以下显示信息说明配置成功。

      [USG_B] display ipsec policy name map1                                                                                      ===========================================                                     IPsec Policy Group: "map1"                                                      Using interface: {GigabitEthernet0/0/2}                                                      ===========================================                                                                                                                       -----------------------------                                                   IPsec policy name: "map1"                                                       sequence number: 10                                                             mode: isakmp                                                                    state: active     -----------------------------                                                     security data flow : 3000                                                       ike-peer name:  b                                                              perfect forward secrecy: None                                                   proposal name:  tran1                                                              IPsec sa local duration(time based): 22222 seconds                              sa soft-duration time-based buffer: 22200 seconds                               sa soft-duration traffic-based buffer: 22200 kilobytes                          IPsec sa local duration(traffic based): 22222 kilobytes                         IPSec sa anti-replay: use global                                                IPSec sa anti-replay window-size: use global
  3. 配置USG_C的IPSec功能。

    1. 配置访问控制列表,定义要保护的数据流。

      # 配置源IP地址为10.20.2.0/24、目的IP地址为10.0.0.0/8的规则。

      [USG_C] acl 3000 [USG_C-acl-adv-3000] rule permit ip source 10.20.2.0 0.0.0.255 destination 10.0.0.0 0.255.255.255 [USG_C-acl-adv-3000] quit
    2. 配置USG_C到达USG_A和USG_B的静态路由,假设下一跳地址为30.1.1.2。

      [USG_C] ip route-static 10.10.1.0 255.255.255.0 30.1.1.2[USG_C] ip route-static 10.20.1.0 255.255.255.0 30.1.1.2
    3. 创建IPSec安全提议。

      [USG_C] ipsec proposal tran1 [USG_C-ipsec-proposal-tran1] encapsulation-mode tunnel [USG_C-ipsec-proposal-tran1] transform esp [USG_C-ipsec-proposal-tran1] esp authentication-algorithm sha1 [USG_C-ipsec-proposal-tran1] esp encryption-algorithm aes [USG_C-ipsec-proposal-tran1] quit
    4. 创建IKE安全提议。

      [USG_C] ike proposal 10 [USG_C-ike-proposal-10] authentication-method pre-share [USG_C-ike-proposal-10] authentication-algorithm sha1 [USG_C-ike-proposal-10] quit
    5. 配置IKE peer。

      [USG_C] ike peer c [USG_C-ike-peer-c] ike-proposal 10 [USG_C-ike-peer-c] pre-shared-key Key456 [USG_C-ike-peer-c] remote-address 200.1.1.1[USG_C-ike-peer-c] quit
    6. 创建安全策略。

      [USG_C] ipsec policy map1 10 isakmp [USG_C-ipsec-policy-isakmp-map1-10] security acl 3000 [USG_C-ipsec-policy-isakmp-map1-10] proposal tran1 [USG_C-ipsec-policy-isakmp-map1-10] ike-peer c [USG_C-ipsec-policy-isakmp-map1-10] quit
    7. 在物理接口上引用安全策略。

      [USG_C] interface GigabitEthernet 0/0/2 [USG_C-GigabitEthernet0/0/2] ipsec policy map1

      配置完成后,可执行display ipsec policy命令查看IPSec的配置情况。出现以下显示信息说明配置成功。

      [USG_C] display ipsec policy name map1                                                                                      ===========================================                                     IPsec Policy Group: "map1"                                                      Using interface: {GigabitEthernet0/0/2}                                                      ===========================================                                                                                                                       -----------------------------                                                   IPsec policy name: "map1"                                                       sequence number: 10                                                             mode: isakmp                                                                    state: active    -----------------------------                                                     security data flow : 3000                                                       ike-peer name:  c                                                              perfect forward secrecy: None                                                   proposal name:  tran1                                                              IPsec sa local duration(time based): 22222 seconds                              sa soft-duration time-based buffer: 22200 seconds                               sa soft-duration traffic-based buffer: 22200 kilobytes                          IPsec sa local duration(traffic based): 22222 kilobytes                         IPSec sa anti-replay: use global                                                IPSec sa anti-replay window-size: use global

结果验证

  1. 分支机构2和总部之间可以互相访问,双方都可以触发IPSEC SA的建立。如用总部来ping分支机构2内网设备,可以ping通,且分别在USG_A和USG_C上执行display ike sadisplay ipsec sa会显示安全联盟的建立情况。以USG_A为例,出现以下显示说明IKE安全联盟、IPSec安全联盟建立成功。

    <USG_A>display ike sa            current ike sa number: 2  ---------------------------------------------------------------------     conn-id     peer                     flag        phase     ***  ---------------------------------------------------------------------     40001       30.1.1.1                 RD|ST       v2:2      public     1           30.1.1.1                 RD|ST       v2:1      public  flag meaning  RD--READY    ST--STAYALIVE  RL--REPLACED      FD--FADING  TO--TIMEOUT  TD--DELETING   NEG--NEGOTIATING  D--DPD
    <USG_A>display ipsec sa brief           current ipsec sa number: 2                                                      current ipsec tunnel number: 1                                                  --------------------------------------------------------------                  Src Address     Dst Address     SPI          Protocol  Algorithm             -------------------------------------------------------------------             30.1.1.1        200.1.1.1       49286024     ESP       E:AES;A:HMAC-SHA1-96;  200.1.1.1       30.1.1.1        239495571    ESP       E:AES;A:HMAC-SHA1-96;
  2. 分支机构1能够主动访问总部。配置成功后,在分支机构1执行ping操作可以ping通总部。分别在USG_A和USG_B上执行display ike sadisplay ipsec sa会显示安全联盟的建立情况。以USG_A为例,出现以下显示说明IKE安全联盟、IPSec安全联盟建立成功。

    <USG_A>display ike sa                                     current ike sa number: 4  ---------------------------------------------------------------------     conn-id     peer                     flag        phase     ***  ---------------------------------------------------------------------     40001       30.1.1.1                 RD|ST       v2:2      public     1           30.1.1.1                 RD|ST       v2:1      public     40003       30.1.2.1                 RD          v2:2      public     40002       30.1.2.1                 RD          v2:1      public  flag meaning  RD--READY    ST--STAYALIVE  RL--REPLACED      FD--FADING  TO--TIMEOUT  TD--DELETING   NEG--NEGOTIATING  D--DPD
    <USG_A>display ipsec sa brief           current ipsec sa number: 4                                                      current ipsec tunnel number: 2                                                  --------------------------------------------------------------                  Src Address     Dst Address     SPI          Protocol  Algorithm             -------------------------------------------------------------------             30.1.1.1       200.1.1.1       142427840    ESP       E:AES;A:HMAC-SHA1-96;  200.1.1.1       30.1.1.1       52885424     ESP       E:AES;A:HMAC-SHA1-96;  30.1.2.1       200.1.1.1       49286024     ESP       E:AES;A:HMAC-SHA1-96;  200.1.1.1       30.1.2.1       239495571    ESP       E:AES;A:HMAC-SHA1-96;
  3. 执行命令display ipsec statistics可以查看被加密的数据包的变化,即它们之间的数据传输将被加密。以USG_A为例。

    <USG_A>display ipsec statistics                             the security packet statistics:               input/output security packets: 9/9                                              input/output security bytes: 756/756                                         input/output dropped security packets: 0/0                                      the encrypt packet statistics                                                     send sae:9, recv sae:9, send err:0                                              local cpu:9, other cpu:0, recv other cpu:0                                      intact packet:2, first slice:0, after slice:0                                 the decrypt packet statistics                                                     send sae:9, recv sae:9, send err:0                                              local cpu:9, other cpu:0, recv other cpu:0                                      reass  first slice:0, after slice:0, len err:0                                dropped security packet detail:                                                   no enough memory: 0, too long: 0                                                can't find SA: 0, wrong SA: 0                                                   authentication: 0, replay: 0                                                    front recheck: 0, after recheck: 0                                              exceed byte limit: 0, exceed packet limit: 0                                    change cpu enc: 0, dec change cpu: 0                                            change datachan: 0, fib search: 0                                               rcv enc(dec) form sae said err: 0, 0                                            port number error: 0                                                            send port: 0, output l3: 0, l2tp input: 0                                   negotiate about packet statistics:                                                IP packet  ok:0, err:0, drop:0                                                  IP rcv other cpu   to ike:0, drop:0                                             IKE packet inbound   ok:2, err:0                                                IKE packet outbound  ok:2, err:0                                                SoftExpr:0, HardExpr:0, DPDOper:0, SwapSa:0                                     ModpCnt: 2, SaeSucc: 2, SoftwareSucc: 0
  4. 当两条IPSec隧道都建立成功后,分支机构1与分支机构2能够互相访问,且两者之间的访问是经过了总部设备来实现的。

配置脚本

  • USG_A的配置脚本

    #                        ike local-name USG_A#acl number 3000 rule 5 permit ip source 10.0.0.0 0.255.255.255 destination 10.20.1.0 0.0.0.255#acl number 3001 rule 5 permit ip source 10.0.0.0 0.255.255.255 destination 10.20.2.0 0.0.0.255#ip route-static 10.20.1.0 255.255.255.0 200.1.1.2ip route-static 10.20.2.0 255.255.255.0 200.1.1.2#ike proposal 10 encryption-algorithm aes-cbc dh group2#ike proposal 11 encryption-algorithm aes-cbc dh group2#                        ike peer a1                pre-shared-key %$%$+x!93lf{r+w#M27fa9Z8jmd[%$%$   ike-proposal 10          local-id-type fqdn remote-id USG_B#                        ike peer a2                pre-shared-key %$%${vC:RV[[email protected]=4+%$%$   ike-proposal 11          remote-address 30.1.1.1# ipsec proposal tran1 esp authentication-algorithm sha1 esp encryption-algorithm aes# ipsec proposal tran2 esp authentication-algorithm sha1 esp encryption-algorithm aes#                        ipsec policy-template map_temp 10                       security acl 3000        ike-peer a1              proposal tran1            #                        ipsec policy map1 11 isakmp                    security acl 3001        ike-peer a2           proposal tran2            #                        ipsec policy map1 100 isakmp template map_temp    # interface GigabitEthernet6/0/0                              ip address 10.10.1.1 255.255.255.0#                        interface GigabitEthernet0/0/2           ip address 200.1.1.1 255.255.255.0 ipsec policy map1
  • USG_B的配置脚本

    #                         ike local-name USG_B#acl number 3000 rule 5 permit ip source 10.20.1.0 0.0.0.255 destination 10.0.0.0 0.255.255.255#ip route-static 10.10.1.0 255.255.255.0 30.1.2.2ip route-static 10.20.2.0 255.255.255.0 30.1.2.2#ike proposal 10 encryption-algorithm aes-cbc dh group2#                        ike peer b                pre-shared-key %$%$+x!93lf{r+w#M27fa9Z8jmd[%$%$   ike-proposal 10          local-id-type fqdn remote-address 200.1.1.1 remote-id USG_A# ipsec proposal tran1 esp authentication-algorithm sha1 esp encryption-algorithm aes#                        ipsec policy map1 10 isakmp                security acl 3000        ike-peer b              proposal tran1            #interface GigabitEthernet6/0/0             ip address 10.20.1.1 255.255.255.0                                           #                        interface GigabitEthernet0/0/2          ip address 30.1.2.1 255.255.255.0 ipsec policy map1
  • USG_C配置脚本

    #acl number 3000 rule 5 permit ip source 10.20.2.0 0.0.0.255 destination 10.0.0.0 0.255.255.255#ip route-static 10.10.1.0 255.255.255.0 30.1.1.2ip route-static 10.20.1.0 255.255.255.0 30.1.1.2#ike proposal 10 encryption-algorithm aes-cbc dh group2#                           ike peer c                                 pre-shared-key %$%${vC:RV[[email protected]=4+%$%$      ike-proposal 10                          remote-address 200.1.1.1# ipsec proposal tran1 esp authentication-algorithm sha1 esp encryption-algorithm aes#                                ipsec policy map1 10 isakmp                security acl 3000                    ike-peer c                       proposal tran1                       #                              interface GigabitEthernet6/0/0               ip address 10.20.2.1 255.255.255.0                             #                                  interface GigabitEthernet6/0/0              ip address 30.1.1.1 255.255.255.0 ipsec policy map1

父主题: 专网内部通过×××互通


华为专有和保密信息

版权所有 华为技术有限公司


.

广告 广告

评论区