抱歉,您的浏览器无法访问本站
本页面需要浏览器支持(启用)JavaScript
了解详情 >


防火墙

默认 Password

Username : admin

Password : Admin@123

Username:admin
Password:Admin@123
The password needs to be changed. Change now? [Y/N]: Y
Please enter old password: Admin@123
Please enter new password: huawei@123
Please confirm new password: huawei@123

防火墙

防火墙:可以在不同区域之间对流量进行过滤以及隔离,从而防止一个区域的威胁进入另一个区域,这里边的火主要指的是网络攻击和入侵,所以一般防火墙部署在网络的边界.

路由器和交换机的本质是转发,而防火墙的本质是控制.

防火墙的分类

包过滤防火墙:是最早的防火墙,通过使用 ACL 实现对流量简单的控制。主要对经过的每一个数据包进行检查.

缺点:

  • 1. 无法关联数据包之间的关系
  • 2. 无法适应多通道协议
  • 3. 通常不检测应用层数据.

代理防火墙:在应用层代理内部网络和外部网络之间的通信,安全性较高,但处理速度较慢,需要对每种应用单独开发对应服务,因此只能对少量的服务提供代理支持.

缺点:
- 1. 处理效率较慢
- 2. 软件升级较为困难。需要针对每一种应用开发.

状态检测防火墙:通过动态分析报文的状态决定对报文采取的动作,不需要为每个应用程序都进行代理,处理速度更快且安全性较高.

NGFW: 下一代防火墙,增加了很多高级特性以及自动化分析功能,结合 AI 和大数据自动对网络攻击进行阻断.

防火墙的特征

逻辑区域的过滤器

隐藏内部网络结构

自身安全保障

主动防御攻击

目前网络防火墙在网络部署中的特点包括:

集中发放安全策略

安全功能复杂多样

需要专业的管理人员进行维护

安全隐患小

防火墙的组网方式

1. 二层模式 (传输模式): 防火墙只进行报文转发,不进行路由寻址,防火墙的接口工作于同一个 IP 子网,防火墙本身接口无需配置 IP 地址。不影响原来的网络结构.

2. 三层模式 (路由模式): 防火墙的上下接口均配置 IP 地址,上下的业务分别在不同的 IP 子网中,这种组网方式可以让防火墙实现更多的安全特性,但会改变原有的网络拓扑结构.

防火墙的安全区域

防火墙的安全区域 (security zone) 或简称为 zone.

区域是一个本地的逻辑概念,同属于一个区域的设备具备相同的安全策略属性.

区域是一个或多个接口的集合.

区域的作用:

  • 1. 防火墙的安全策略都是基于区域来进行部署.
  • 2. 在同一个区域内发生的数据流动是不存在安全风所以不需要实施安全策略.
  • 3. 不同区域之间的数据流动会触发安全策略,并按照对应的策略所执行.
  • 4. 同一个接口只能属于一个区域,而一个安全区域可有多个接口.

华为防火墙默认区域:

  • 1.untrust 区域:非信任区域,一般用于连接安全级别较低的网络,例如企业外部网络或 internet. 优先级为 5.
  • 2.trust 区域:信任区域,一般是企业可控的网络设备可以将企业内部网络规划在内部区域。优先级为 80.
  • 3.DMZ 区域:非军事化区域,一般用于部署服务器网络,将对外提供的服务放置在 DMZ 区域,从而可以让外部用户访问。优先级为 50.
  • 4.Local 区域:表示防火墙接口自身,所有最终终结在防火墙的流量均认为是访问 local 区域的。优先级为 100.

防火墙的接口必须划入到区域后才可以正常工作.

每个区域存在着一个区域优先级,优先级数值越大表示区域越可信。默认区域的优先级不可以更改。任意两个区域的优先级不能相同.

防火墙默认两个区域之间的流量是 deny 的,如果需要某些流量通过,必须在安全策略中方向对应的流量.

实验 - 二层

[FW1]display zone 




interface GigabitEthernet1/0/0
ip address 10.1.1.1 255.255.255.0
interface GigabitEthernet1/0/1
ip address 20.1.1.1 255.255.255.0
firewall zone trust
add interface GigabitEthernet1/0/0
firewall zone untrust
add interface GigabitEthernet1/0/1
security-policy
rule name PC3_TO_PC4
source-zone trust
destination-zone untrust
source-address 10.1.1.0 mask 255.255.255.0
destination-address 20.1.1.0 mask 255.255.255.0
service icmp
action permit

会话表
[FW1]display firewall session table


防火墙放行ping (local)
[FW1-GigabitEthernet1/0/0]service-manage ping permit

实验 - 三层

vlan 10
interface GigabitEthernet1/0/0
portswitch
port link-type access
port default vlan 10
interface GigabitEthernet1/0/1
portswitch
port link-type access
port default vlan 10
firewall zone trust
add interface GigabitEthernet1/0/0
firewall zone untrust
add interface GigabitEthernet1/0/1
security-policy
rule name PC1_TO_PC2
source-zone trust
destination-zone untrust
source-address 10.1.1.0 mask 255.255.255.0
destination-address 20.1.1.0 mask 255.255.255.0
service icmp
action permit

