今天浩道跟大家分享關于華為防火墻設備配置大全的硬核干貨,通過本文,即使是小白,也可以掌握華為防火墻配置!
防火墻(Firewall)也稱防護墻,是由Check Point創立者Gil Shwed于1993年發明并引入國際互聯網(US5606668(A)1993-12-15)防火墻是位于內部網和外部網之間的屏障,它按照系統管理員預先定義好的規則來控制數據包的進出。防火墻是系統的第一道防線,其作用是防止非法用戶的進入。
初始化防火墻
初始化防火墻:默認用戶名為admin,默認的密碼Admin@123,這里修改密碼為fox@666.
Username:admin Password:***** The password needstobechanged. Change now? [Y/N]:y Please enter old password: Admin@123 Please enternewpassword: fox@666 Pleaseconfirmnewpassword: fox@666system-view// 進入系統視圖 [FW1] sysname FW1 // 給防火墻命名 [FW1]undoinfo-centerenable // 關閉日志彈出功能 [FW1]quit language-modeChinese // 將提示修改為中文 Changelanguagemode,confirm? [Y/N]y 提示:改變語言模式成功.
開啟Web管理界面:默認防火墻console接口IP地址是192.168.0.1.
system-view [FW1] web-manager enable // 開啟圖形管理界面 [FW1] interface GigabitEthernet0/0/0 [FW1-GigabitEthernet0/0/0] ip address192.168.0.124// 給接口配置IP地址 [FW1-GigabitEthernet0/0/0] service-manageallpermit // 放行該端口的請求 [FW1-GigabitEthernet0/0/0]displaythis
配置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]telnetserverenable// 開啟Telnet支持 [FW1]interfaceGigabitEthernet0/0/0// 選擇配置接口 [FW1-GigabitEthernet0/0/0]service-managetelnetpermit// 允許telnet [FW1-GigabitEthernet0/0/0]quit [FW1]user-interfacevty04// 開啟虛擬終端 [FW1-ui-vty0-4]protocolinboundtelnet// 允許telnet [FW1-ui-vty0-4]authentication-modepassword// 設置為密碼認證模式 [FW1-ui-vty0-4]setauthenticationpasswordcipherAdmin@123// 設置用戶密碼 [USG6000V1]firewallzonetrust// 選擇安全區域 [USG6000V1-zone-trust]addinterfaceGE0/0/0// 添加到安全區域
配置telnet用戶名密碼認證:
system-view// 進入系統視圖 [FW1]interfaceGigabitEthernet0/0/0// 進入接口配置 [FW1-GigabitEthernet0/0/0] ip address192.168.0.124// 配置接口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] addinterfaceGigabitEthernet0/0/0// 把GE0/0/0加入到trust安全域 [FW1-zone-trust] quit [FW1] telnet server enable// 啟用telnet服務 [FW1] user-interfacevty04// 進入vty0-4的用戶配置接口 [FW1-ui-vty0-4] authentication-mode aaa// 使用AAA驗證模式 [FW1-ui-vty0-4] user privilege level3// 配置用戶訪問的命令級別為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-typetelnet// 配置服務類型 [FW1-aaa-manager-user-lyshark] quit// 退出 [FW1-aaa] bind manager-user lyshark role system-admin// 綁定管理員角色 [FW1-aaa] quit// 退出AAA視圖
常用查詢命令:查詢防火墻的其他配置,常用的幾個命令如下.
[FW1]displayip interface brief// 查默認接口信息 [FW1]displayip routing-table// 顯示路由表 [FW1]displayzone// 顯示防火墻區域 [FW1]displayfirewall sessiontable// 顯示當前會話 [FW1]displaysecurity-policy rule all// 顯示安全策略
配置到這里,我們就可以在瀏覽器中訪問了,其訪問地址是http://192.168.0.1
防火墻基本配置
初始化防火墻:初始化配置,并設置好防火墻密碼,此處用戶名admin密碼是fox@666.
Username:admin Password:***** The password needstobechanged. Change now? [Y/N]:y Please enter old password: Admin@123 Please enternewpassword: fox@666 Pleaseconfirmnewpassword: fox@666system-view// 進入系統視圖 [USG6000V1] sysname FW1 // 給防火墻命名 [FW1]undoinfo-centerenable // 關閉日志彈出功能 [FW1]quit language-modeChinese // 將提示修改為中文 [FW1] web-manager enable // 開啟圖形管理界面 [FW1] interface GigabitEthernet0/0/0 [FW1-GigabitEthernet0/0/0] service-manageallpermit // 放行該端口的請求
配置內網接口:配置內網的接口信息,這里包括個GE 1/0/0 and GE 1/0/1這兩個內網地址.
system-view [FW1] interface GigabitEthernet1/0/0 [FW1-GigabitEthernet1/0/0] ip address192.168.1.1255.255.255.0 [FW1-GigabitEthernet1/0/0]undoshutdown [FW1-GigabitEthernet1/0/0]quit [FW1] interface GigabitEthernet1/0/1 [FW1-GigabitEthernet1/0/1] ip address192.168.2.1255.255.255.0 [FW1-GigabitEthernet1/0/1]undoshutdown [FW1-GigabitEthernet1/0/1]quit # ------------------------------------------------------- [FW1] firewall zone trust // 將前兩個接口加入trust區域 [FW1-zone-trust]addinterface GigabitEthernet1/0/0 [FW1-zone-trust]addinterface GigabitEthernet1/0/1
配置外網接口:配置外網接口GE 1/0/2接口的IP地址,并將其加入到untrust區域中.
[FW1]interfaceGigabitEthernet1/0/2// 選擇外網接口 [FW1-GigabitEthernet1/0/2]undoshutdown// 開啟外網接口 [FW1-GigabitEthernet1/0/2]ipaddress10.10.10.10255.255.255.0// 配置IP地址 [FW1-GigabitEthernet1/0/2]gateway10.10.10.20// 配置網關 [FW1-GigabitEthernet1/0/2]undoservice-manageenable [FW1-GigabitEthernet1/0/2]quit #------------------------------------------------------- [FW1]firewallzoneuntrust// 選擇外網區域 [FW1-zone-untrust]addinterfaceGigabitEthernet1/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-addressany// 原地址區域 [FW1-policy-security-rule-lyshark]destination-addressany// 目標地址區域 [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]rulenamelyshark// 指定策略名稱 [FW1-policy-nat-rule-lyshark]egress-interfaceGigabitEthernet1/0/2// 外網接口IP [FW1-policy-nat-rule-lyshark]actionsource-nateasy-ip// 源地址轉換 [FW1-policy-nat-rule-lyshark]displaythis
配置目標NAT:外網訪問10.10.10.10自動映射到內網的192.168.2.1這臺主機上.
[FW1]firewallzoneuntrust// 選擇外網區域 [FW1-zone-untrust]addinterfaceGigabitEthernet1/0/2// 將接口加入到此區域 #----NAT規則--------------------------------------------------- # 外網主機訪問10.10.10.10主機自動映射到內部的192.168.2.2 [FW1]firewalldetectftp [FW1]natserverlysharkglobal10.10.10.10inside192.168.2.2no-reverse #----放行規則--------------------------------------------------- [FW1]security-policy// 配置安全策略 [FW1-policy-security]rulenameuntrs-trs// 規則名稱 [FW1-policy-security-rule-lyshark]source-zoneuntrust// 原安全區域(外部) [FW1-policy-security-rule-lyshark]destination-zonetrust// 目標安全區域(內部) [FW1-policy-security-rule-lyshark]actionpermit// 放行配置 [FW1-policy-security-rule-lyshark]quit
NAT 地址轉換
配置內網區域:分別配置防火墻內網接口GE1/0/0 and GE1/0/1設置IP地址,并加入指定區域內.
system-view [FW1]undoinfo-centerenable # ----配置IP地址----------------------------------------------- [FW1] interface GigabitEthernet1/0/0 [FW1-GigabitEthernet1/0/0] ip address192.168.1.124 [FW1-GigabitEthernet1/0/0]quit [FW1] interface GigabitEthernet1/0/1 [FW1-GigabitEthernet1/0/1] ip address192.168.2.124 [FW1-GigabitEthernet1/0/1]quit # ----加入到指定區域-------------------------------------------- [FW1] firewall zone trust [FW1-zone-trust]addinterface GigabitEthernet1/0/0 [FW1] firewall zone dmz [FW1-zone-dmz]addinterface GigabitEthernet1/0/1
配置外網區域:然后配置外網地址,將Gig 1/0/2加入到untrust區域內.
[FW1]interfaceGigabitEthernet1/0/2 [FW1-GigabitEthernet1/0/2]ipaddress10.10.10.108 [FW1]firewallzoneuntrust [FW1-zone-dmz]addinterfaceGigabitEthernet1/0/2
配置源NAT:配置原NAT地址轉換,僅配置源地址訪問內網 --> 公網的轉換.
#----配置源NAT轉換--------------------------------------------- [FW1]nat-policy// 配置NAT地址轉換 [FW1-policy-nat]rulenamelyshark// 指定策略名稱 [FW1-policy-nat-rule-lyshark]egress-interfaceGigabitEthernet1/0/2// 外網接口IP [FW1-policy-nat-rule-lyshark]actionsource-nateasy-ip// 源地址轉換 [FW1-policy-nat-rule-lyshark]displaythis #----放行相關安全策略------------------------------------------ [FW1]security-policy [FW1-policy-security]rulenametrust_untrust [FW1-policy-security-rule]source-zonetrust [FW1-policy-security-rule]destination-zoneuntrust [FW1-policy-security-rule]actionpermit
配置目標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 lysharkglobal10.10.10.10inside192.168.2.2no-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-address192.168.2.224 [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] vlan10// 創建VLAN10 [LSW1]quit [LSW1] interface Ethernet0/0/1// 將該接口配置為trunk [LSW1-Ethernet0/0/1] port link-typetrunk [LSW1-Ethernet0/0/1] port trunk allow-pass vlan10// 加入到vlan10 [LSW1-Ethernet0/0/1]quit [LSW1] port-group group-member Eth0/0/2toEth0/0/3 [LSW1-port-group] port link-typeaccess [LSW1-port-group] port default vlan10 [LSW1-port-group]quit # ----配置LSW2交換機-------------------------------------------- system-view [LSW2] vlan20 [LSW1]quit [LSW2] interface Ethernet0/0/1 [LSW2-Ethernet0/0/1] port link-typetrunk [LSW2-Ethernet0/0/1] port trunk allow-pass vlan20 [LSW2-Ethernet0/0/1]quit [LSW2] port-group group-member Eth0/0/2toEth0/0/3 [LSW2-port-group] port link-typeaccess [LSW2-port-group] port default vlan20 [LSW2-port-group]quit
配置防火墻:配置Gig1/0/0和Gig1/0/1接口為trunk模式,并分別配置好網關地址.
[FW1]vlan10 [FW1-vlan10]quit [FW1]vlan20 [FW1-vlan20]quit #----配置防火墻接口地址----------------------------------------- [FW1]interfaceGigabitEthernet1/0/0 [FW1-GigabitEthernet1/0/0]portswitch [FW1-GigabitEthernet1/0/0]portlink-typetrunk [FW1-GigabitEthernet1/0/0]porttrunkallow-passvlan10 [FW1]interfaceGigabitEthernet1/0/1 [FW1-GigabitEthernet1/0/1]portswitch [FW1-GigabitEthernet1/0/1]portlink-typetrunk [FW1-GigabitEthernet1/0/1]porttrunkallow-passvlan20 #----分別給VLAN配置IP地址--------------------------------------- [FW1]interfaceVlanif10 [FW1-Vlanif10] [FW1-Vlanif10]ipaddress192.168.10.1255.255.255.0 [FW1-Vlanif10]aliasvlan10 [FW1-Vlanif10]service-managepingpermit [FW1]interfaceVlanif20 [FW1-Vlanif20] [FW1-Vlanif20]ipaddress192.168.20.1255.255.255.0 [FW1-Vlanif20]aliasvlan20 [FW1-Vlanif20]service-managepingpermit
添加防火墻區域:將vlan10和vlan20添加到trust區域內.
[FW1]firewall zone trust [FW1-zone-trust]add interface Vlanif 10 [FW1-zone-trust]add interface Vlanif 20
主備雙機熱備
放行所有數據包(兩臺墻):為了演示實驗,需要手動放行數據包
#------------------------------------------------------------ # 將默認防火墻規則,設置為允許所有 [FW1]security-policy [FW1-policy-security]rulenameanyall// 指定規則名稱 [FW1-policy-security-rule-anyall]source-zoneany// 源地址允許所有 [FW1-policy-security-rule-anyall]destination-zoneany// 目標地址允許所有 [FW1-policy-security-rule-anyall]actionpermit// 放行 [FW1-policy-security-rule-anyall]quit [FW1-policy-security]quit #------------------------------------------------------------ # 將指定的接口加入到指定的區域內 [FW1]firewallzonetrust// 選擇trust區域 [FW1-zone-trust]addinterfaceGigabitEthernet1/0/0// 添加內部的端口 [FW1-zone-trust]quit [FW1]firewallzoneuntrust// 添加untru區域 [FW1-zone-untrust]addinterfaceGigabitEthernet1/0/1// 添加外部接口 [FW1-zone-trust]quit
配置IP地址(兩臺) :給防火墻的兩個接口配置好IP地址.
#------------------------------------------------------------ # 配置防火墻FW1 [FW1]interfaceGigabitEthernet1/0/0// 選擇內部接口 [FW1-GigabitEthernet1/0/0]ipaddress192.168.1.25324// 配置防火墻IP [FW1-GigabitEthernet1/0/0]service-managepingpermit// 開啟接口ping [FW1-GigabitEthernet1/0/0]quit [FW1]interfaceGigabitEthernet1/0/1 [FW1-GigabitEthernet1/0/1]ipaddress10.10.10.208 [FW1-GigabitEthernet1/0/1]service-managepingpermit [FW1-GigabitEthernet1/0/1]quit #------------------------------------------------------------ # 配置防火墻FW2 [FW2]interfaceGigabitEthernet1/0/0// 選擇內部接口 [FW2-GigabitEthernet1/0/0]ipaddress192.168.1.25424// 配置防火墻IP [FW2-GigabitEthernet1/0/0]service-managepingpermit// 開啟接口ping [FW2-GigabitEthernet1/0/0]quit [FW2-GigabitEthernet1/0/0]quit [FW2]interfaceGigabitEthernet1/0/1 [FW2-GigabitEthernet1/0/1]ipaddress10.10.10.308 [FW2-GigabitEthernet1/0/1]service-managepingpermit [FW2-GigabitEthernet1/0/1]quit
開啟源NAT地址:將內網數據映射到外網.
#------------------------------------------------------------ # 配置防火墻FW1 [FW1]nat-policy// 配置NAT地址轉換 [FW1-policy-nat]rulenametru_untr// 指定策略名稱 [FW1-policy-nat-rule-tru_untr]egress-interfaceGigabitEthernet1/0/1// 外網接口IP [FW1-policy-nat-rule-tru_untr]actionsource-nateasy-ip// 源地址轉換 [FW1-policy-nat-rule-tru_untr]displaythis #------------------------------------------------------------ # 配置防火墻FW2 [FW2]nat-policy// 配置NAT地址轉換 [FW2-policy-nat]rulenametru_untr// 指定策略名稱 [FW2-policy-nat-rule-tru_untr]egress-interfaceGigabitEthernet1/0/1// 外網接口IP [FW2-policy-nat-rule-tru_untr]actionsource-nateasy-ip// 源地址轉換 [FW2-policy-nat-rule-tru_untr]displaythis
開啟VRRP支持(兩臺)
#------------------------------------------------------------ # 配置防火墻FW1 [FW1]interfaceGigabitEthernet1/0/0// 選擇內部接口 [FW1-GigabitEthernet1/0/0]vrrpvrid1virtual-ip192.168.1.1active// 配置虛擬接口為主 [FW1-GigabitEthernet1/0/0]quit [FW1]interfaceGigabitEthernet1/0/1// 選擇外部接口 [FW1-GigabitEthernet1/0/1]vrrpvrid2virtual-ip10.10.10.10active [FW1-GigabitEthernet1/0/1]quit #------------------------------------------------------------ # 配置防火墻FW12 [FW2]interfaceGigabitEthernet1/0/0// 選擇內部接口 [FW2-GigabitEthernet1/0/0]vrrpvrid1virtual-ip192.168.1.1standby// 配置虛擬接口為備 [FW2-GigabitEthernet1/0/0]quit [FW2]interfaceGigabitEthernet1/0/1 [FW2-GigabitEthernet1/0/1]vrrpvrid2virtual-ip10.10.10.10standby [FW2-GigabitEthernet1/0/1]quit
HRP配置(兩臺):
#------------------------------------------------------------ # 配置防火墻FW1 [FW1]hrpenable HRP_S[FW1]hrpinterfaceGigabitEthernet0/0/0remote172.16.1.2// 指定接口和對端IP HRP_M[FW1]interfaceGigabitEthernet0/0/0// 選擇虛擬接口 HRP_M[FW1-GigabitEthernet0/0/0]ipaddress172.16.1.124// 配置本端IP地址 #------------------------------------------------------------ # 配置防火墻FW2 [FW2]hrpenable HRP_S[FW2]hrpstandby-device HRP_S[FW2]hrpinterfaceGigabitEthernet0/0/0remote172.16.1.1 HRP_S[FW2]interfaceGigabitEthernet0/0/0 HRP_S[FW2-GigabitEthernet0/0/0]ipaddress172.16.1.224
檢查配置:
注意1:默認處于 standby 狀態的設備不允許配置安全策略,只允許在主設
備配置安全策略,且安全策略會自動同步到備設備上面。
開啟命令:hrp standby config enable
HRP_M[FW1] display hrp state Role: active, peer: standby Running priority: 45000, peer: 45000 Core state: normal, peer: normal Backupchannelusage:0.00% Stabletime:0days,0hours,0minutes Laststatechangeinformation:2019-05-061:37:41HRP core statechanged, old_s tate = abnormal(active), new_state =normal, local_priority =45000, peer_priori ty =45000. HRP_S[FW2] display hrp state Role:standby, peer: active Runningpriority:45000, peer:45000 Core state:normal, peer:normal Backupchannelusage:0.00% Stabletime:0days,0hours,1minutes Laststatechangeinformation:2019-05-061:37:42HRPlinkchangestoup.
配置負載均衡
配置防火墻接口:
[FW1]interfaceGigabitEthernet1/0/0 [FW1-GigabitEthernet1/0/0]ipaddress192.168.1.124 [FW1-GigabitEthernet1/0/0]service-managepingpermit [FW1-GigabitEthernet1/0/0]service-managehttppermit [FW1-GigabitEthernet1/0/0]quit [FW1]interfaceGigabitEthernet1/0/1 [FW1-GigabitEthernet1/0/1]ipaddress10.10.10.108 [FW1-GigabitEthernet1/0/1]service-managepingpermit [FW1-GigabitEthernet1/0/1]service-managehttppermit [FW1-GigabitEthernet1/0/1]quit
加入相應的區域內:
[FW1]firewallzonetrust [FW1-zone-trust]addinterfaceGigabitEthernet1/0/0 [FW1-zone-trust]quit [FW1]firewallzoneuntrust [FW1-zone-untrust]addinterfaceGigabitEthernet1/0/1 [FW1-zone-untrust]quit
放行數據包:
[FW1]security-policy [FW1-policy-security]rule name any_trust [FW1-policy-security-rule-any_trust]source-zone any [FW1-policy-security-rule-any_trust]destination-zone trust [FW1-policy-security-rule-any_trust]service http [FW1-policy-security-rule-any_trust]service icmp [FW1-policy-security-rule-any_trust]action permit
配置負載均衡:
[FW1] slb enable// 啟用SLB服務 [FW1] slb// 進入SLB配置視圖 [FW1-slb]group1WebServer// 創建服務器組webServer [FW1-slb-group-1] metric weight-least-connection// 使用加權輪詢算法 # ------------------------------------------------------- // 以下為真實服務設置 IP地址 端口 權重值 別名// [FW1-slb-group-1] rserver1rip192.168.1.2port80weight1description server1 [FW1-slb-group-1] rserver2rip192.168.1.3port80weight1description server2 [FW1-slb-group-1] rserver3rip192.168.1.3port80weight1description server3 [FW1-slb-group-1] [FW1-slb-group-1] health-check type icmp tx-interval5times3// 配置服務健康檢查參數 [FW1-slb-group-1] persistence type source-ip aging-time180// 配置會話保持時間 [FW1-slb-group-1] quit// 返回SLB視圖 [FW1-slb] [FW1-slb] vserver1WebServer// 創建虛擬服務器WebServer [FW1-slb-vserver-1] protocol tcp// 配置虛擬服務器的協議類型 [FW1-slb-vserver-1] vip110.10.10.100// 設置虛擬服務器IP地址 [FW1-slb-vserver-1] vport80// 設置虛擬服務器端 [FW1-slb-vserver-1]groupWebServer// 關聯真實服務器組 [FW1-slb-vserver-1] quit// 返回SLB視圖
-
華為
+關注
關注
216文章
34957瀏覽量
254815 -
互聯網
+關注
關注
54文章
11222瀏覽量
105376 -
防火墻
+關注
關注
0文章
428瀏覽量
36040
原文標題:不懂華為防火墻配置?看這篇就會了!
文章出處:【微信號:浩道linux,微信公眾號:浩道linux】歡迎添加關注!文章轉載請注明出處。
發布評論請先 登錄
發現 STM32 防火墻的安全配置
談防火墻及防火墻的滲透技術
防火墻的控制端口
什么是防火墻?防火墻如何工作?
東用科技與華為防火墻構建IPSec VPN配置指導手冊

評論