华为路由器:IPSec加密GRE通道(GRE over IPsec)

IPSec加密GRE通道

由于GRE隧道不提供安全性保障,使用ipsec加密gre隧道是现网中比较常用的VPN部署,它的加密方式分为两种:

  • 可以使用IPsec来加密隧道进行传输,叫做IPsec over GRE;

  • 加密数据流后从隧道传输,称为GRE over IPsec。

下面将配置一个简单的IPsec over GRE实验。
在这里插入图片描述

一、搭建模拟环境

首先我们先搭建环境,先根据拓扑图把基本的IP地址配好,然后分别在AR1、AR3加两条静态路由,使得两个公网互通。

[AR1]in g0/0/0
[AR1-GigabitEthernet0/0/0]ip add 192.168.1.254 24 
[AR1-GigabitEthernet0/0/0]q
[AR1]in g0/0/1
[AR1-GigabitEthernet0/0/1]ip add 200.1.1.1 24
[AR1-GigabitEthernet0/0/1]q
[AR1]ip route-static 200.2.2.0 24 200.1.1.2


[AR2]in g0/0/0
[AR2-GigabitEthernet0/0/0]ip add 200.1.1.2 24
[AR2-GigabitEthernet0/0/0]q
[AR2]in g0/0/1
[AR2-GigabitEthernet0/0/1]ip add 200.2.2.2 24
[AR2-GigabitEthernet0/0/1]q


[AR3]in g0/0/0
[AR3-GigabitEthernet0/0/0]ip add 200.2.2.1 24
[AR3-GigabitEthernet0/0/0]q
[AR3]in g0/0/1
[AR3-GigabitEthernet0/0/1]ip add 192.168.2.254 24
[AR3-GigabitEthernet0/0/1]q
[AR3]ip route-static 200.1.1.0 24 200.2.2.2

验证结果:

[AR1]ping -a 200.1.1.1 200.2.2.1
  PING 200.2.2.1: 56  data bytes, press CTRL_C to break
    Reply from 200.2.2.1: bytes=56 Sequence=1 ttl=254 time=60 ms
    Reply from 200.2.2.1: bytes=56 Sequence=2 ttl=254 time=20 ms
    Reply from 200.2.2.1: bytes=56 Sequence=3 ttl=254 time=40 ms
    Reply from 200.2.2.1: bytes=56 Sequence=4 ttl=254 time=10 ms
    Reply from 200.2.2.1: bytes=56 Sequence=5 ttl=254 time=30 ms

  --- 200.2.2.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 10/32/60 ms

二、GRE的配置

AR1

interface Tunnel0/0/0   #新建隧道
 description zongbu     #这个是描述,不是目标地址,需要注意
 ip address 10.1.1.1 255.255.255.0   #给隧道配置地址
 tunnel-protocol gre    #隧道协议
 source 200.1.1.1       #源地址,注意这里是公网地址
 destination 200.2.2.1  #目标地址,注意这里是公网地址

AR3
 
interface Tunnel0/0/0
 description fengongsi
 ip address 10.1.1.2 255.255.255.0 
 tunnel-protocol gre
 source 200.2.2.1
 destination 200.1.1.1


两边各加1条静态路由

[AR1]ip route-static 192.168.2.0 24 Tunnel 0/0/0   #这里我们用隧道接口,也可以用隧道IP
[AR1]ip route-static 192.168.2.0 24 ?              #这里除了加接口还可以直接IP
  IP_ADDR<X.X.X.X>  Gateway address
  GigabitEthernet   GigabitEthernet interface
  NULL              NULL interface
  Tunnel            Tunnel interface
  vpn-instance      Destination VPN-Instance for Gateway address


[AR3]ip route-static 192.168.1.0 24 Tunnel 0/0/0


验证一下:PC1 > PC2

PC>ping 192.168.2.1