NAT

NAT: 可以通过在防火墙配置 NAT, 实现私网设备访问公网地址,由于防火墙一般位于企业的边界网络,所以 NAT 的配置也是防火墙需要掌握的基本配置之一.

1, 交换机作为 VLAN 10 与 VLAN 20 的网关,实现两个 VLAN 内网互通.

2, 交换机与防火墙之间使用三层互联,交换机互联 vlan 为 vlan30.

sw1: 10.1.30.1/24    FW:10.1.30.2/24

防火墙作为服务器网关,配置IP地址 192.168.1.1/24

防火墙与路由器之间配置IP地址

R1:100.1.1.1/24   FW:100.1.1.2/24

路由器作为client的网关,配置IP地址200.1.1.1/24

交换机配置静态缺省路由,网关指向防火墙

3, 将防火墙的接口划入到对应区域中,

防火墙配置2条到内网的路由以及一条缺省路由
ip route-static 0.0.0.0 0.0.0.0 100.1.1.1
ip route-static 10.1.10.0 255.255.255.0 10.1.30.1
ip route-static 10.1.20.0 255.255.255.0 10.1.30.1

4, 防火墙上配置策略以及 NAT 实现:

PC能够访问互联网中的设备
security-policy
rule name PC_TO_INTERNET
source-zone trust
destination-zone untrust
source-address 10.1.10.0 mask 255.255.255.0
source-address 10.1.20.0 mask 255.255.255.0
action permit
nat-policy
rule name PC_EASY_IP
source-zone trust
destination-zone untrust
source-address 10.1.10.0 mask 255.255.255.0
source-address 10.1.20.0 mask 255.255.255.0
action source-nat easy-ip
nat-policy
rule name HTTP
source-zone untrust
destination-address 100.1.1.2 mask 255.255.255.255
service protocol tcp destination-port 8080
action destination-nat static port-to-port address 192.168.1.100 80

security-policy
rule name HTTP
source-zone untrust
destination-zone dmz
destination-address 192.168.1.100 mask 255.255.255.255
action permit

WEBUI

interface GigabitEthernet0/0/0
ip address 10.10.10.2 255.255.255.0
service-manage http permit
service-manage https permit
service-manage ping permit


https://10.10.10.2:8443

SSH

1.创建用于登陆的SSH用户,并将SSH用户进行角色关联
[FW1]aaa
[FW1-aaa]manager-user sshadmin
[FW1-aaa-manager-user-sshadmin]password cipher huawei@123
[FW1-aaa-manager-user-sshadmin]service-type ssh
[FW1-aaa-manager-user-sshadmin]level 15
[FW1-aaa]bind manager-user sshadmin role system-admin

2.启用SSH服务,并在接口下放行SSH
[FW1]int g0/0/0
[FW1-GigabitEthernet0/0/0]service-manage ssh permit

[FW1]stelnet server enable

3.设置vty线路
[FW1]user-interface vty 0 4
[FW1-ui-vty0-4]protocol inbound ssh
[FW1-ui-vty0-4]authentication-mode aaa

4.指定用户的登录方式
[FW1]ssh user sshadmin
[FW1]ssh user sshadmin authentication-type password
[FW1]ssh user sshadmin service-type stelnet

5.生成RSA密钥对.
[FW1]rsa local-key-pair create
The key name will be: FW1_Host
The range of public key size is (2048 ~ 2048).
NOTES: If the key modulus is greater than 512,
it will take a few minutes.
Input the bits in the modulus[default = 2048]:
Generating keys...
...+++++
........................++
....++++
...........++


命令行
c:\>ssh sshadmin@10.10.10.2
The authenticity of host '10.10.10.2 (10.10.10.2)' can't be established.
ECDSA key fingerprint is SHA256:onA2uyf3daCaGnH9UsZUWjQc1FrYeSNNXBc+Bb4oiLk.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '10.10.10.2' (ECDSA) to the list of known hosts.
User Authentication
Password:

*************************************************************************
* Copyright (C) 2014-2018 Huawei Technologies Co., Ltd. *
* All rights reserved. *
* Without the owner's prior written consent, *
* no decompiling or reverse-engineering shall be allowed. *
*************************************************************************


Info: The max number of VTY users is 10, and the number
of current VTY users on line is 1.
The current login time is 2024-03-14 03:02:59+00:00.
<FW1>sy
Enter system view, return user view with Ctrl+Z.
[FW1]

防火墙双机热备

通常情况下防火墙部署在网络的出口,如果防火墙出现故障,可能会导致内网的数据无法转发,此时需要通过部署,可能会导致内网的数据无法转发,此时需要通过部署 2 台防火墙形成双机热备.

双机热备条件

1. 组成双机热备的防火墙必须是相同型号的。且安装相同的单板,单板的数量与位置必须相同.

2. 两台防火墙必须具有相同的系统版本以及系统补丁,组件包与特征库等信息也必须相同.

