前言
今天浩道跟大家分享硬核干货,关于华为防火墙相关的实战配置!
防火墙是位于内部网和外部网之间的屏障,它按照系统管理员预先定义好的规则来控制数据包的进出。防火墙是系统的第一道防线,其作用是防止非法用户的进入。
本期我们一起来总结下防火墙的配置,非常全面,以华为为例。
防火墙的配置主要有下面这些:
初始化防火墙
初始化防火墙:
开启web管理界面:
配置console口登陆:
配置telnet密码认证:
配置telnet用户名密码认证:
常用查询命令:
防火墙基本配置
初始化防火墙:
配置内网接口:
配置外网接口:
配置安全策略:
配置源nat:
配置目标nat:
nat 地址转换
配置内网区域:
配置外网区域:
配置源nat:
配置目标nat:
配置交换机
配置两台交换机:
配置防火墙:
添加防火墙区域:
一、初始化防火墙
一、初始化防火墙
默认用户名为admin,默认的密码admin@123,这里修改密码为wljsghq@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: lyshark@163 please confirm new password: lyshark@163
system-view // 进入系统视图 [fw1] sysname fw1 // 给防火墙命名 [fw1] undo info-center enable // 关闭日志弹出功能 [fw1] quit language-mode chinese // 将提示修改为中文 change language mode, confirm? [y/n] 提示:变语言模式成功
二、开启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.
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
二、防火墙基本配置
初始化防火墙: 初始化配置,并设置好防火墙密码。
username:adminpassword:*****the password needs to be changed. change now? [y/n]: yplease enter old password: admin@123please enter new password: lyshark@163please confirm new password: lyshark@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
三、nat地址转换
配置内网区域: 分别配置防火墙内网接口ge1/0/0 and ge1/0/1设置ip地址,并加入指定区域内.
system-view[fw1]undo info-center enable# ----配置ip地址-----------------------------------------------[fw1] interface gigabitethernet 1/0/0[fw1-gigabitethernet1/0/0] ip address 192.168.1.1 24[fw1-gigabitethernet1/0/0] quit[fw1] interface gigabitethernet 1/0/1[fw1-gigabitethernet1/0/1] ip address 192.168.2.1 24[fw1-gigabitethernet1/0/1] quit# ----加入到指定区域--------------------------------------------[fw1] firewall zone trust[fw1-zone-trust] add interface gigabitethernet 1/0/0[fw1] firewall zone dmz [fw1-zone-dmz] add interface gigabitethernet 1/0/1
配置外网区域: 然后配置外网地址,将gig 1/0/2加入到untrust区域内.
[fw1] interface gigabitethernet 1/0/2[fw1-gigabitethernet1/0/2] ip address 10.10.10.10 8[fw1] firewall zone untrust [fw1-zone-dmz] add interface gigabitethernet 1/0/2
配置源nat: 配置原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# ----放行相关安全策略------------------------------------------[fw1] security-policy[fw1-policy-security] rule name trust_untrust[fw1-policy-security-rule] source-zone trust[fw1-policy-security-rule] destination-zone untrust [fw1-policy-security-rule] action permit
配置目标nat: 外网访问10.10.10.10自动映射到内网的192.168.2.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-dmz // 规则名称[fw1-policy-security-rule-untrs-dmz] source-zone untrust // 原安全区域(外部)[fw1-policy-security-rule-untrs-dmz] destination-zone trust // 目标安全区域(内部)[fw1-policy-security-rule-untrs-dmz] destination-address 192.168.2.2 24[fw1-policy-security-rule-untrs-dmz] service any[fw1-policy-security-rule-untrs-dmz] action permit // 放行配置 [fw1-policy-security-rule-untrs-dmz] quit
四、配置交换机、防火墙
配置两台交换机: 分别配置两台交换机,并划分到相应的vlan区域内.
# ----配置lsw1交换机 system-view[lsw1] vlan 10 // 创建vlan10[lsw1] quit[lsw1] interface ethernet 0/0/1 // 将该接口配置为trunk[lsw1-ethernet0/0/1] port link-type trunk[lsw1-ethernet0/0/1] port trunk allow-pass vlan 10 // 加入到vlan 10[lsw1-ethernet0/0/1] quit[lsw1] port-group group-member eth0/0/2 to eth0/0/3[lsw1-port-group] port link-type access[lsw1-port-group] port default vlan 10[lsw1-port-group] quit# ----配置lsw2交换机 system-view[lsw2] vlan 20[lsw1] quit[lsw2] interface ethernet 0/0/1[lsw2-ethernet0/0/1] port link-type trunk[lsw2-ethernet0/0/1] port trunk allow-pass vlan 20[lsw2-ethernet0/0/1] quit[lsw2] port-group group-member eth0/0/2 to eth0/0/3[lsw2-port-group] port link-type access[lsw2-port-group] port default vlan 20 [lsw2-port-group] quit
配置防火墙: 配置gig1/0/0和gig1/0/1接口为trunk模式,并分别配置好网关地址.
[fw1] vlan 10[fw1-vlan10] quit[fw1] vlan 20[fw1-vlan20] quit# ----配置防火墙接口地址[fw1] interface gigabitethernet 1/0/0[fw1-gigabitethernet1/0/0] portswitch[fw1-gigabitethernet1/0/0] port link-type trunk[fw1-gigabitethernet1/0/0] port trunk allow-pass vlan 10[fw1] interface gigabitethernet 1/0/1[fw1-gigabitethernet1/0/1] portswitch[fw1-gigabitethernet1/0/1] port link-type trunk[fw1-gigabitethernet1/0/1] port trunk allow-pass vlan 20# ----分别给vlan配置ip地址[fw1]interface vlanif 10[fw1-vlanif10][fw1-vlanif10]ip address 192.168.10.1 255.255.255.0[fw1-vlanif10]alias vlan 10[fw1-vlanif10]service-manage ping permit[fw1] interface vlanif 20[fw1-vlanif20][fw1-vlanif20] ip address 192.168.20.1 255.255.255.0[fw1-vlanif20] alias vlan 20 [fw1-vlanif20] service-manage ping permit
添加防火墙区域: 将vlan10和vlan20添加到trust区域内.
[fw1]firewall zone trust[fw1-zone-trust] add interface vlanif 10 [fw1-zone-trust] add interface vlanif 20
激光焊锡机如何解决PCB频射天线的焊接难点
手机厂家纷纷涨价全是因为它
安全地毯和安全光幕的区别及用途
用于能量收集应用设计的开发套件介绍
对存储基础设施重构 释放数据红利与价值
关于华为防火墙相关的实战配置
关于无线音频安全技术方案解析
极智嘉荣膺全球最具创新力机器人公司TOP10
家电行业的内卷!Pre-EMI 预一致性,怎么都在用?
如何解开机密码
RS485有线采集电磁水表数据概述
成都移动携手华为等公司在成都青羊区开通了全球首个4/5G双模BookRRU
安华高科技是哪国的
基于aTCA架构的IPTV CDN应用
努比亚发布会将发布Wi-Fi 6游戏路由器、无线蓝牙耳机等
2009年半导体产业二十大预言(下篇)
物联网技术标准研究成果发布 有方科技管道云影响力凸显
小米5C明日发售:小米超美小屏旗舰,除了惊艳还是惊艳!
敲黑板:硬知识第一波!不懂这些,你的车随时会翻!
并联和串联基准电压源的工作原理