A-A+

华为USG防火墙 IPsec VPN配置思路和实操

2016年02月18日 站长资讯 暂无评论

实验拓扑:

使用华为ensp 1.2.00.370模拟器来完成。连接方式是 client1 - USG-1 - AR1 - USG-2 - clent2 链式组网结构。

实验需求:

USG-1和USG-2模拟企业边缘设备,分别在2台设备上配置NAT和IPsec VPN实现2边私网可以通过VPN互相通信。

实验配置:

R1的IP地址配置省略

USG-1配置

  1. [USG-1]firewall zone trust          //配置trust区域  
  2. [USG-1-zone-trust]add interface g0/0/0    //将接口加入trust区域  
  3. [USG-1-zone-trust]quit  
  4. [USG-1]firewall zone untrust           //配置untrust区域  
  5. [USG-1-zone-untrust]add int g0/0/1          //将接口加入untrust区域  
  6. [USG-1-zone-untrust]quit  
  7. [USG-1]int g0/0/0  
  8. [USG-1-GigabitEthernet0/0/0]ip add 192.168.10.1 24  
  9. [USG-1-GigabitEthernet0/0/0]int g0/0/1  
  10. [USG-1-GigabitEthernet0/0/1]ip add 11.0.0.2 24  
  11. [USG-1-GigabitEthernet0/0/1]quit  
  12. [USG-1]ip route-static 0.0.0.0 0.0.0.0 11.0.0.1   //配置默认路由上公网  
  13. [USG-1]nat-policy interzone trust untrust outbound   
  14. //进入trust到untrust区域out方向的策略视图  
  15. [USG-1-nat-policy-interzone-trust-untrust-outbound]policy 1     //创建一个策略  
  16. [USG-1-nat-policy-interzone-trust-untrust-outbound-1]policy source 192.168.10.0 0.0.0.255  
  17. [USG-1-nat-policy-interzone-trust-untrust-outbound-1]policy destination 192.168.20.0 0.0.0.255  
  18. [USG-1-nat-policy-interzone-trust-untrust-outbound-1]action no-nat   
  19. //以上三条命令意思是不允许将源为192.168.10.0/24网段目标为192.168.20.0/24网段的数据包进行NAT  
  20. [USG-1-nat-policy-interzone-trust-untrust-outbound-1]quit  
  21. [USG-1-nat-policy-interzone-trust-untrust-outbound]policy 2  //创建策略2  
  22. [USG-1-nat-policy-interzone-trust-untrust-outbound-2]action source-nat  
  23. //允许对源IP进行NAT  
  24. [USG-1-nat-policy-interzone-trust-untrust-outbound-2]easy-ip g0/0/1  
  25. //对接口G0/0/1地址复用  
  26. [USG-1-nat-policy-interzone-trust-untrust-outbound-2]quit  
  27. [USG-1-nat-policy-interzone-trust-untrust-outbound]quit  
  28.    
  29. -------阶段一---------  
  30.    
  31. [USG-1]ike proposal 1     //配置一个安全提议  
  32. [USG-1-ike-proposal-1]authentication-method pre-share   //配置IKE认证方式为预共享密钥  
  33. [USG-1-ike-proposal-1]authentication-algorithm sha1   //配置IKE认证算法为sha1  
  34. [USG-1-ike-proposal-1]integrity-algorithm aes-xcbc-96  //配置IKE完整性算法  
  35. [USG-1-ike-proposal-1]dh group2  //配置IKE密钥协商DH组  
  36. [USG-1-ike-proposal-1]quit  
  37. [USG-1]ike peer USG-2             //创建一个IKE对等体名字为USG-2  
  38. [USG-1-ike-peer-usg-2]pre-shared-key abc123    //配置预共享密钥  
  39. [USG-1-ike-peer-usg-2]remote-address 12.0.0.2  //配置对等体IP地址  
  40. [USG-1-ike-peer-usg-2]ike-proposal 1       //调用ike安全提议  
  41. [USG-1-ike-peer-usg-2]quit  
  42. ----------阶段二----------  
  43. [USG-1]ipsec proposal test        //配置一个ipsec安全提议  
  44. [USG-1-ipsec-proposal-test]encapsulation-mode tunnel    //封装方式采用隧道  
  45. [USG-1-ipsec-proposal-test]transform esp    //配置IPSEC安全协议为ESP  
  46. [USG-1-ipsec-proposal-test]esp encryption-algorithm aes   //配置ESP协议加密算法为aes  
  47. [USG-1-ipsec-proposal-test]esp authentication-algorithm sha1  //配置ESP协议认证算法  
  48. [USG-1-ipsec-proposal-test]quit  
  49. [USG-1]acl 3000         //创建一个ACL定义感兴趣流  
  50. [USG-1-acl-adv-3000]rule permit ip source 192.168.10.0 0.0.0.255 destination 192.168.20.0 0.0.0.255  
  51. [USG-1]ipsec policy map 1 isakmp    //创建一个安全策略,名称为map  
  52. [USG-1-ipsec-policy-isakmp-map-1]ike-peer USG-2    //调用ike对等体  
  53. [USG-1-ipsec-policy-isakmp-map-1]proposal test     //调用IPsec安全提议  
  54. [USG-1-ipsec-policy-isakmp-map-1]security acl 3000   //配置感兴趣流  
  55. [USG-1-ipsec-policy-isakmp-map-1]quit  
  56. [USG-1]int g0/0/1  
  57. [USG-1-GigabitEthernet0/0/1]ipsec policy map     //在外网口上调用安全策略  
  58.    
  59. 区域间策略配置  
  60. [USG-1]policy interzone trust untrust outbound .  
  61. //进入trust到untrust区域out方向策略视图  
  62. [USG-1-policy-interzone-trust-untrust-outbound]policy 1    //创建策略  
  63. [USG-1-policy-interzone-trust-untrust-outbound-1]action permit    
  64. //允许trust区域所有主机访问untrust区域   
  65. [USG-1-policy-interzone-trust-untrust-outbound-1]quit  
  66. [USG-1-policy-interzone-trust-untrust-outbound]quit  
  67. [USG-1]policy interzone trust untrust inbound   
  68. //进入trust区域到untrust区域的in方向策略视图  
  69. [USG-1-policy-interzone-trust-untrust-inbound]policy 1  
  70. [USG-1-policy-interzone-trust-untrust-inbound-1]policy source 192.168.20.0 0.0.0.255  
  71. [USG-1-policy-interzone-trust-untrust-inbound-1]policy destination 192.168.10.0 0.0.0.255  
  72. [USG-1-policy-interzone-trust-untrust-inbound-1]action permit   
  73. //以上命令为允许数据包源地址为192.168.20.0/24网段和目标地址为192.168.10.0/24网段的流量过  
  74. [USG-1-policy-interzone-trust-untrust-inbound-1]quit  
  75. [USG-1-policy-interzone-trust-untrust-inbound]quit  
  76. [USG-1]policy interzone local untrust inbound  
  77. //进入local区域到untrust区域的in方向策略视图  
  78. [USG-1-policy-interzone-local-untrust-inbound]policy 1  
  79. [USG-1-policy-interzone-local-untrust-inbound-1]policy service service-set esp   
  80. [USG-1-policy-interzone-local-untrust-inbound-1]policy source 12.0.0.2 0  
  81. [USG-1-policy-interzone-local-untrust-inbound-1]policy destination 11.0.0.2 0  
  82. [USG-1-policy-interzone-local-untrust-inbound-1]action permit   
  83. //允许源地址是12.0.0.2目标地址是11.0.0.2的数据包访问esp协议  
  84.    
  85. USG-2配置  
  86. [USG-2]firewall zone trust   
  87. [USG-2-zone-trust]add int g0/0/0  
  88. [USG-2-zone-trust]quit  
  89. [USG-2]firewall zone untrust   
  90. [USG-2-zone-untrust]add int g0/0/1  
  91. [USG-2-zone-untrust]quit  
  92. [USG-2]int g0/0/0  
  93. [USG-2-GigabitEthernet0/0/0]ip add 192.168.20.1 24  
  94. [USG-2-GigabitEthernet0/0/0]int g0/0/1  
  95. [USG-2-GigabitEthernet0/0/1]ip add 12.0.0.2 24  
  96. [USG-2-GigabitEthernet0/0/1]quit  
  97. [USG-2]ip route-static 0.0.0.0 0.0.0.0 12.0.0.1  
  98. [USG-2]nat-policy interzone trust untrust outbound   
  99. [USG-2-nat-policy-interzone-trust-untrust-outbound]policy 1  
  100. [USG-2-nat-policy-interzone-trust-untrust-outbound-1]policy source 192.168.20.0 0.0.0.255  
  101. [USG-2-nat-policy-interzone-trust-untrust-outbound-1]policy destination 192.168.10.0 0.0.0.255  
  102. [USG-2-nat-policy-interzone-trust-untrust-outbound-1]action no-nat   
  103. [USG-2-nat-policy-interzone-trust-untrust-outbound-1]quit  
  104. [USG-2-nat-policy-interzone-trust-untrust-outbound]policy 2  
  105. [USG-2-nat-policy-interzone-trust-untrust-outbound-2]action source-nat   
  106. [USG-2-nat-policy-interzone-trust-untrust-outbound-2]easy-ip GigabitEthernet0/0/1  
  107. [USG-2-nat-policy-interzone-trust-untrust-outbound-2]quit  
  108. [USG-2-nat-policy-interzone-trust-untrust-outbound]quit  
  109.    
  110. [USG-2]ike proposal 1  
  111. [USG-2-ike-proposal-1]authentication-method pre-share   
  112. [USG-2-ike-proposal-1]authentication-algorithm sha1   
  113. [USG-2-ike-proposal-1]integrity-algorithm aes-xcbc-96   
  114. [USG-2-ike-proposal-1]dh group2  
  115. [USG-2-ike-proposal-1]quit  
  116. [USG-2]ike peer USG-A  
  117. [USG-2-ike-peer-usg-a]pre-shared-key abc123  
  118. [USG-2-ike-peer-usg-a]ike-proposal 1  
  119. [USG-2-ike-peer-usg-a]remote-address 11.0.0.2  
  120. [USG-2-ike-peer-usg-a]quit  
  121. [USG-2]ipsec proposal test  
  122. [USG-2-ipsec-proposal-test]encapsulation-mode tunnel   
  123. [USG-2-ipsec-proposal-test]transform esp   
  124. [USG-2-ipsec-proposal-test]esp encryption-algorithm aes  
  125. [USG-2-ipsec-proposal-test]esp authentication-algorithm sha1   
  126. [USG-2-ipsec-proposal-test]quit  
  127. [USG-2]acl 3000  
  128. [USG-2-acl-adv-3000]rule permit ip source 192.168.20.0 0.0.0.255 destination 192.168.10.0 0.0.0.255  
  129. [USG-2-acl-adv-3000]quit  
  130. [USG-2]ipsec policy map 1 isakmp   
  131. [USG-2-ipsec-policy-isakmp-map-1]ike-peer USG-A  
  132. [USG-2-ipsec-policy-isakmp-map-1]proposal test  
  133. [USG-2-ipsec-policy-isakmp-map-1]security acl 3000  
  134. [USG-2-ipsec-policy-isakmp-map-1]quit  
  135. [USG-2]int g0/0/1  
  136. [USG-2-GigabitEthernet0/0/1]ipsec policy map  
  137. [USG-2-GigabitEthernet0/0/1]quit  
  138. [USG-2]policy interzone trust untrust outbound   
  139. [USG-2-policy-interzone-trust-untrust-outbound]policy 1  
  140. [USG-2-policy-interzone-trust-untrust-outbound-1]action permit   
  141. [USG-2-policy-interzone-trust-untrust-outbound-1]quit  
  142. [USG-2-policy-interzone-trust-untrust-outbound]quit  
  143. [USG-2]policy interzone trust untrust inbound   
  144. [USG-2-policy-interzone-trust-untrust-inbound]policy 1  
  145. [USG-2-policy-interzone-trust-untrust-inbound-1]policy source 192.168.10.0 0.0.0.255  
  146. [USG-2-policy-interzone-trust-untrust-inbound-1]policy destination 192.168.20.0 0.0.0.255  
  147. [USG-2-policy-interzone-trust-untrust-inbound-1]action permit   
  148. [USG-2-policy-interzone-trust-untrust-inbound-1]quit  
  149. [USG-2-policy-interzone-trust-untrust-inbound]quit  
  150. [USG-2]policy interzone local untrust inbound   
  151. [USG-2-policy-interzone-local-untrust-inbound]policy 1  
  152. [USG-2-policy-interzone-local-untrust-inbound-1]policy source 11.0.0.2 0  
  153. [USG-2-policy-interzone-local-untrust-inbound-1]policy destination 12.0.0.2 0  
  154. [USG-2-policy-interzone-local-untrust-inbound-1]policy service service-set esp  
  155. [USG-2-policy-interzone-local-untrust-inbound-1]action permit  

使用C1(192.168.10.10)去ping C2(192.168.20.10)

使用dispaly ike sa和display ipsec sa来查看邻居建立情况

标签:

给我留言