心跳线

心跳线:心跳线是两台防火墙交互信息了解对端状态以及备份配置命令和各种表项的通道心跳线两端的接口一般也被称为” 心跳接口”.

心跳线中传递的信息:

1. 心跳报文 (helo 报文): 2 台防火墙定期 (默认为 1s) 交互的报文,用于检测对端是否存活.

2.VGMP 报文:了解对端设备 VGMP 组的状态,确定本端和对端设备当前状态是否稳定,是否需要进行故障切换.

3. 配置和表项备份报文:用于两台防火墙同步配置以及状态.

4. 心跳链路探测报文:用于检测对端设备的心跳接口是否正常接收本端设备的报文,确定是否心跳接口可以使用.

5. 配置一致性检查报文:用于检测两台防火墙的关键配置是否一致 (如安全策略、NAT 策略).

双机热备的工作模式

1. 主备模式:流量由单台设备处理,路由规划和故障定位相对简单.

2. 负载分担模式:相对于主备模式配置复杂,需要考虑来回路径一致性,所有的用户流量由两台防火墙同时处理,可以承载更大的峰值流量.


[FW1]firewall zone name HA
[FW1-zone-HA]set priority 90
[FW1-zone-HA]add interface g1/0/2

[FW2]hrp interface g1/0/2 remote 100.1.1.1
[FW1]hrp interface g1/0/2 remote 100.1.1.2

HRP_M[FW1-GigabitEthernet1/0/0]vrrp vrid 1 virtual-ip 20.1.1.254 active
HRP_S[FW2-GigabitEthernet1/0/0]vrrp vrid 1 virtual-ip 20.1.1.254 standby

HRP_M[FW1-GigabitEthernet1/0/1]vrrp vrid 1 virtual-ip 10.1.1.254 active
HRP_S[FW2-GigabitEthernet1/0/1]vrrp vrid 1 virtual-ip 10.1.1.254 standby

HRP_M[FW1-policy-security]
security-policy
rule name PC_TO_R1
source-zone trust
destination-zone untrust
source-address 10.1.1.0 mask 255.255.255.0
destination-address 1.1.1.1 mask 255.255.255.255
action permit

display

HRP_M[FW1]hrp switch active 

HRP_M[FW1]display hrp configuration check zone
Info: You must run the check command to view the result.
Module State Start-time End-time Result
zone init

HRP_M[FW1]display hrp configuration check all
Info: You must run the check command to view the result.
Module State Start-time End-time Result
all init


HRP_M[FW1]display hrp state
Role: active, peer: standby ("hrp switch active" on this device)
Running priority: 45001, peer: 45000
Backup channel usage: 0.00%
Stable time: 0 days, 0 hours, 0 minutes
Last state change information: 2024-03-14 8:05:36 HRP core state changed, old_s
tate = abnormal(standby), new_state = abnormal(active), local_priority = 45001,
peer_priority = 45000.


HRP_M[FW1]display hrp interface
GigabitEthernet1/0/2 : running



----
会话表是同步的
HRP_M[FW1]dis firewall session table
Current Total Sessions : 3
udp VPN: public --> public 100.1.1.2:16384 --> 100.1.1.1:18514
udp VPN: public --> public 100.1.1.2:49152 --> 100.1.1.1:18514
udp VPN: public --> public 100.1.1.1:49152 --> 100.1.1.2:18514
HRP_M[FW1]dis firewall session table
Current Total Sessions : 3
udp VPN: public --> public 100.1.1.2:16384 --> 100.1.1.1:18514
udp VPN: public --> public 100.1.1.2:49152 --> 100.1.1.1:18514
udp VPN: public --> public 100.1.1.1:49152 --> 100.1.1.2:18514
-----
HRP_M[FW1]display hrp ?
configuration Check local configuration with remote firewall
history-information Indicate HRP history information
interface Indicate HRP backup channels infomation
state Indicate the HRP status infomation
statistic Indicate HRP statistic information


心跳线的冗余

心跳线的冗余:为了防止心跳线出现单点故障,可以在防火墙之间连接多跟心跳线,通过链路聚合的方式来实现链路冗余.

HRP_M[FW1]interface Eth-Trunk 1
HRP_M[FW1-Eth-Trunk1]trunkport GigabitEthernet 1/0/2 to 1/0/3
HRP_M[FW1-Eth-Trunk1]mode lacp-static
HRP_M[FW1-Eth-Trunk1]ip add 100.1.1.1 24
HRP_M[FW1]firewall zone HA
HRP_M[FW1-zone-HA]add interface Eth-Trunk 1
HRP_M[FW1]hrp interface Eth-Trunk 1 remote 100.1.1.2
推荐阅读
OSPF基础 OSPF基础 远程登录 远程登录 ACL原理和配置 ACL原理和配置 实现VLAN间通信 实现VLAN间通信 NAT网络地址转换 NAT网络地址转换 VRF 虚拟路由转发 VRF 虚拟路由转发

留言区

Are You A Robot?