等保建设|系统集成|机房建设|综合布线 | 全国服务热线:13808203880 | 移动电话:13808203880

华为防火墙配置命令大全,超级详细

作者华为代理商 发表日期:2023-01-04 10:17:15 浏览次数:

华为防火墙配置命令大全,超级详细


防火墙(Firewall)也称防护墙,是由Check Point创立者Gil Shwed于1993年发明并引入国际互联网(US5606668(A)1993-12-15)防火墙是位于内部网和外部网之间的屏障,它按照系统管理员预先定义好的规则来控制数据包的进出。防火墙是系统的第一道防线,其作用是防止非法用户的进入。

初始化防火墙
初始化防火墙: 默认用户名为admin,默认的密码Admin@123,这里修改密码为along@163

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

system-view // 进入系统视图
[FW1] sysname FW1 // 给防火墙命名
[FW1] undo info-center enable // 关闭日志弹出功能
[FW1] quit
language-mode Chinese // 将提示修改为中文
Change language mode, confirm? [Y/N] y
提示:改变语言模式成功.
开启Web管理界面: 默认防火墙console接口IP地址是192.168.0.1

system-view
[FW1] web-manager enable // 开启图形管理界面
[FW1] interface GigabitEthernet 0/0/0
[FW1-GigabitEthernet0/0/0] ip address 192.168.0.1 24 // 给接口配置IP地址
[FW1-GigabitEthernet0/0/0] service-manage all permit // 放行该端口的请求
[FW1-GigabitEthernet0/0/0] display this
配置Console口登陆:

system-view // 进入系统视图
[FW1] user-interface console 0 // 进入console0的用户配置接口
[FW1-ui-console0] authentication-mode password // 使用密码验证模式
[FW1-ui-console0] set authentication password cipher Admin1234 // 设置密码为Admin1234
[FW1-ui-console0] quit // 退出用户配置接口
配置telnet密码认证: 配置密码认证模式,此处配置密码为Admin@123

FW1> system-view
[FW1] telnet server enable // 开启Telnet支持
[FW1] interface GigabitEthernet 0/0/0 // 选择配置接口
[FW1-GigabitEthernet0/0/0] service-manage telnet permit // 允许telnet
[FW1-GigabitEthernet0/0/0] quit

[FW1] user-interface vty 0 4 // 开启虚拟终端
[FW1-ui-vty0-4] protocol inbound telnet // 允许telnet
[FW1-ui-vty0-4] authentication-mode password // 设置为密码认证模式
[FW1-ui-vty0-4] set authentication password cipher Admin@123 // 设置用户密码

[USG6000V1] firewall zone trust // 选择安全区域
[USG6000V1-zone-trust] add interface GE0/0/0 // 添加到安全区域
配置telnet用户名密码认证:

system-view // 进入系统视图
[FW1] interface GigabitEthernet 0/0/0 // 进入接口配置
[FW1-GigabitEthernet0/0/0] ip address 192.168.0.1 24 // 配置接口IP
[FW1-GigabitEthernet0/0/0] service-manage telnet permit // 允许telnet
[FW1-GigabitEthernet0/0/0] service-manage ping permit // 允许ping
[FW1-GigabitEthernet0/0/0] quit //退出

[FW1] firewall zone trust // 进入trust安全域配置
[FW1-zone-trust] add interface GigabitEthernet 0/0/0 // 把GE0/0/0加入到trust安全域
[FW1-zone-trust] quit

[FW1] telnet server enable // 启用telnet服务
[FW1] user-interface vty 0 4 // 进入vty0-4的用户配置接口
[FW1-ui-vty0-4] authentication-mode aaa // 使用AAA验证模式
[FW1-ui-vty0-4] user privilege level 3 // 配置用户访问的命令级别为3
[FW1-ui-vty0-4] protocol inbound telnet // 配置telnet
[FW1-ui-vty0-4] quit // 退出用户配置接口

[FW1] aaa // 进入AAA配置视图
[FW1-aaa] manager-user lyshark // 创建用户vtyadmin
[FW1-aaa-manager-user-lyshark] password cipher admin@123 // 配置用户密码
[FW1-aaa-manager-user-lyshark] service-type telnet // 配置服务类型
[FW1-aaa-manager-user-lyshark] quit // 退出

[FW1-aaa] bind manager-user lyshark role system-admin // 绑定管理员角色
[FW1-aaa] quit // 退出AAA视图

常用查询命令: 查询防火墙的其他配置,常用的几个命令如下

[FW1] display ip interface brief // 查默认接口信息
[FW1] display ip routing-table // 显示路由表
[FW1] display zone // 显示防火墙区域
[FW1] display firewall session table // 显示当前会话
[FW1] display security-policy rule all // 显示安全策略
配置到这里,我们就可以在浏览器中访问了,其访问地址是http://192.168.0.1

