华为路由器:总部/分支之间建立点到多点IPSec VPN(分支机构的公网地址不固定)

华为路由器:总部/分支之间建立点到多点IPSec VPN(分支机构的公网地址不固定)

备注:文章来源华为官方

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

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

组网需求

总部与多个分支机构之间的组网示意图 
http://localhost:7890/pages/SZD0528J/13/SZD0528J/13/resources/cc_fw/images/cc_fw_00033_fig02.png

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

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

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

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

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

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

网络规划

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

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

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

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

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

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

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

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

配置采用策略模版+子策略方式建立IPSec隧道 
http://localhost:7890/pages/SZD0528J/13/SZD0528J/13/resources/cc_fw/images/cc_fw_00033_fig01.png

项目

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/2430.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:主模式

主模式

主模式

预共享密钥

子策略1Key123

子策略2Key456

Key123

Key456

本地身份类型

子策略1fqdn

子策略2IP地址

fqdn

IP地址

版本

v1和v2

v1和v2

v1和v2

操作步骤

1.  配置USG_A的IPSec功能。

http://localhost:7890/pages/SZD0528J/13/SZD0528J/13/resources/public_sys-resources/icon-note.gif 说明:

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

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

http://localhost:7890/pages/SZD0528J/13/SZD0528J/13/resources/public_sys-resources/icon-note.gif 说明:

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

# 配置源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

b.  配置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

c.  创建IPSec安全提议。

d.  [USG_A] ipsec proposal tran1

e.  [USG_A-ipsec-proposal-tran1] encapsulation-mode tunnel

f.  [USG_A-ipsec-proposal-tran1] transform esp

g.  [USG_A-ipsec-proposal-tran1] esp authentication-algorithm sha1

