当前位置:   article > 正文

IPSec简介_ipsec保护子网能为具体ip吗

ipsec保护子网能为具体ip吗
起源

随着Internet的发展,越来越多的企业直接通过Internet进行互联,但由于IP协议未考虑安全性,而且Internet上有大量的不可靠用户和网络设备,所以用户业务数据要穿越这些未知网络,根本无法保证数据的安全性,数据易被伪造、篡改或窃取。因此,迫切需要一种兼容IP协议的通用的网络安全方案。

为了解决上述问题,IPSec(Internet Protocol Security)应运而生。IPSec是对IP的安全性补充,其工作在IP层,为IP网络通信提供透明的安全服务。

定义

IPSec是IETF(Internet Engineering Task Force)制定的一组开放的网络安全协议。它并不是一个单独的协议,而是一系列为IP网络提供安全性的协议和服务的集合,包括认证头AH(Authentication Header)和封装安全载荷ESP(Encapsulating Security Payload)两个安全协议、密钥交换和用于验证及加密的一些算法等。

通过这些协议,在两个设备之间建立一条IPSec隧道。数据通过IPSec隧道进行转发,实现保护数据的安全性。

受益

IPSec通过加密与验证等方式,从以下几个方面保障了用户业务数据在Internet中的安全传输:

  • 数据来源验证:接收方验证发送方身份是否合法。
  • 数据加密:发送方对数据进行加密,以密文的形式在Internet上传送,接收方对接收的加密数据进行解密后处理或直接转发。
  • 数据完整性:接收方对接收的数据进行验证,以判定报文是否被篡改。
  • 抗重放:接收方拒绝旧的或重复的数据包,防止恶意用户通过重复发送捕获到的数据包所进行的攻击。

配置Efficient VPN采用Client模式建立IPSec隧道示例

组网图形

图1 配置Efficient VPN采用Client方式建立IPSec隧道组网图

组网需求

图1所示,Switch为企业远程小型分支网关,Router为企业总部网关,分支与总部通过公网建立通信,并且总部与分支的网络未做统一规划。

企业希望通过网管系统(NMS)管理分支网关,并对分支网关与NMS之间相互访问的流量进行安全保护,并且分支网关配置能够尽量简单,由总部网关对分支网关进行集中管理。此时,可以在分支网关与总部网关之间采用Efficient VPN Client模式建立一个IPSec隧道来实施安全保护,便于IPSec隧道的建立与维护管理。

Efficient VPN Client模式下,Switch向Router申请IP地址用于建立IPSec隧道,同时申请DNS域名、DNS服务器地址和WINS服务器地址,提供给分支使用。

华为S交换机仅支持作为Efficient VPN的Remote端,本举例使用AR3200系列路由器作为Efficient VPN的Server端,以V200R008版本的AR3260路由器给出配置。现网中请根据实际情况选择Efficient VPN的Server端设备,并参考对应手册完成配置。

分支网关的VLANIF10接口通过DHCP获取IP地址,这里假设获取的IP地址为11.11.11.11。

配置思路

采用如下思路配置Efficient VPN采用Client模式建立IPSec隧道示例:

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

  2. Router作为IPSec隧道协商响应方,采用策略模板方式与Switch建立IPSec隧道。

  3. Router上配置要推送的资源属性,包括IP地址、DNS域名、DNS服务器地址和WINS服务器地址。

  4. 在Switch上采用Client方式配置Efficient VPN,作为协商发起方与Router建立IPSec隧道。