Ping 192.168.2.1: 32 data bytes, Press Ctrl_C to break
From 192.168.2.1: bytes=32 seq=1 ttl=126 time=31 ms
From 192.168.2.1: bytes=32 seq=2 ttl=126 time=16 ms
From 192.168.2.1: bytes=32 seq=3 ttl=126 time=31 ms
From 192.168.2.1: bytes=32 seq=4 ttl=126 time=15 ms
From 192.168.2.1: bytes=32 seq=5 ttl=126 time=16 ms

--- 192.168.2.1 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 15/21/31 ms

三、配置IPSec加密

#创建IKE提议
ike proposal 1   
 encryption-algorithm 3des-cbc  #指定加密算法
 authentication-algorithm md5   #认证算法

#配置IKE对等体 
ike peer 1 v2   
 pre-shared-key simple 123456   #共享密钥
 ike-proposal 1
 
#配置IPSec提议
ipsec proposal 1  
 esp encryption-algorithm 3des   #esp的加密算法
 
#配置IPSec文件,其实也就是调用上面的IKE提议和IPSec提议
ipsec profile gre    
 ike-peer 1
 proposal 1
 
 
interface Tunnel0/0/0
 ipsec profile gre

 
interface Tunnel0/0/0
 description zongbu
 ip address 10.1.1.1 255.255.255.0 
 tunnel-protocol gre
 source 200.1.1.1
 destination 200.2.2.1
 ipsec profile gre

####以上配置AR1、AR3完全一样

四、加密验证

我们选择下图中AR1的g0/0/1接口抓包

在这里插入图片描述

然后用PC1去pingPC2的抓包效果

在这里插入图片描述
在这里插入图片描述

  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
华为路由器和H3C路由器之间配置GRE over IPsec(IP安全隧道协议)可以实现安全的跨网段通信。下面是一个简单的配置示例: 在华为路由器上的配置步骤: 1. 创建GRE隧道接口,并指定本地和远程IP地址: ``` interface Tunnel 0 ip address 192.168.1.1 255.255.255.0 tunnel-protocol gre source GigabitEthernet 0/0/0 destination 10.0.0.1 ``` 2. 创建IPsec策略,并指定加密算法、密钥等参数: ``` ipsec proposal myproposal esp authentication-algorithm md5 esp encryption-algorithm des ipsec policy mypolicy 10 isakmp security acl 3001 proposal myproposal acl number 3001 rule 5 permit gre source 192.168.1.0 0.0.0.255 destination 10.0.0.0 0.255.255.255 ike proposal myproposal authentication-method pre-share encryption-algorithm des integrity-algorithm md5 sa duration time-based 28800 ike-peer 10.0.0.1 pre-shared-key cipher %^%#zjhuawei%^%# ike-proposal myproposal ``` 在H3C路由器上的配置步骤: 1. 创建GRE隧道接口,并指定本地和远程IP地址: ``` interface Tunnel 0 ip address 192.168.1.2 255.255.255.0 tunnel-protocol gre source GigabitEthernet 0/0/0 destination 10.0.0.2 ``` 2. 创建IPsec策略,并指定加密算法、密钥等参数: ``` ipsec proposal myproposal esp authentication-algorithm md5 esp encryption-algorithm des ipsec policy mypolicy 10 isakmp security acl 3001 proposal myproposal acl number 3001 rule 5 permit gre source 192.168.1.0 0.0.0.255 destination 10.0.0.0 0.255.255.255 ike proposal myproposal authentication-method pre-share encryption-algorithm des integrity-algorithm md5 sa duration time-based 28800 ike-peer 10.0.0.2 pre-shared-key cipher %^%#h3c%^%# ike-proposal myproposal ``` 以上配置示例中,需要根据实际情况替换IP地址、接口名称、加密算法、密钥等参数。配置完成后,华为路由器和H3C路由器之间的GRE over IPsec隧道将建立起来,可以实现跨网络的安全通信。请注意,这只是一个简单的示例,实际配置可能会有所不同,取决于具体的设备型号和操作系统版本。建议参考设备的官方文档或咨询厂商获取更详细的配置指南。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值