h.  [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

i.  创建IKE安全提议。

j.  [USG_A] ike proposal 10

k.  [USG_A-ike-proposal-10] authentication-method pre-share

l.  [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

m.  配置IKE peer

n.  [USG_A] ike peer a1

o.  [USG_A-ike-peer-a1] ike-proposal 10

p.  [USG_A-ike-peer-a1] local-id-type fqdn USG_A

q.  [USG_A-ike-peer-a1] remote-id-type fqdn USG_B

r.  [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

s.  创建安全策略。

t.  [USG_A] ipsec policy-template map_temp 10

u.  [USG_A-ipsec-policy-template-map_temp-10] security acl 3000

v.  [USG_A-ipsec-policy-template-map_temp-10] proposal tran1

w.  [USG_A-ipsec-policy-template-map_temp-10] ike-peer a1

x.  [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

http://localhost:7890/pages/SZD0528J/13/SZD0528J/13/resources/public_sys-resources/icon-note.gif 说明:

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

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

z.  [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功能。

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

# 配置源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

b.  配置USG_B到达USG_A和USG_C的静态路由。

http://localhost:7890/pages/SZD0528J/13/SZD0528J/13/resources/public_sys-resources/icon-note.gif 说明:

假设USG_B目前的公网IP地址为30.1.2.1,到达USG_AUSG_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

c.  创建IPSec安全提议。

d.  [USG_B] ipsec proposal tran1

e.  [USG_B-ipsec-proposal-tran1] encapsulation-mode tunnel

f.  [USG_B-ipsec-proposal-tran1] transform esp

g.  [USG_B-ipsec-proposal-tran1] esp authentication-algorithm sha1

h.  [USG_B-ipsec-proposal-tran1] esp encryption-algorithm aes

[USG_B-ipsec-proposal-tran1] quit

i.  创建IKE安全提议。

j.  [USG_B] ike proposal 10

k.  [USG_B-ike-proposal-10] authentication-method pre-share

l.  [USG_B-ike-proposal-10] authentication-algorithm sha1

[USG_B-ike-proposal-10] quit

m.  配置IKE peer

n.  [USG_B] ike peer b

o.  [USG_B-ike-peer-b] ike-proposal 10

p.  [USG_B-ike-peer-b] local-id-type fqdn USG_B

q.  [USG_B-ike-peer-b] remote-id-type fqdn USG_A

r.  [USG_B-ike-peer-b] pre-shared-key Key123

s.  [USG_B-ike-peer-b] remote-address 200.1.1.1

[USG_B-ike-peer-b] quit

t.  创建安全策略。

u.  [USG_B] ipsec policy map1 10 isakmp

v.  [USG_B-ipsec-policy-isakmp-map1-10] security acl 3000

w.  [USG_B-ipsec-policy-isakmp-map1-10] proposal tran1

x.  [USG_B-ipsec-policy-isakmp-map1-10] ike-peer b

[USG_B-ipsec-policy-isakmp-map1-10] quit

y.  在物理接口上引用安全策略。

z.  [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功能。

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

# 配置源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

b.  配置USG_C到达USG_A和USG_B的静态路由,假设下一跳地址为30.1.1.2

c.  [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

d.  创建IPSec安全提议。

e.  [USG_C] ipsec proposal tran1

f.  [USG_C-ipsec-proposal-tran1] encapsulation-mode tunnel

g.  [USG_C-ipsec-proposal-tran1] transform esp

h.  [USG_C-ipsec-proposal-tran1] esp authentication-algorithm sha1

i.  [USG_C-ipsec-proposal-tran1] esp encryption-algorithm aes

[USG_C-ipsec-proposal-tran1] quit

j.  创建IKE安全提议。

k.  [USG_C] ike proposal 10

l.  [USG_C-ike-proposal-10] authentication-method pre-share

m.  [USG_C-ike-proposal-10] authentication-algorithm sha1

[USG_C-ike-proposal-10] quit

n.  配置IKE peer

o.  [USG_C] ike peer c

p.  [USG_C-ike-peer-c] ike-proposal 10

q.  [USG_C-ike-peer-c] pre-shared-key Key456

r.  [USG_C-ike-peer-c] remote-address 200.1.1.1

[USG_C-ike-peer-c] quit

s.  创建安全策略。

t.  [USG_C] ipsec policy map1 10 isakmp

u.  [USG_C-ipsec-policy-isakmp-map1-10] security acl 3000

v.  [USG_C-ipsec-policy-isakmp-map1-10] proposal tran1

w.  [USG_C-ipsec-policy-isakmp-map1-10] ike-peer c

[USG_C-ipsec-policy-isakmp-map1-10] quit

x.  在物理接口上引用安全策略。

y.  [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 sa、display ipsec sa会显示安全联盟的建立情况。以USG_A为例,出现以下显示说明IKE安全联盟、IPSec安全联盟建立成功。

2.  <USG_A>display ike sa            

3. 

4.  current ike sa number: 2

5.    ---------------------------------------------------------------------

6.       conn-id     peer                     flag        phase     vpn

7.    ---------------------------------------------------------------------

8.       40001       30.1.1.1                 RD|ST       v2:2      public

9.       1           30.1.1.1                 RD|ST       v2:1      public

10.

11.   flag meaning

12.   RD--READY    ST--STAYALIVE  RL--REPLACED      FD--FADING

13.   TO--TIMEOUT  TD--DELETING   NEG--NEGOTIATING  D--DPD

14. <USG_A>display ipsec sa brief          

15.

16. current ipsec sa number: 2                                                     

17. current ipsec tunnel number: 1                                                 

18. --------------------------------------------------------------                 

19. Src Address     Dst Address     SPI          Protocol  Algorithm            

20. -------------------------------------------------------------------            

21. 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; 

22. 分支机构1能够主动访问总部。配置成功后,在分支机构1执行ping操作可以ping通总部。分别在USG_A和USG_B上执行display ike sa、display ipsec sa会显示安全联盟的建立情况。以USG_A为例,出现以下显示说明IKE安全联盟、IPSec安全联盟建立成功。

23. <USG_A>display ike sa                                    

24.

25. current ike sa number: 4

26.   ---------------------------------------------------------------------

27.      conn-id     peer                     flag        phase     vpn

28.   ---------------------------------------------------------------------

29.      40001       30.1.1.1                 RD|ST       v2:2      public

30.      1           30.1.1.1                 RD|ST       v2:1      public

31.      40003       30.1.2.1                 RD          v2:2      public

32.      40002       30.1.2.1                 RD          v2:1      public

33.

34.   flag meaning

35.   RD--READY    ST--STAYALIVE  RL--REPLACED      FD--FADING

36.   TO--TIMEOUT  TD--DELETING   NEG--NEGOTIATING  D--DPD

37. <USG_A>display ipsec sa brief          

38.

39. current ipsec sa number: 4                                                     

40. current ipsec tunnel number: 2                                                 

41. --------------------------------------------------------------                 

42. Src Address     Dst Address     SPI          Protocol  Algorithm            

43. -------------------------------------------------------------------            

44. 30.1.1.1       200.1.1.1       142427840    ESP       E:AES;A:HMAC-SHA1-96; 

45. 200.1.1.1       30.1.1.1       52885424     ESP       E:AES;A:HMAC-SHA1-96; 

46. 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; 

47. 执行命令display ipsec statistics可以查看被加密的数据包的变化,即它们之间的数据传输将被加密。以USG_A为例。

48. <USG_A>display ipsec statistics                          

49.   the security packet statistics:          

50.     input/output security packets: 9/9                                          

51.     input/output security bytes: 756/756                                     

52.     input/output dropped security packets: 0/0                                 

53.     the encrypt packet statistics                                              

54.       send sae:9, recv sae:9, send err:0                                        

55.       local cpu:9, other cpu:0, recv other cpu:0                               

56.       intact packet:2, first slice:0, after slice:0                            

57.     the decrypt packet statistics                                               

58.       send sae:9, recv sae:9, send err:0                                       

59.       local cpu:9, other cpu:0, recv other cpu:0                               

60.       reass  first slice:0, after slice:0, len err:0                           

61.     dropped security packet detail:                                            

62.       no enough memory: 0, too long: 0                                         

63.       can't find SA: 0, wrong SA: 0                                            

64.       authentication: 0, replay: 0                                             

65.       front recheck: 0, after recheck: 0                                       

66.       exceed byte limit: 0, exceed packet limit: 0                             

67.       change cpu enc: 0, dec change cpu: 0                                     

68.       change datachan: 0, fib search: 0                                        

69.       rcv enc(dec) form sae said err: 0, 0                                     

70.       port number error: 0                                                      

71.       send port: 0, output l3: 0, l2tp input: 0                                

72.   negotiate about packet statistics:                                           

73.     IP packet  ok:0, err:0, drop:0                                              

74.     IP rcv other cpu   to ike:0, drop:0                                        

75.     IKE packet inbound   ok:2, err:0                                           

76.     IKE packet outbound  ok:2, err:0                                            

77.     SoftExpr:0, HardExpr:0, DPDOper:0, SwapSa:0                                

    ModpCnt: 2, SaeSucc: 2, SoftwareSucc: 0  

当两条IPSec隧道都建立成功后,分支机构1与分支机构2能够互相访问,且两者之间的访问是经过了总部设备来实现的。


VPN配置案例汇总、VPN汇总(列表、list、全)vpnlist
http://www.zh-cjh.com/wenzhangguilei/1193.html
文章归类、所有文章列表、LISTLIST
http://www.zh-cjh.com/wangzhangonggao/2195.html

1、本站资源长期持续更新。
2、本资源基本为原创,部分来源其他付费资源平台或互联网收集,如有侵权请联系及时处理。
3、本站大部分文章的截图来源实验测试环境,请不要在生产环境中随意模仿,以免带来灾难性后果。

转载请保留出处:  www.zh-cjh.com珠海陈坚浩博客 » 华为路由器:总部/分支之间建立点到多点IPSec VPN(分支机构的公网地址不固定)

作者: cjh


手机扫一扫,手机上查看此文章:

一切源于价值!

其他 模板文件不存在: ./template/plugins/comment/pc/index.htm

未雨绸缪、居安思危!

数据安全、有备无患!

注意操作、数据无价!

一切源于价值!