操作步骤
  1. 配置接口的IP地址和到对端的静态路由

    # 在Switch上配置接口的IP地址。

    1. <span style="color:#333333"><span style="background-color:#ffffff"><span style="background-color:#dddddd"><HUAWEI> <strong>system-view</strong>
    2. [HUAWEI] <strong>sysname Switch</strong>
    3. [Switch] <strong>vlan batch 10 20</strong>
    4. [Switch] <strong>interface gigabitethernet 0/0/1</strong>
    5. [Switch-GigabitEthernet0/0/1] <strong>port link-type trunk</strong>
    6. [Switch-GigabitEthernet0/0/1] <strong>port trunk allow-pass vlan 10</strong>
    7. [Switch-GigabitEthernet0/0/1] <strong>quit</strong>
    8. [Switch] <strong>interface gigabitethernet 0/0/2</strong>
    9. [Switch-GigabitEthernet0/0/2] <strong>port link-type trunk</strong>
    10. [Switch-GigabitEthernet0/0/2] <strong>port trunk allow-pass vlan 20</strong>
    11. [Switch-GigabitEthernet0/0/2] <strong>quit</strong>
    12. [Switch] <strong>interface vlanif 10</strong>
    13. [Switch-Vlanif10] <strong>ip address dhcp-alloc</strong>
    14. [Switch-Vlanif10] <strong>quit</strong>
    15. [Switch] <strong>interface vlanif 20</strong>
    16. [Switch-Vlanif20] <strong>ip address 10.1.1.1 255.255.255.0</strong>
    17. [Switch-Vlanif20] <strong>quit</strong></span></span></span>

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

    <span style="color:#333333"><span style="background-color:#ffffff"><span style="background-color:#dddddd">[Switch] <strong>ip route-static 0.0.0.0 0.0.0.0 11.11.11.12</strong></span></span></span>

    # 在Router上配置接口的IP地址。

    1. <span style="color:#333333"><span style="background-color:#ffffff"><span style="background-color:#dddddd"><HUAWEI> <strong>system-view</strong>
    2. [HUAWEI] <strong>sysname Router</strong>
    3. [Router] <strong>interface gigabitethernet 1/0/0</strong>
    4. [Router-GigabitEthernet1/0/0] <strong>ip address 11.11.12.11 255.255.255.0</strong>
    5. [Router-GigabitEthernet1/0/0] <strong>quit</strong>
    6. [Router] <strong>interface gigabitethernet 2/0/0</strong>
    7. [Router-GigabitEthernet2/0/0] <strong>ip address 10.1.2.1 255.255.255.0</strong>
    8. [Router-GigabitEthernet2/0/0] <strong>quit</strong></span></span></span>

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

    1. <span style="color:#333333"><span style="background-color:#ffffff"><span style="background-color:#dddddd">[Router] <strong>ip route-static 11.11.11.0 255.255.255.0 11.11.12.12</strong>
    2. [Router] <strong>ip route-static 10.1.1.0 255.255.255.0 11.11.12.12</strong>
    3. [Router] <strong>ip route-static 100.1.1.0 255.255.255.0 11.11.12.12</strong></span></span></span>
  2. Router作为IPSec隧道协商响应方,采用策略模板方式与Switch建立IPSec隧道

    # 配置要推送的资源属性,推送IP地址、DNS域名、DNS服务器地址和WINS服务器地址。

    1. <span style="color:#333333"><span style="background-color:#ffffff"><span style="background-color:#dddddd">[Router] <strong>ip pool po1</strong>
    2. [Router-ip-pool-po1] <strong>network 100.1.1.0 mask 255.255.255.128</strong>
    3. [Router-ip-pool-po1] <strong>gateway-list 100.1.1.1</strong>
    4. [Router-ip-pool-po1] <strong>quit</strong>
    5. [Router] <strong>aaa</strong>
    6. [Router-aaa] <strong>service-scheme schemetest </strong>
    7. [Router-aaa-service-schemetest] <strong>ip-pool po1</strong>
    8. [Router-aaa-service-schemetest] <strong>dns-name mydomain.com.cn</strong>
    9. [Router-aaa-service-schemetest] <strong>dns 2.2.2.2</strong>
    10. [Router-aaa-service-schemetest] <strong>dns 2.2.2.3 secondary</strong>
    11. [Router-aaa-service-schemetest] <strong>wins 3.3.3.2</strong>
    12. [Router-aaa-service-schemetest] <strong>wins 3.3.3.3 secondary</strong>
    13. [Router-aaa-service-schemetest] <strong>quit</strong>
    14. [Router-aaa] <strong>quit</strong></span></span></span>

    # 配置IKE安全提议和IKE对等体,并将AAA业务模板绑定在IKE对等体中。

    1. <span style="color:#333333"><span style="background-color:#ffffff"><span style="background-color:#dddddd">[Router] <strong>ike proposal 5</strong>
    2. [Router-ike-proposal-5] <strong>dh group14</strong>
    3. [Router-ike-proposal-5] <strong>authentication-algorithm sha2-256</strong>
    4. [Router-ike-proposal-5] <strong>encryption-algorithm aes-128</strong>
    5. [Router-ike-proposal-5] <strong>quit</strong>
    6. [Router] <strong>ike peer rut3</strong>
    7. [Router-ike-peer-rut3] <strong>undo version 2</strong>
    8. [Router-ike-peer-rut3] <strong>exchange-mode aggressive</strong>
    9. [Router-ike-peer-rut3] <strong>pre-shared-key cipher Example@123</strong>
    10. [Router-ike-peer-rut3] <strong>ike-proposal 5</strong>
    11. [Router-ike-peer-rut3] <strong>service-scheme schemetest</strong>
    12. [Router-ike-peer-rut3] <strong>quit</strong></span></span></span>

    # 配置IPSec安全提议、策略模板方式的安全策略。

    1. <span style="color:#333333"><span style="background-color:#ffffff"><span style="background-color:#dddddd">[Router] <strong>ipsec proposal prop1</strong>
    2. [Router-ipsec-proposal-prop1] <strong>esp authentication-algorithm sha2-256</strong>
    3. [Router-ipsec-proposal-prop1] <strong>esp encryption-algorithm aes 128</strong>
    4. [Router-ipsec-proposal-prop1] <strong>quit</strong>
    5. [Router] <strong>ipsec policy-template temp1 10</strong>
    6. [Router-ipsec-policy-templet-temp1-10] <strong>ike-peer rut3</strong>
    7. [Router-ipsec-policy-templet-temp1-10] <strong>proposal prop1</strong>
    8. [Router-ipsec-policy-templet-temp1-10] <strong>quit</strong>
    9. [Router] <strong>ipsec policy policy1 10 isakmp template temp1</strong></span></span></span>

    # 开启SHA-2算法兼容RFC标准算法功能。

    <span style="color:#333333"><span style="background-color:#ffffff"><span style="background-color:#dddddd">[Router] <strong>ipsec authentication sha2 compatible enable</strong></span></span></span>

    # 在接口上应用安全策略组。

    1. <span style="color:#333333"><span style="background-color:#ffffff"><span style="background-color:#dddddd">[Router] <strong>interface gigabitethernet 1/0/0</strong>
    2. [Router-GigabitEthernet1/0/0] <strong>ipsec policy policy1</strong>
    3. [Router-GigabitEthernet1/0/0] <strong>quit</strong></span></span></span>
  3. 在Switch上采用Client方式配置Efficient VPN,建立IPSec隧道。

    # 配置Efficient VPN的模式为Client模式,并在模式视图下指定IKE协商时的对端地址和预共享密钥。

    1. <span style="color:#333333"><span style="background-color:#ffffff"><span style="background-color:#dddddd">[Switch] <strong>ipsec efficient-vpn evpn mode client</strong>
    2. [Switch-ipsec-efficient-vpn-evpn] <strong>remote-address 11.11.12.11 v2</strong>
    3. [Switch-ipsec-efficient-vpn-evpn] <strong>pre-shared-key cipher Example@123</strong>
    4. [Switch-ipsec-efficient-vpn-evpn] <strong>dh group14</strong>
    5. [Switch-ipsec-efficient-vpn-evpn] <strong>quit</strong></span></span></span>

    # 在接口上应用Efficient VPN。

    1. <span style="color:#333333"><span style="background-color:#ffffff"><span style="background-color:#dddddd">[Switch] <strong>interface vlanif 10</strong>
    2. [Switch-Vlanif10] <strong>ipsec efficient-vpn evpn</strong>
    3. [Switch-Vlanif10] <strong>quit</strong></span></span></span>
  4. 检查配置结果

    # 配置成功后,总部Ping分支网关IP地址时,执行命令display ipsec packet statistics可以查看数据包的统计信息。

    # 在Switch上执行display ike sa操作,结果如下。

    1. <span style="color:#333333"><span style="background-color:#ffffff"><span style="background-color:#dddddd">[Switch] <strong id="ZH-CN_TASK_0176374932__b32377308180218">display ike sa</strong>
    2. Conn-ID Peer VPN Flag(s) Phase RemoteType RemoteID
    3. ------------------------------------------------------------------------------
    4. 26 11.11.12.11 0 RD|ST v2:2 IP 11.11.12.11
    5. 25 11.11.12.11 0 RD|ST v2:1 IP 11.11.12.11
    6. Number of IKE SA : 2
    7. ------------------------------------------------------------------------------
    8. Flag Description:
    9. RD--READY ST--STAYALIVE RL--REPLACED FD--FADING TO--TIMEOUT
    10. HRT--HEARTBEAT LKG--LAST KNOWN GOOD SEQ NO. BCK--BACKED UP
    11. M--ACTIVE S--STANDBY A--ALONE NEG--NEGOTIATING </span></span></span>
