快来看啊,华为路由器配置GRE over IPSec隧道案例来了!

我们前面通过H3C路由器介绍了IPsec和GRE搭配使用的两种常见配置方法:GRE over IPsecGRE和IPsec搭配使用,到底是谁over谁?先看GRE over IPsec和IPsec over GREGRE over IPsec,IPsec不服,要求IPsec over GRE

其中的over是在网络模型中的说法,比如说GRE over IPsec,就是GRE在IPsec之上,那在报文封装的时候就会先封装GRE,再封装IPsec,从报文结构上看起来就是IPsec封装在GRE封装之外,over前面的是内层报文封装,后面的才是外层封装,也是直接看到的报文结构。从效果上看就是用IPsec保护GRE隧道,说得不严谨一点,IPsec over GRE最终就是GRE封装格式的报文,GRE over IPsec就是IPsec封装格式的报文。

今天我们来简单学习一下华为AR1000V如何配置GRE over IPSec隧道,组网拓扑如下所示:

27bbf067e26203316b073d149f1bf388.png

配置也很简单,相比于上次单独配置的IPsec通过IKE协商方式建立IPSec隧道,只要把IPsec应用的接口调整为GRE隧道接口就可以了。

首先配置HW-AR1和HW-AR2之间的互通,再捎带着配一条GRE隧道。   

HW-AR1  

#
interface GigabitEthernet0/0/1
 ip address 12.1.1.1 255.255.255.0
#
interface Tunnel0/0/0
 ip address 10.13.1.1 255.255.255.0
 tunnel-protocol gre
 source 12.1.1.1
 destination 23.1.1.3
#
ip route-static 23.1.1.0 255.255.255.0 12.1.1.2

H3C-MSR  

#
interface GigabitEthernet1/0
 ip address 12.1.1.2 255.255.255.0
#
interface GigabitEthernet2/0
 ip address 23.1.1.2 255.255.255.0

HW-AR2  

#
interface GigabitEthernet0/0/1
 ip address 23.1.1.3 255.255.255.0
#
interface Tunnel0/0/0
 ip address 10.13.1.3 255.255.255.0
 tunnel-protocol gre
 source 23.1.1.3
 destination 12.1.1.1
#
ip route-static 12.1.1.0 255.255.255.0 23.1.1.2

此时,HW-AR1和HW-AR2之间就可以使用GRE隧道接口地址互通了。   

b7e84349da7af2630551519678f6db84.png

接下来,我们配置HW-AR1和HW-AR2采用IKE协商方式建立IPSec隧道。配置思路跟上次一样,需要通过ACL定义IPsec保护的数据流,配置IKE对等体,配置IPsec安全提议,再配置IPsec安全策略,只不过最后应用IPsec安全策略的接口变成了GRE隧道接口。

首先,我们在HW-AR1上配置IPsec保护数据流的ACL,配置不变。

#
acl number 3401
 rule 5 permit ip source 10.1.1.0 0.0.0.255 destination 10.1.2.0 0.0.0.255

接下来,我们创建对应HW-AR2的IKE对等体,IKE安全提议使用默认配置。   

2c30a4862012463bf2191e948629c13b.png

默认情况下,IKE版本使用IKEv2版本,我们修改IKE版本使用IKEv1;此时的对端IP地址可以不配置,也可以配置成对端的GRE隧道接口地址;再设置好PSK预共享密钥就行了。注意:预共享密钥需要满足一定的复杂度要求。

#
ike peer ar2
 version 1
 pre-shared-key cipher HwIPsec.2024
 remote-address 10.13.1.3

然后,我们配置IPsec安全提议,默认的加密方式为ESP,使用的认证算法为SHA2-256,加密算法为AES-256;我们可以按需进行调整。   

afb5f9160b7c61be079108a53ca1e6a7.png

#
ipsec proposal ipsec
 esp authentication-algorithm sha1
 esp encryption-algorithm aes-128

接下来,我们就可以创建使用IKE动态协商的安全策略了。

#
ipsec policy aripsec 10 isakmp
 security acl 3401
 ike-peer ar2
 proposal ipsec

最后,我们将创建好的IPsec安全策略应用到GRE隧道接口上。

#
interface Tunnel0/0/0
 ipsec policy aripsec

这次,我们必须要添加一条去往对端私网的明细路由,指定出接口为GRE隧道接口,或者指定下一跳IP地址为对端GRE隧道接口地址。   

#
ip route-static 10.1.2.0 255.255.255.0 10.13.1.3

至此,HW-AR1的配置就结束了。我们参考以上配置,完成HW-AR2的配置,配置命令如下:

#
acl number 3402
 rule 5 permit ip source 10.1.2.0 0.0.0.255 destination 10.1.1.0 0.0.0.255
#
ike peer ar1
 version 1
 pre-shared-key cipher HwIPsec.2024
 remote-address 10.13.1.1
#
ipsec proposal ipsec
 esp authentication-algorithm sha1
 esp encryption-algorithm aes-128
#
ipsec policy aripsec 10 isakmp
 security acl 3402
 ike-peer ar1    
 proposal ipsec
#
interface GigabitEthernet0/0/1
 ipsec policy aripsec
#
ip route-static 10.1.1.0 255.255.255.0 10.13.1.1

其实,配置完成之后,设备就自动发起了协商,协商成功之后直接就有IKE SA和IPsec SA了。   

2bc6dbfd2fd5f5f987c4d4895046f423.png    

测试一下业务联通性。

fce77403a52142ae9842b0654ffbff3f.png

首包实验稍大这个并不是因为触发了协商,纠正一下。

查看IKE SA信息。   

3592f8f4b9ee476d5b1dd58b7ff0f814.png    

经过我的研究,发现这里显示的两个IKE SA,Phase显示的v1指的是IKEv1,后面的数字确定是阶段;也就是一个是一阶段,即建立安全通道进行通信的阶段,此阶段建立IKE SA;另一个是二阶段,即协商安全服务的阶段,此阶段建立IPSec SA。

我们再看一下IPsec SA信息。   

fc015e964f70886fd6bcf67cafbd2a62.png

简简单单,配置就完成了。 

***推荐阅读***

如何配置使用Telnet远程登录华为AR1000V路由器?

Telnet不安全?如何配置使用更安全的STelnet远程登录华为AR1000V路由器?

华为交换机S3700/S5700/CE6800配置SSH远程登录

华为模拟器eNSP安装初体验

中华之名,有为之势!看eNSP如何吊打HCL

GRE和IPsec搭配使用,到底是谁over谁?先看GRE over IPsec

GRE over IPsec,IPsec不服,要求IPsec over GRE

使用IKE数字签名RSA认证建立IPsec隧道的配置案例

太卷了,能配置ADVPN的云主机一年只要37块钱!

配置Windows系统对接天翼云VPN连接

华为路由器和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隧道将建立起来,可以实现跨网络的安全通信。请注意,这只是一个简单的示例,实际配置可能会有所不同,取决于具体的设备型号和操作系统版本。建议参考设备的官方文档或咨询厂商获取更详细的配置指南。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Danileaf_Guo

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值