防火墙基本配置

 

 


初始化防火墙: 初始化配置,并设置好防火墙密码,此处用户名admin密码是along@123

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

system-view // 进入系统视图
[USG6000V1] sysname FW1 // 给防火墙命名
[FW1] undo info-center enable // 关闭日志弹出功能
[FW1] quit
language-mode Chinese // 将提示修改为中文
[FW1] web-manager enable // 开启图形管理界面
[FW1] interface GigabitEthernet 0/0/0
[FW1-GigabitEthernet0/0/0] service-manage all permit // 放行该端口的请求

配置内网接口: 配置内网的接口信息,这里包括个GE 1/0/0 and GE 1/0/1这两个内网地址

system-view
[FW1] interface GigabitEthernet 1/0/0
[FW1-GigabitEthernet1/0/0] ip address 192.168.1.1 255.255.255.0
[FW1-GigabitEthernet1/0/0] undo shutdown
[FW1-GigabitEthernet1/0/0] quit

[FW1] interface GigabitEthernet 1/0/1
[FW1-GigabitEthernet1/0/1] ip address 192.168.2.1 255.255.255.0
[FW1-GigabitEthernet1/0/1] undo shutdown
[FW1-GigabitEthernet1/0/1] quit

# -------------------------------------------------------
[FW1] firewall zone trust // 将前两个接口加入trust区域[FW1-zone-trust] add interface GigabitEthernet 1/0/0
[FW1-zone-trust] add interface GigabitEthernet 1/0/1
配置外网接口: 配置外网接口GE 1/0/2接口的IP地址,并将其加入到untrust区域中

[FW1] interface GigabitEthernet 1/0/2 // 选择外网接口
[FW1-GigabitEthernet1/0/2] undo shutdown // 开启外网接口
[FW1-GigabitEthernet1/0/2] ip address 10.10.10.10 255.255.255.0 // 配置IP地址
[FW1-GigabitEthernet1/0/2] gateway 10.10.10.20 // 配置网关
[FW1-GigabitEthernet1/0/2] undo service-manage enable
[FW1-GigabitEthernet1/0/2] quit

# -------------------------------------------------------
[FW1] firewall zone untrust // 选择外网区域
[FW1-zone-untrust] add interface GigabitEthernet 1/0/2 // 将接口加入到此区域
配置安全策略: 配置防火墙安全策略,放行trust(内网)-->untrust(外网)的数据包

[FW1] security-policy // 配置安全策略
[FW1-policy-security] rule name lyshark // 规则名称
[FW1-policy-security-rule-lyshark] source-zone trust // 原安全区域(内部)
[FW1-policy-security-rule-lyshark] destination-zone untrust // 目标安全区域(外部)

[FW1-policy-security-rule-lyshark] source-address any // 原地址区域
[FW1-policy-security-rule-lyshark] destination-address any // 目标地址区域
[FW1-policy-security-rule-lyshark] service any // 放行所有服务
[FW1-policy-security-rule-lyshark] action permit // 放行配置
[FW1-policy-security-rule-lyshark] quit
配置源NAT:配置原NAT地址转换,仅配置源地址访问内网 --> 公网的转换

[FW1] nat-policy // 配置NAT地址转换
[FW1-policy-nat] rule name lyshark // 指定策略名称
[FW1-policy-nat-rule-lyshark] egress-interface GigabitEthernet 1/0/2 // 外网接口IP
[FW1-policy-nat-rule-lyshark] action source-nat easy-ip // 源地址转换
[FW1-policy-nat-rule-lyshark] display this
配置目标NAT: 外网访问10.10.10.10自动映射到内网的192.168.2.1这台主机上

[FW1] firewall zone untrust // 选择外网区域
[FW1-zone-untrust] add interface GigabitEthernet 1/0/2 // 将接口加入到此区域

# ----NAT规则---------------------------------------------------
# 外网主机访问10.10.10.10主机自动映射到内部的192.168.2.2
[FW1] firewall detect ftp
[FW1] nat server lyshark global 10.10.10.10 inside 192.168.2.2 no-reverse

# ----放行规则---------------------------------------------------
[FW1] security-policy // 配置安全策略
[FW1-policy-security] rule name untrs-trs // 规则名称
[FW1-policy-security-rule-lyshark] source-zone untrust // 原安全区域(外部)
[FW1-policy-security-rule-lyshark] destination-zone trust // 目标安全区域(内部)
[FW1-policy-security-rule-lyshark] action permit // 放行配置
[FW1-policy-security-rule-lyshark] quit

NAT地址转换

 

 


联系我们
地址:成都市新南路8号
手机:13808203880
座机:13808203880
联系人:先生
邮箱:Qiu_np@aochinese.com
关注奥华信息