华为eNSP防火墙 配置使用GRE over IPSec隧道

前置配置

1)防火墙基本转发配置(①添加安全区域,②安全转发策略,③配置默认路由,④基本的NAT策略)

①添加安全区域

firewall zone trust

add interface GigabitEthernet1/0/0

firewall zone untrust

add interface GigabitEthernet1/0/1

②防火墙的安全转发策略

FW1:

security-policy

rule name gre_over_ipsec

source-zone local trust untrust

destination-zone local local trust untrust

action permit

FW2:

security-policy

rule name gre_over_ipsec

source-zone local trust untrust

destination-zone local local trust untrust

action permit

③配置默认路由

FW1:

ip route-static 0.0.0.0 0.0.0.0 192.168.10.254

FW2:

ip route-static 0.0.0.0 0.0.0.0 192.168.20.254

④基本的NAT策略

如果防火墙内部网络设备不需要访问互联网(ISP),则无需配置

2)允许ping访问防火墙的外网接口

[USG6000V1]int 接口

[USG6000V1]service-manage ping permit

3)连通检查:

FW1防火墙的外网接口能够ping通FW2防火墙的外网接口

防火墙配置内层GRE隧道:

FW1:

配置Tunnel接口

[FW1]interface Tunnel 0

[FW1-Tunnel0]tunnel-protocol gre

[FW1-Tunnel0]ip address 192.168.1.1 24

[FW1-Tunnel0]source 192.168.10.1

[FW1-Tunnel0]destination 192.168.20.1

将创建的Tunnel接口添加到untrust区域

[FW1]firewall zone untrust

[FW1-zone-untrust]add interface Tunnel 0

配置GRE VPN访问对端网络的静态路由

[FW1]ip route-static 192.168.200.0 24 Tunnel 0

FW2:

配置Tunnel接口

[FW2]interface Tunnel 0

[FW2-Tunnel0]tunnel-protocol gre

[FW2-Tunnel0]ip address 192.168.1.2 24

[FW2-Tunnel0]source 192.168.20.1

[FW2-Tunnel0]destination 192.168.10.1

将创建的Tunnel接口添加到untrust区域

[FW2]firewall zone untrust

[FW2-zone-untrust]add interface Tunnel 0

配置GRE VPN访问对端网络的静态路由

[FW2]ip route-static 192.168.100.0 24 Tunnel 0

连通检查:

使用命令查看GRE VPN隧道建立情况

display interface Tunnel 0

使用命令查看GRE VPN会话建立情况

display firewall session table

PC1能够ping通PC2,此时数据包以明文的形式传输

GRE隧道配置成功

防火墙配置外层IPSec隧道:

FW1:

配置FW1防火墙acl列表匹配GRE隧道流量

[FW1]acl 3000

[FW1-acl-adv-3000]rule 5 permit ip source 192.168.100.0 0.0.0.255 destination 192.168.200.0 0.0.0.255

配置FW1防火墙ike安全提议

[FW1]ike proposal 1

配置FW1防火墙的对等体

[FW1]ike peer site2

[FW1-ike-peer-site2]pre-shared-key cipher huawei

[FW1-ike-peer-site2]ike-proposal 1

[FW1-ike-peer-site2]remote-add 192.168.1.2 #使用对端的隧道IP地址

配置FW1防火墙的ipsec安全提议

[FW1]ipsec proposal 1

[FW1-ipsec-proposal-1]encapsulation-mode tunnel

[FW1-ipsec-proposal-1]esp authentication-algorithm sha2-256

[FW1-ipsec-proposal-1]esp encryption-algorithm aes-256

[FW1-ipsec-proposal-1]transform esp

配置FW1防火墙的ipsec安全策略

[FW1]ipsec policy site1 1 isakmp

[FW1-ipsec-policy-isakmp-site1-1]security acl 3000

[FW1-ipsec-policy-isakmp-site1-1]ike-peer site2

[FW1-ipsec-policy-isakmp-site1-1]proposal 1

将安全策略应用到Tunnel接口

[FW1]interface Tunnel 0

[FW1-Tunnel0]ipsec policy site1

FW2:

配置FW2防火墙acl列表匹配GRE隧道流量

[FW2]acl 3000

