思科cisoc 路由器IKEv2使用map配置隧道

环境拓扑图

R1配置

接口配置

R1#conf terminal
R1(config)#interface ethernet 1/0
R1(config-if)#ip address 172.16.1.193 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface ethernet 1/1
R1(config-if)#no shutdown
R1(config-if)#ip address 30.1.1.2 255.255.255.0
R1(config-if)#exit

IPSec配置

# ike密钥配置
R1(config)#crypto ikev2 keyring ike_key  # 生成ike密钥名称
R1(config-ikev2-keyring)#peer 20.1.1.1  # 对端IP
R1(config-ikev2-keyring-peer)#address 20.1.1.1  # 添加对端IP
R1(config-ikev2-keyring-peer)#pre-shared-key 123456  # 配置预共享密钥
R1(config-ikev2-keyring-peer)#exit
R1(config-ikev2-keyring)#exit
# IKEv2一阶段配置
R1(config)#crypto ikev2 profile ike_pro  # 生成ike概要名称
R1(config-ikev2-profile)#match identity remote address 20.1.1.1 255.255.255.255  # 配置对端ike IP地址
R1(config-ikev2-profile)#authentication remote pre-share  # 设置对端认证方式为预共享密钥
R1(config-ikev2-profile)#authentication local pre-share  # 设置本端认证方式为预共享密钥
R1(config-ikev2-profile)#keyring local ike_key  # 关联预共享密钥配置
R1(config-ikev2-profile)#exit
# IKEv2二阶段配置
R1(config)#crypto ipsec transform-set ipsec_tra esp-aes esp-sha-hmac  # 添加二阶段名称为ipsec_tra,并添加算法
R1(cfg-crypto-trans)#mode tunnel  # 使用隧道模式协商
R1(cfg-crypto-trans)#exit
# map配置
R1(config)#crypto map map_ipsec 10 ipsec-isakmp  # 添加map,进入配置
R1(config-crypto-map)#set transform-set ipsec_tra  # 关联ike二阶段
R1(config-crypto-map)#set ikev2-profile ike_pro  # 关联ike一阶段
R1(config-crypto-map)#match address 100  # 匹配要加密的感兴趣流
R1(config-crypto-map)#exit
# 添加感兴趣流
R1(config)#access-list 100 permit ip 172.16.1.0 0.0.0.255 10.1.1.0 0.0.0.255
# 接口关联map
R1(config)#interface ethernet 1/1
R1(config-if)#crypto map map_ipsec
R1(config-if)#exit

路由配置

R1(config)#ip route 10.1.1.0 255.255.255.0 30.1.1.1
R1(config)#ip route 20.1.1.0 255.255.255.0 30.1.1.1

R2配置

接口配置

R2#configure terminal
R2(config-if)#no shutdown
R2(config-if)#ip address 30.1.1.1 255.255.255.0
R2(config-if)#exit
R2(config)#interface ethernet 1/0
R2(config-if)#no shutdown
R2(config-if)#ip address 20.1.1.2 255.255.255.0
R2(config-if)#exit

R3配置

接口配置

R3#configure terminal
R3(config)#interface ethernet 1/0
R3(config-if)#no shutdown
R3(config-if)#ip address 20.1.1.1 255.255.255.0
R3(config-if)#exit
R3(config)#interface ethernet 1/1
R3(config-if)#no shutdown
R3(config-if)#ip address 10.1.1.2 255.255.255.0
R3(config-if)#exit

IPSec配置

# ike密钥配置
R3(config)#crypto ikev2 keyring ike_key  # 生成ike密钥名称
R3(config-ikev2-keyring)#peer 30.1.1.2  # 对端IP
R3(config-ikev2-keyring-peer)#address  30.1.1.2  # 添加对端IP
R3(config-ikev2-keyring-peer)#pre-shared-key 123456  # 配置预共享密钥
R3(config-ikev2-keyring-peer)#exit
R3(config-ikev2-keyring)#exit
# IKEv2一阶段配置
R3(config)#crypto ikev2 profile ike_pro  # 生成ike概要名称
R3(config-ikev2-profile)#match identity remote address 30.1.1.2 255.255.255.255  # 配置对端ike IP地址
R3(config-ikev2-profile)#authentication remote pre-share  # 设置对端认证方式为预共享密钥
R3(config-ikev2-profile)#authentication local pre-share  # 设置本端认证方式为预共享密钥
R3(config-ikev2-profile)#keyring local ike_key  # 关联预共享密钥配置
R3(config-ikev2-profile)#exit
# IKEv2二阶段配置
R3(config)#crypto ipsec transform-set ipsec_tra esp-aes esp-sha-hmac  # 添加二阶段名称为ipsec_tra,并添加算法
R3(cfg-crypto-trans)#mode tunnel  # 使用隧道模式协商
R3(cfg-crypto-trans)#exit
# map配置
R3(config)#crypto map map_ipsec 10 ipsec-isakmp  # 添加map,进入配置
R3(config-crypto-map)#set transform-set ipsec_tra  # 关联ike二阶段
R3(config-crypto-map)#set ikev2-profile ike_pro  # 关联ike一阶段
R3(config-crypto-map)#match address 100  # 匹配要加密的感兴趣流
R3(config-crypto-map)#exit
# 添加感兴趣流
R3(config)#access-list 100 permit ip 10.1.1.0 0.0.0.255 172.16.1.0 0.0.0.255
# 接口关联map
R3(config)#interface ethernet 1/0
R3(config-if)#crypto map map_ipsec
R3(config-if)#exit

路由配置

R3(config)#ip route 30.1.1.0 255.255.255.0 20.1.1.2
R3(config)#ip route 172.16.1.0 255.255.255.0 20.1.1.2
R3(config)#end

R4配置

接口配置

R4#configure terminal
R4(config)#interface ethernet 1/1
R4(config-if)#no shutdown
R4(config-if)#ip address 10.1.1.1 255.255.255.0
R4(config-if)#exit

路由配置

R4(config)#ip route 0.0.0.0 0.0.0.0 10.1.1.2
R4(config)#end

调试命令

  • 查看ikev2协商过程
    • debug crypto ikev2
  • 查看IPSec转发过程
    • debug crypto ipsec
  • 查看IPSec配置
    • show running-config | section crypto
  • 查看IKEv2 sa
    • show crypto IKEv2 SA
  • 查看IPSec sa
    • show crypto ipsec sa
  • 查看IKEv2统计数据
    • show crypto ikev2 start
  • 查看map 信息
    • show crypto map
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值