虽说华为防火墙能用 WEB 界面来配置,不过也能通过命令行进行操作。
华为防火墙有 50 个常用的配置命令,把基础配置、安全策略、NAT、VPN、高可用性这些场景都涵盖了。

一、系统基础配置
- 进入系统视图
system-view - 设置设备名称
sysname [name] - 查看当前配置
display current-configuration - 保存配置
save - 查看设备版本信息
display version - 查看接口状态
display interface brief - 配置时钟时区
clock timezone [时区名称] add/minus [小时数] - 配置SSH登录
ssh user [username] authentication-type password
ssh client enable - 配置Telnet登录
telnet server enable
user-interface vty 0 4
authentication-mode password - 配置管理口IP
interface GigabitEthernet 0/0/0
ip address [IP地址] [子网掩码] 
二、接口与安全区域
- 将接口加入安全区域
firewall zone [trust/untrust/dmz]
add interface [接口名称] - 配置接口IP地址
interface [接口名称]
ip address [IP地址] [子网掩码] - 开启/关闭接口
shutdown(关闭)
undo shutdown(开启) - 配置接口描述
description [描述信息] - 查看安全区域绑定
display zone [zone名称] 
三、安全策略
- 创建安全策略规则
security-policy
rule name [规则名称]
source-zone [源区域]
destination-zone [目标区域]
source-address [IP地址] [掩码]
destination-address [IP地址] [掩码]
action permit/deny - 启用默认拒绝所有流量
security-policy
default action deny - 查看安全策略列表
display security-policy all - 配置基于服务的策略
service [服务名称]
protocol tcp/udp
source-port [端口]
destination-port [端口] - 配置策略生效时间
time-range [时间段名称]
periodic [时间范围]
rule中引用:time-range [时间段名称] 
四、NAT配置
- 配置源NAT(动态PAT)
nat-policy
rule name [规则名称]
source-zone [源区域]
destination-zone [目标区域]
action source-nat easy-ip(使用接口IP) - 配置静态NAT(一对一映射)
nat static global [公网IP] inside [内网IP] - 配置端口映射(NAT Server)
nat server [协议] global [公网IP] [端口] inside [内网IP] [端口] - 查看NAT会话表
display nat session all - NAT地址池配置
nat address-group [地址池名称]
section [起始IP] [结束IP] 
五、VPN配置
- 创建IPSec VPN隧道
ipsec policy [策略名称]
proposal [提议名称]
ike-peer [对端名称]
tunnel local [本端IP]
tunnel remote [对端IP] - 配置IKE提议
ike proposal [提议名称]
encryption-algorithm aes-256
dh group14
authentication-algorithm sha2-256 - 配置预共享密钥
ike peer [对端名称]
pre-shared-key [密钥] - 查看IPSec状态
display ipsec session all - 配置L2TP VPN
interface Virtual-Template 1
ppp authentication-mode chap
l2tp enable 
六、路由与网关
- 配置静态路由
ip route-static [目标网段] [掩码] [下一跳IP] - 查看路由表
display ip routing-table - 配置默认网关
ip route-static 0.0.0.0 0.0.0.0 [下一跳IP] - 配置策略路由(PBR)
policy-based-route [策略名称] permit node 10
apply ip-address next-hop [下一跳IP] 
七、高可用性(HA)
- 配置VRRP虚拟IP
interface [接口名称]
vrrp vrid [ID] virtual-ip [虚拟IP]
vrrp vrid [ID] priority [优先级] - 启用双机热备(主备模式)
hrp enable
hrp interface [接口名称] remote [对端IP] - 查看HRP状态
display hrp state 
八、日志与监控
- 配置日志主机
info-center enable
info-center loghost [IP地址] facility local6 - 查看实时日志
terminal monitor
terminal logging - 查看会话表
display firewall session table - 清除会话表
reset firewall session table 
九、对象与服务定义
- 定义地址对象
address-set [对象名称] type object
address [IP地址] [掩码] - 定义服务对象
service-set [服务名称]
service [协议] source-port [端口] destination-port [端口] - 定义时间段对象
time-range [名称] [起始时间] to [结束时间] daily 
十、其他实用命令
- Ping测试连通性
ping [IP地址] - Tracert路径追踪
tracert [IP地址] - 重启防火墙
reboot - 恢复出厂设置
reset saved-configuration
reboot - 查看CPU/内存利用率
display cpu-usage
display memory-usage - 配置DHCP服务
dhcp enable
dhcp select interface 
注意事项
- 命令上下文:大部分配置需在system-view下执行。
 - 版本差异:不同版本的防火墙OS可能略有差异,提议参考官方文档。
 - 备份配置:修改前使用save保存配置,重大变更前提议备份。
 
© 版权声明
文章版权归作者所有,未经允许请勿转载。如内容涉嫌侵权,请在本页底部进入<联系我们>进行举报投诉!
THE END
    


















- 最新
 - 最热
 
只看作者