[FW2-acl-adv-3000]rule 5 permit ip source 192.168.200.0 0.0.0.255 destination 192.168.100.0 0.0.0.255

配置FW2防火墙ike安全提议

[FW2]ike proposal 1

配置FW2防火墙的对等体

[FW2]ike peer site1

[FW2-ike-peer-site1]pre-shared-key cipher huawei

[FW2-ike-peer-site1]ike-proposal 1

[FW2-ike-peer-site1]remote-id-type ip

[FW2-ike-peer-site1]remote-add 192.168.1.1 #使用对端的隧道IP地址

配置FW2防火墙的ipsec安全提议

[FW2]ipsec proposal 1

[FW2-ipsec-proposal-1]encapsulation-mode tunnel

[FW2-ipsec-proposal-1]esp authentication-algorithm sha2-256

[FW2-ipsec-proposal-1]esp encryption-algorithm aes-256

[FW2-ipsec-proposal-1]transform esp

配置FW2防火墙的ipsec安全策略

[FW2]ipsec policy site2 1 isakmp

[FW2-ipsec-policy-isakmp-site2-1]security acl 3000

[FW2-ipsec-policy-isakmp-site2-1]ike-peer site1

[FW2-ipsec-policy-isakmp-site2-1]proposal 1

将安全策略应用到Tunnel接口

[FW2]interface Tunnel 0

[FW2-Tunnel0]ipsec policy site2

连通检查:

使用命令查看IKE安全联盟

dis ike sa

IPSec安全联盟建立情况

dis ipsec sa

PC1能够ping通PC2,此时数据包以加密的形式传输

GRE over IPSec隧道配置成功

### 华为eNSP防火墙配置指南 #### 1. 基础环境搭建 为了在华为eNSP模拟器中进行防火墙配置,需先建立基础网络拓扑结构。通常情况下,这涉及到创建至少两个路由器或交换机以及一台或多台PC终端来模拟内外网环境。 #### 2. 防火墙模块安装与初始化设置 启动所需设备后,在目标路由器上加载防火墙软件包,并完成初始向导式的简单设定过程,比如定义主机名、登录密码等基本信息[^1]。 #### 3. 安全区域划分 通过命令行界面CLI进入安全策略视图下,利用`firewall zone`指令新增自定义的安全区段,如Trust(信任)、Untrust(不信任),并将相应的物理端口分配给这些逻辑分区: ```shell [Huawei] firewall zone trust [Huawei-zone-trust] add interface GigabitEthernet 0/0/1 ``` 上述例子表示将GigabitEthernet 0/0/1接口划入到名为“trust”的区域内[^2]。 #### 4. 访问控制列表ACL的应用 针对不同方向的数据流制定过滤规则,即所谓的访问控制列表(Access Control List, ACL),用于精确管控进出流量的行为模式。例如允许特定IP地址范围内的计算机访问内部资源的同时阻止其他外部请求: ```shell [Huawei] acl number 3000 [Huawei-acl-3000] rule permit ip source 192.168.1.0 0.0.0.255 destination any [Huawei-adv-3000] quit [Huawei] interface gigabitethernet 0/0/2 [Huawei-GigabitEthernet0/0/2] traffic-filter inbound acl 3000 ``` 此段脚本实现了仅放行来自192.168.1.x子网内机器发起的所有类型的连接尝试,而拒绝其余未授权源点发出的信息传递活动[^3]。 #### 5. NAT转换机制部署 对于希望隐藏真实局域网布局或者实现多对一映射场景而言,启用Network Address Translation (NAT) 功能至关重要。下面给出了一种典型应用场景下的参数调整方式——动态PAT(port address translation): ```shell [Huawei]interface g0/0/2 [Huawei-GigabitEthernet0/0/2]nat outbound 2000 [Huawei]interface loopback 0 [Huawei-LoopBack0]ip address 1.1.1.1 255.255.255.255 [Huawei]acl number 2000 [Huawei-2000]rule permit source 172.16.0.0 0.0.255.255 ``` 这里假设外网出口位于g0/0/2接口处,则该组语句的作用就是让所有源自私有IPv4区间(172.16.0.0~172.16.255.255) 的报文经过此处时自动替换掉原有的源地址字段值成为公网可见形式再向外转发出去[^4]。
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值