
H3C防火墙与华为防火墙建立GRE over IPSec隧道
实验需求
H3C防火墙和华为防火墙分别作为总部和分支的企业网关连接Internet。现企业需要总部和分支能够安全互访,且两端能够传送组播数据(例如企业内网部署了动态路由,动态路由交互过程中存在组播报文交互)。由于单纯的IPSec隧道不能传送组播数据,而GRE隧道具备传送组播数据的能力。为了满足用户需求,需要在H3C防火墙和华为防火墙间建立GRE over IPSec隧道。此场景下,两端都可以主动发起协商建立GRE over IPSec。
实验拓扑
注意事项:关于HCL与eNSP模拟器如何通过Cloud建立双向隧道进行联动,可以参考 HCL设计篇的组播
配置思路
1. 配置H3C防火墙:
配置接口的IP地址,并将接口加入安全区域,配置通往internet的路由(推荐使用静态);
配置域间安全策略,允许IKE协商报文、IPSec封装前和解封装后的原始报文能通过华三防火墙;
配置GRE接口,并将接口加入到安全区域,将私网流量引入GRE口,定义ACL抓取GRE封装后的流量。
配置IPSec策略,包括定义需要保护的数据流、配置IKE安全提议、配置keychain、配置profile、配置IPSec安全提议;
在接口上应用IPSec策略。
2. 配置华为防火墙:
配置接口IP地址,并将接口加入安全区域;配置通往internet的路由(推荐使用静态);
配置域间安全策略,允许IKE协商报文、IPSec封装前和解封装后的原始报文能通过华为防火墙;
配置GRE接口,并将接口加入到安全区域,将私网流量引入GRE口,定义ACL抓取GRE封装后的流量。
配置IPSec策略,包括定义需要保护的数据流、配置IPSec安全提议、创建IKE安全提议、配置IKE对等体;
在接口上应用IPSec策略。
操作步骤
1.配置H3C防火墙
a.配置接口的IP地址,并将接口加入安全区域,配置通往internet的路由(推荐使用静态);
基础配置,此处省略,
b.配置域间安全策略,允许IKE协商报文、IPSec封装前和解封装后的原始报文能通过华三防火墙;
h3c_fw=================================
security-policy ip
# 放通本地到所有区域的包
rule 0 name local->any
action pass
source-zone local
# 放通华为防火墙公网口到本地公网口的包
rule 1 name untrust->local
action pass
source-zone untrust
destination-zone local
source-ip-host 1.1.1.1
destination-ip-host 2.2.2.2
# 放通总部到分部的数据包
rule 2 name trust->untrust
action pass
source-zone trust
destination-zone untrust
source-ip-subnet 192.168.0.0 255.255.255.0
destination-ip-subnet 192.168.10.0 255.255.255.0
# 放通分部到总部的数据包
rule 3 name untrust->trust
action pass
source-zone untrust
destination-zone trust
source-ip-subnet 192.168.0.0 255.255.255.0
destination-ip-subnet 192.168.10.0 255.255.255.0
c.配置GRE接口,并将接口加入到安全区域,将私网流量引入GRE口,定义ACL抓取GRE封装后的流量。
h3c_fw=================================
# 地址规划已在拓扑图上标明
interface Tunnel1 mode gre
ip address 10.1.1.1 255.255.255.0
source 2.2.2.2
destination 1.1.1.1
# tunnel口加到非信任区
security-zone name Untrust
import interface Tunnel1
ip route-static 192.168.10.0 24 Tunnel1
acl advanced 3000
rule 0 permit ip source 2.2.2.2 0 destination 1.1.1.1 0
d.配置IPSec策略,包括定义需要保护的数据流、配置IKE安全提议、配置keychain、配置profile、配置IPSec安全提议;
h3c_fw=================================
# 配置IKE安全提议
ike proposal 1
encryption-algorithm 3des
authentication-method pre-share
authentication-algorithm sha
dh group2
quit
# 配置预共享密钥keychain
ike keychain key1
pre-shared-key address 1.1.1.1 255.255.255.0 key simple Key@123
# 说明
# keychain用来配置双方使用的预共享密钥,配置时必须指定对端的IP地址或主机名。
# 一个keychain中可以配置多个对端及其使用的预共享密钥,每个对端使用的预共享密钥都是不同的。
# 配置profile,关联预共享密钥,对端身份匹配,引用ike提议等
ike profile pro1
keychain key1
proposal 1
exchange-mode main
local-identity address 2.2.2.2
match remote identity address 1.1.1.1 255.255.255.0
match local address GigabitEthernet1/0/3
# 配置IPSec安全提议。
ipsec transform-set tran1
encapsulation-mode tunnel
protocol esp
esp encryption-algorithm 3des-cbc
esp authentication-algorithm sha1
# 配置IPSec策略。绑定profile、IPSec安全提议、ACL,本地和对端地址
ipsec policy map1 1 isakmp
transform-set tran1
security acl 3000
local-address 2.2.2.2
remote-address 1.1.1.1
ike-profile pro1
# 在接口上应用IPSec策略。
interface GigabitEthernet1/0/3
ipsec apply policy map1
2.配置华为防火墙
a.配置接口IP地址,并将接口加入安全区域;配置通往internet的路由(推荐使用静态);
基础配置,此处省略
b.配置域间安全策略,允许IKE协商报文、IPSec封装前和解封装后的原始报文能通过华为防火墙;
huawei_fw=================================
security-policy
# 放通本地到所有区域的包
rule name local->any
source-zone local
action permit
# 放通H3C防火墙公网口到本地公网口的包
rule name untrust->local
source-zone untrust
destination-zone local
source-address 2.2.2.2 mask 255.255.255.255
destination-address 1.1.1.1 mask 255.255.255.255
action permit
# 放通总部到分部的数据包
rule name untrust->trust
source-zone untrust
destination-zone trust
source-address 192.168.0.0 mask 255.255.255.0
destination-address 192.168.10.0 mask 255.255.255.0
action permit
# 放通分部到总部的数据包
rule name trust->untrust
source-zone trust
destination-zone untrust
source-address 192.168.10.0 mask 255.255.255.0
destination-address 192.168.0.0 mask 255.255.255.0
action permit
此过程配置完毕后,可以上H3C防火墙和Huawei防火墙上互ping对端公网口,可以发现Huawei能ping通H3C,H3Cping不通Huawei,需要在Huawei防火墙的公网口放通服务,这里为了方便,暂时放行所有服务,然后再ping就可以通了。
huawei_fw=================================
interface GigabitEthernet1/0/3
service-manage all permit
c.配置GRE接口,并将接口加入到安全区域,将私网流量引入GRE口,定义ACL抓取GRE封装后的流量。
huawei_fw=================================
interface Tunnel1
# 地址规划已在拓扑图上标明
ip address 10.1.1.2 255.255.255.0
tunnel-protocol gre
source 1.1.1.1
destination 2.2.2.2
# tunnel口加到非信任区
firewall zone untrust
add interface Tunnel1
ip route-static 192.168.0.0 255.255.255.0 Tunnel1
acl number 3000
rule 5 permit ip source 1.1.1.1 0 destination 2.2.2.2 0
d.配置IPSec策略,包括定义需要保护的数据流、配置IPSec安全提议、创建IKE安全提议、配置IKE对等体;
huawei_fw=================================
#配置IKE安全提议,指定加密算法、认证算法、DH。
ike proposal 1
encryption-algorithm 3des
authentication-algorithm sha1
dh group2
# 配置IKE对等体,类似于华三的ike profile
ike peer h3c
exchange-mode main
undo version 2
ike-proposal 1
pre-shared-key Key@123
remote-address 2.2.2.2
# 配置IPSec安全提议,指定封装模式、安全协议,加密算法、认证算法。
ipsec proposal tran1
transform esp
encapsulation-mode tunnel
esp encryption-algorithm 3des
esp authentication-algorithm sha1
# 配置IPSec策略,绑定IKE对等体、IPSec安全提议、ACL。
ipsec policy map1 1 isakmp
ike-peer h3c
proposal tran1
security acl 3000
# 在接口上应用IPSec策略。
interface GigabitEthernet1/0/3
ipsec policy map1
e.在接口上应用IPSec策略。
huawei_fw=================================
# 在接口上应用IPSec策略。
interface GigabitEthernet1/0/3
ipsec policy map1
结果查看与测试
查看两端的ike sa,和ipsec sa。
h3c_fw
huawei_fw
总部带源ping分部
在华为防火墙上可以看到总部(untrust)到本部私网(trust)的流量命中纪录(untrust->trust)
命令行配置熟练后,也可以在web界面配置vpn,方便一点。
h3c_fw
huawei_fw
完结。
- 感谢你赐予我前进的力量