博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Cisco设备上配置GRE+IPSec
阅读量:3702 次
发布时间:2019-05-21

本文共 3301 字,大约阅读时间需要 11 分钟。

一、GREVPN(Generic Routing Encapsulation)通用路由封装,配合IPSec(加密数据)一起使用

GRE配置命令

interface tunnel 0  //创建tunnel(虚拟)接口(GRE隧道)

tunnel source 11.1.1.2   //指定本地的公网IP地址

tunnel destination 21.1.1.3   //指定对端的公网IP地址

ip address 192.168.1.2 255.255.255.0 //为本虚拟接口配置IP(内网)地址

 

二、配置案例

1、R1配置:

R1(config)# interface FastEthernet0/0

R1(config-if)# ip address 11.1.1.1 255.255.255.0

R1(config-if)# no shutdown

R1(config)# interface FastEthernet0/1

R1(config-if)# ip address 21.1.1.1 255.255.255.0

R1(config-if)# no shutdown

R1(config)# interface FastEthernet1/0

R1(config-if)# ip address 25.1.1.1 255.255.255.0

R1(config-if)# no shutdown

2、R2配置:

R2(config)# crypto isakmp policy 10

R2(config-isakmp)# encr aes

R2(config-isakmp)# hash md5

R2(config-isakmp)# authentication pre-share

R2(config-isakmp)# group 2

R2(config-isakmp)# lifetime 3600

R2(config-isakmp)# crypto isakmp key 6 CISCO20 address 0.0.0.0 0.0.0.0

R2(config)# crypto ipsec transform-set CISCO esp-aes esp-md5-hmac

R2(cfg-crypto-trans)# mode transport

R2(cfg-crypto-trans)# crypto ipsec profile MYPROFILE

R2(ipsec-profile)# set transform-set CISCO

 

R2(config)# interface Loopback0

R2(config-if)# ip address 2.2.2.2 255.255.255.255

R2(config-if)# ip ospf 1 area 0

R2(config)# interface FastEthernet0/0

R2(config-if)# ip address 11.1.1.2 255.255.255.0

R2(config-if)# no shutdown

R2(config)# ip route 0.0.0.0 0.0.0.0 11.1.1.1

R2(config)# interface tunnel 0

R2(config-if)# tunnel source 11.1.1.2

R2(config-if)# tunnel destination 21.1.1.3

R2(config-if)# ip address 192.168.1.2 255.255.255.0

R2(config-if)# tunnel protection ipsec profile MYPROFILE

R2(config-if)# ip ospf 1 area 0

 

3、R3配置:

R3(config)# crypto isakmp policy 10

R3(config-isakmp)# encr aes

R3(config-isakmp)# hash md5

R3(config-isakmp)# authentication pre-share

R3(config-isakmp)# group 2

R3(config-isakmp)# lifetime 3600

R3(config-isakmp)# crypto isakmp key 6 CISCO20 address 0.0.0.0 0.0.0.0

R3(config)# crypto ipsec transform-set CISCO esp-aes esp-md5-hmac

R3(cfg-crypto-trans)# mode transport

R3(cfg-crypto-trans)# crypto ipsec profile MYPROFILE

R3(ipsec-profile)# set transform-set CISCO

 

R3(config)# interface Loopback0

R3(config-if)# ip address 3.3.3.3 255.255.255.255

R3(config-if)# ip ospf 1 area 0

R3(config)# interface FastEthernet0/1

R3(config-if)# ip address 21.1.1.3 255.255.255.0

R3(config-if)# no shutdown

R3(config)# ip route 0.0.0.0 0.0.0.0 21.1.1.1

R3(config)# interface Tunnel0

R3(config-if)# ip address 192.168.1.3 255.255.255.0

R3(config-if)# tunnel source 21.1.1.3

R3(config-if)# tunnel destination 11.1.1.2

R3(config-if)# tunnel protection ipsec profile MYPROFILE

R3(config-if)# ip ospf 1 area 0

4、R4配置:

crypto isakmp policy 10

 encr aes

 hash md5

 authentication pre-share

 group 2

 lifetime 3600

crypto isakmp key 6 CISCO20 address 0.0.0.0 0.0.0.0

crypto ipsec transform-set CISCO esp-aes esp-md5-hmac

 mode transport

crypto ipsec profile MYPROFILE

 set transform-set CISCO

 

interface Loopback0

 ip address 4.4.4.4 255.255.255.255

 ip ospf 1 area 0

interface FastEthernet1/0

 ip address 25.1.1.4 255.255.255.0

no shutdown

interface Tunnel0

 ip address 192.168.2.4 255.255.255.0

 ip ospf 1 area 0

 tunnel source 25.1.1.4

 tunnel destination 11.1.1.2

 tunnel protection ipsec profile MYPROFILE

route 0.0.0.0 0.0.0.0 25.1.1.1

 

三、验证

R2# ping 192.168.1.3

R2# traceroute 3.3.3.3 source loopback 0

抓包查看,数据已成功被加密

 

转载地址:http://pdqcn.baihongyu.com/

你可能感兴趣的文章
SpringCloud组件替代方案
查看>>
Mysql实现乐观锁
查看>>
SpringBoot项目自定义Filter过滤器
查看>>
Springboot项目实现自定义拦截器
查看>>
德鲁伊后台监控配置
查看>>
正向代理和反向代理
查看>>
Stream常用方法使用案例
查看>>
Log4j日志的配置文件
查看>>
Slf4j和logback日志组合
查看>>
Mysql的读写分离和主从复制过程概述
查看>>
数据库搭建主从复制结构(主写从读)
查看>>
JS获取4位随机数
查看>>
JS实现图片上一张下一张功能
查看>>
如何使用JS实现图片幻灯片自动播放
查看>>
表格中checbox全选和反选功能实现
查看>>
Java中的synchronized与lock的区别
查看>>
基于Springboot注解形式进行模糊查询
查看>>
通用Sql返回自增长insert后的id
查看>>
SQL返回Map集合或者对象
查看>>
GC垃圾回收机制----GC回收算法(GC机制必会知识点)
查看>>