配置文件
  • Switch的配置文件

    1. <span style="color:#333333"><span style="background-color:#ffffff"><span style="background-color:#dddddd">#
    2. sysname Switch
    3. #
    4. vlan batch 10 20
    5. #
    6. ipsec efficient-vpn evpn mode client
    7. remote-address 11.11.12.11 v2
    8. pre-shared-key cipher %^%#`[OXA]:r)798<)(J~%z-#<3+XezdN'h<O$IZvadN%^%#
    9. dh group14
    10. #
    11. interface Vlanif10
    12. ip address dhcp-alloc
    13. ipsec efficient-vpn evpn
    14. #
    15. interface Vlanif20
    16. ip address 10.1.1.1 255.255.255.0
    17. #
    18. interface GigabitEthernet0/0/1
    19. port link-type trunk
    20. port trunk allow-pass vlan 10
    21. #
    22. interface GigabitEthernet0/0/2
    23. port link-type trunk
    24. port trunk allow-pass vlan 20
    25. #
    26. ip route-static 0.0.0.0 0.0.0.0 11.11.11.12
    27. #
    28. return
    29. </span></span></span>
  • Router的配置文件

    1. <span style="color:#333333"><span style="background-color:#ffffff"><span style="background-color:#dddddd">#
    2. sysname Router
    3. #
    4. ipsec authentication sha2 compatible enable
    5. #
    6. ipsec proposal prop1
    7. esp authentication-algorithm sha2-256
    8. esp encryption-algorithm aes 128
    9. #
    10. ike proposal 5
    11. encryption-algorithm aes-128
    12. dh group14
    13. authentication-algorithm sha2-256
    14. authentication-method pre-share
    15. integrity-algorithm hmac-sha2-256
    16. prf hmac-sha2-256
    17. #
    18. ike peer rut3
    19. undo version 2
    20. exchange-mode aggressive
    21. pre-shared-key cipher %^%#0Y:SO]e%1MLLlY2v\bk~S]LxLau_yPzpUr>C%TO3%^%#
    22. ike-proposal 5
    23. service-scheme schemetest
    24. #
    25. ipsec policy-template temp1 10
    26. ike-peer rut3
    27. proposal prop1
    28. #
    29. ipsec policy policy1 10 isakmp template temp1
    30. #
    31. ip pool po1
    32. gateway-list 100.1.1.1
    33. network 100.1.1.0 mask 255.255.255.128
    34. #
    35. aaa
    36. service-scheme schemetest
    37. dns 2.2.2.2
    38. dns 2.2.2.3 secondary
    39. ip-pool po1
    40. wins 3.3.3.2
    41. wins 3.3.3.3 secondary
    42. dns-name mydomain.com.cn
    43. #
    44. interface GigabitEthernet1/0/0
    45. ip address 11.11.12.11 255.255.255.0
    46. ipsec policy policy1
    47. #
    48. interface GigabitEthernet2/0/0
    49. ip address 10.1.2.1 255.255.255.0
    50. #
    51. ip route-static 10.1.1.0 255.255.255.0 11.11.12.12
    52. ip route-static 11.11.11.0 255.255.255.0 11.11.12.12
    53. ip route-static 100.1.1.0 255.255.255.0 11.11.12.12
    54. #
    55. return</span></span></span>

周工这里还有很多实验:关注+点赞+发送私信“题库”领取

HCIA实验拓扑

HCIP实验拓扑

关注+点赞+发送私信“题库”领取

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/814503
推荐阅读
相关标签
  

闽ICP备14008679号