美文网首页
Ipsec配置

Ipsec配置

作者: LeslieLiang | 来源:发表于2019-03-13 12:09 被阅读0次

Ipsec用于在数据传输过程中的加密协议

1. 搭建环境拓扑

拓扑

2. 配置第一阶段:isakmp协商

需要配置的有isakmp协商的加密算法、验证算法、验证方式和共享密钥及可选的group值和生存时间Lifetime
R1配置:

R1(config)#crypto isakmp policy 1 定义策略
R1(config-isakmp)#encryption 3des 加密算法为3des
R1(config-isakmp)#hash md5 验证算法为md5
R1(config-isakmp)#authentication pre-share 验证方式为预共享密钥
R1(config-isakmp)#group 5 组值
R1(config-isakmp)#lifetime 120 生存时间
R1(config)#crypto isakmp key 0 ruijie address 172.16.50.2 配置共享密钥ruijie

R2配置:

R2的isakmp配置与R1完全一致。
R2(config)#crypto isakmp key 0 ruijie address 172.16.50.1 配置共享密钥ruijie

3. 第二阶段:ipsec配置

R1配置:
定义IP数据的保护策略,主要是ESP还是AH、加密算法、验证算法、传输模式还是隧道模式,定义需要被Ipsec保护的数据,即感兴趣流

R1(config)#crypto ipsec transform-set IPSEC esp-3des esp-sha-hmac 定义策略的名称为IPSEC,加密算法为esp-3des,验证算法为esp-sha-hmac
R1(cfg-crypto-trans)#mode tunnel 隧道模式
R1(config)#access-list 100 permit ip host 1.1.1.1 host 2.2.2.2 需要被保护的数据,即感兴趣流

R2配置:

此处配置与R1完全一致
R2(config)#access-list 100 permit ip host 2.2.2.2 host 1.1.1.1 需要被保护的数据,即感兴趣流

4. 定义crypto map

定义IPsec SA对段通信实体,调用配置的第二阶段IPsec SA策略、感兴趣流
R1配置:

R1(config)#crypto map MAP 1 ipsec-isakmp 定义map
% NOTE: This new crypto map will remain disabled until a peer
    and a valid access list have been configured.
R1(config-crypto-map)#set peer 172.16.50.2 对端体ip
R1(config-crypto-map)#set transform-set IPSEC 调用第二阶段的ipsec策略
R1(config-crypto-map)#match address 100 匹配感兴趣流

R2配置:

与R1配置完全一致
R2(config-crypto-map)#set peer 172.16.50.1 对端体ip

5. 将map应用在接口上

使需要被保护的数据流通过出口接口出去,则需要配置路由
R1配置:

R1(config)#ip route 2.2.2.2 255.255.255.255 172.16.50.2
R1(config)#int f0/0
R1(config-if)#crypto map MAP

R2配置:

R2(config)#ip route 1.1.1.1 255.255.255.255 172.16.50.1
R2(config)#int f0/0
R2(config-if)#crypto map MAP

6. 验证

使用扩展ping,分别查看isakmp sa和ipsec sa是否正常
show crypto isakmp sa
show crypto ipsec sa

R1#ping 2.2.2.2 source 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1 
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/22/32 m

R1#show crypto isakmp sa 协商正常
dst             src             state          conn-id slot status
172.16.50.2     172.16.50.1     QM_IDLE              1    0 ACTIVE

R1#show crypto ipsec sa 

interface: FastEthernet0/0
    Crypto map tag: MAP, local addr 172.16.50.1

   protected vrf: (none)
   local  ident (addr/mask/prot/port): (1.1.1.1/255.255.255.255/0/0)
   remote ident (addr/mask/prot/port): (2.2.2.2/255.255.255.255/0/0)
   current_peer 172.16.50.2 port 500
     PERMIT, flags={origin_is_acl,}
    #pkts encaps: 6, #pkts encrypt: 6, #pkts digest: 6
    #pkts decaps: 6, #pkts decrypt: 6, #pkts verify: 6
    #pkts compressed: 0, #pkts decompressed: 0
    #pkts not compressed: 0, #pkts compr. failed: 0
    #pkts not decompressed: 0, #pkts decompress failed: 0
    #send errors 4, #recv errors 0

     local crypto endpt.: 172.16.50.1, remote crypto endpt.: 172.16.50.2
     path mtu 1500, ip mtu 1500, ip mtu idb FastEthernet0/0
     current outbound spi: 0xEB9A4D72(3952758130)

     inbound esp sas:
      spi: 0xEE99A619(4003046937)
        transform: esp-3des esp-sha-hmac ,
        in use settings ={Tunnel, }
        conn id: 2001, flow_id: SW:1, crypto map: MAP
        sa timing: remaining key lifetime (k/sec): (4467890/3527)
        IV size: 8 bytes
        replay detection support: Y
        Status: ACTIVE

     inbound ah sas:

     inbound pcp sas:

     outbound esp sas:
      spi: 0xEB9A4D72(3952758130)
        transform: esp-3des esp-sha-hmac ,
        in use settings ={Tunnel, }
        conn id: 2002, flow_id: SW:2, crypto map: MAP
        sa timing: remaining key lifetime (k/sec): (4467890/3526)
        IV size: 8 bytes
        replay detection support: Y
        Status: ACTIVE

     outbound ah sas:

     outbound pcp sas:

相关文章

  • 锐捷实战系列(五十八) IPSec VPN静态隧道

    实训目的 掌握IPSec VPN静态隧道配置。 实训背景 IPSec的相关概念 IPSec(IP Security...

  • Ipsec配置

    Ipsec用于在数据传输过程中的加密协议 1. 搭建环境拓扑 2. 配置第一阶段:isakmp协商 需要配置的有i...

  • IPSec基本原理

    IPSec基本原理 IPSec通过在IPSec对等体间建立双向安全联盟形成一个安全互通的IPSec隧道,并通过定义...

  • 歪劈奀

    IPSec IPSec 与 SS 区别对比 https://zhidao.baidu.com/question/1...

  • IPSec VPN

    采用IPSec协议来实现远程接入的一种VPN技术,IPSec(Internet Protocal Security...

  • IPSEC

    IPSEC是网络安全的一种加密技术 基本上IPSEC由以下几部分组成 AH和ESP是IPSEC的加密算法,IKE是...

  • 案例分享:华为防火墙配置点到点IPSEC VPN

    实验目的 本文通过一个案例简单来了解一下Site-to-Site IPSec VPN 的工作原理及详细配置。 组...

  • CentOS下使用openswan配置IPsec

    基础信息 使用开源的openswan搭建Host_to_Host基于Ipsec RSA加密的Tunnel,用于保障...

  • IPsec

    p1 - 主模式与野蛮模式对比 1、野蛮模式协商比主模式协商更快。主模式需要交互6个消息,野蛮模式只需要交互3个消...

  • ipsec

网友评论

      本文标题:Ipsec配置

      本文链接:https://www.haomeiwen.com/subject/xhjzpqtx.html