【網(wǎng)絡(luò)】華三防火墻命令行調(diào)試實例

華三防火墻作為互聯(lián)網(wǎng)出口常見配置

1.案例分析

在這里插入圖片描述這是一個典型的無DMZ區(qū)網(wǎng)絡(luò),通常發(fā)生在業(yè)主僅僅只有上外網(wǎng)需求的情況下。

我的規(guī)劃是:

1.互聯(lián)網(wǎng)交換機到內(nèi)網(wǎng)主機這一塊區(qū)域使用默認vlan1,以方便業(yè)主后期上網(wǎng)主機增多的情況。

2.互聯(lián)網(wǎng)防火墻到互聯(lián)網(wǎng)交換機之間使用vlan2,互聯(lián)地址為172.16.0.1和172.16.0.2

3.互聯(lián)網(wǎng)防火墻和互聯(lián)網(wǎng)交換機之間使用2層 access 口互聯(lián)。

4.互聯(lián)網(wǎng)交換機搭建dhcp服務(wù)器,分配地址段172.16.1.1/24 ,網(wǎng)關(guān)為172.16.1.254 ,dns地址為114.114.114.114 和 114.114.114.115,使用一天的租期

5.公網(wǎng)地址為100.1.1.1 和100.1.1.2

規(guī)劃圖如下:


2.實戰(zhàn)開始:

2.1.配置互聯(lián)網(wǎng)交換機

2.1.1互聯(lián)網(wǎng)交換機DHCP功能

dhcp 配置:

------------------------------------------------------------------------------------------------------------------------------

<H3C>sys

#進入系統(tǒng)視圖? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

[H3C]dhcp? enable

#啟動DHCP服務(wù)? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

[H3C]dhcp server ip-pool 1

#創(chuàng)建DHCP服務(wù)地址池1? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

[H3C-dhcp-pool-1]network 172.16.1.1 mask? 255.255.255.0? ? ? ? ?

# 配置DHCP地址池1使用網(wǎng)段172.16.1.0 使用掩碼255.255.255.0

[H3C-dhcp-pool-1]gateway-list? 172.16.1.254? ? ? ? ? ? ? ? ? ? ?

# 配置DHCP地址池1使用網(wǎng)關(guān)地址 172.16.1.254

[H3C-dhcp-pool-1]dns-list? 114.114.114.114 114.114.114.115? ? ?

#配置DHCP地址池1分配dns地址 114.114.114.114? 114.114.114.115

[H3C-dhcp-pool-1]expired day? 1? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

#配置DHCP地址池1分配地址租期為1天

[H3C]interface? Vlan-interface? 1   ? ? ? ? ? ? ? ? ? ? ? ? ?

#進入三層vlan1口

[H3C-Vlan-interface1]ip address? 172.16.1.254 24   ? ? ? ? ? ?

#配置三層vlan口1使用IP地址:172.16.1.254 使用掩碼24位

[H3C-Vlan-interface1]dhcp select server? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

#配置三層vlan口1 啟用DHCP服務(wù)器

[H3C-Vlan-interface1]dhcp server apply? ip-pool? 1? ? ? ? ? ? ? ? ? ? ?

#配置三層vlan口1分配DHCP服務(wù)器分配地址池1

[H3C-Vlan-interface1]quit? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

#退出三層vlan口1

-------------------------------------------------------------------------------------------------------------------------------

2.1.2 互聯(lián)網(wǎng)交換機互聯(lián)地址及路由配置

--------------------------------------------------------------------------------------------------------------------------------

[H3C]vlan 2? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

#創(chuàng)建vlan2

[H3C-vlan2]quit? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

#退出vlan2

[H3C]interface? Vlan-interface 2? ? ? ? ? ? ? ? ? ? ? ? ?

#進入三層vlan2口

[H3C-Vlan-interface2]ip address 172.16.0.2 30? ? ? ? ? ? ?

#給三層vlan2口配置IP地址172.16.0.2使用掩碼長度30位

[H3C-Vlan-interface2]quit? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

#推出三層vlan2口

[H3C]interface? GigabitEthernet? 1/0/1? ? ? ? ? ? ? ? ? ?

#進入接口千兆以太網(wǎng)1/0/1

[H3C-GigabitEthernet1/0/1]port link-mode bridge? ? ? ? ? ?

#配置千兆以太網(wǎng)口1/0/1,端口模式位橋接

[H3C-GigabitEthernet1/0/1]port link-type access? ? ? ? ? ?

#配置千兆以太網(wǎng)口1/0/1,端口鏈路類型位access

[H3C-GigabitEthernet1/0/1]port access? vlan? 2? ? ? ? ? ?

#配置千兆以太網(wǎng)口1/0/1,access端口使用vlan2

[H3C-GigabitEthernet1/0/1]quit? ? ? ? ? ? ? ? ? ? ? ? ? ?

#推出千兆以太網(wǎng)口1/0/1

[H3C]ip route-static 0.0.0.0 0 172.16.0.1? ? ? ? ? ? ? ? ?

#配置IP靜態(tài)路由去往所有網(wǎng)段,所有掩碼的下一條地址位172.16.0.1

--------------------------------------------------------------------------------------------------------------------------------

2.2 配置防火墻

提示:華三防火墻默認用戶名為:admin 密碼為:admin

2.2.1 配置接口地址及路由

---------------------------------------------------------------------------------------------------------------------------------

<H3C>sys? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

#進入系統(tǒng)視圖

[H3C]vlan 2? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

#創(chuàng)建vlan2

[H3C-vlan2]quit? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

#退出vlan2

[H3C]interface? Vlan-interface? 2? ? ? ? ? ? ? ? ? ?

#進入三層vlan2口

[H3C-Vlan-interface2]ip address 172.16.0.1 30? ? ? ?

#給三層vlan2口配置IP地址172.16.0.1使用掩碼長度30位

[H3C-Vlan-interface2]quit? ? ? ? ? ? ? ? ? ? ? ? ? ?

#退出三層vlan2口

[H3C]interface? GigabitEthernet? 1/0/1? ? ? ? ? ? ?

#進入接口千兆以太網(wǎng)1/0/1

[H3C-GigabitEthernet1/0/1]port link-mode bridge? ?

#配置千兆以太網(wǎng)口1/0/1,端口模式位橋接

[H3C-GigabitEthernet1/0/1]port link-type access? ? ?

#配置千兆以太網(wǎng)口1/0/1,端口鏈路類型位access

[H3C-GigabitEthernet1/0/1]port access vlan? 2? ? ?

#配置千兆以太網(wǎng)口1/0/1,access端口使用vlan2

[H3C-GigabitEthernet1/0/1]quit? ? ? ? ? ? ? ? ? ? ?

#退出千兆以太網(wǎng)口1/0/1

[H3C]ip route-static 172.16.1.0 24 172.16.0.2? ? ? ?

#配置IP靜態(tài)路由去往網(wǎng)段172.16.1.0,子網(wǎng)掩碼為24的網(wǎng)絡(luò) 的下一條地址位172.16.0.2

[H3C]interface? Vlan-interface? 1? ? ? ? ? ? ? ? ?

#進入三層vlan1口

[H3C-Vlan-interface1]ip address100.1.1.2 30? ? ? ?

#給三層vlan1口配置IP地址172.16.0.1使用掩碼長度30位

[H3C-Vlan-interface1]quit? ? ? ? ? ? ? ? ? ? ? ? ? ?

#退出三層vlan1口

[H3C]interface? GigabitEthernet? 1/0/0? ? ? ? ? ? ?

#進入接口千兆以太網(wǎng)1/0/0

[H3C-GigabitEthernet1/0/0]port link-mode bridge? ? ?

#配置千兆以太網(wǎng)口1/0/0,端口模式位橋接

[H3C-GigabitEthernet1/0/1]port link-type access? ?

#配置千兆以太網(wǎng)口1/0/0,端口鏈路類型位access

[H3C-GigabitEthernet1/0/0]quit? ? ? ? ? ? ? ? ? ? ?

#退出千兆以太網(wǎng)口1/0/0

[H3C]ip route-static 0.0.0.0 0 100.1.1.1? ? ? ? ? ?

#配置IP靜態(tài)路由去往所有網(wǎng)段,所有掩碼的下一條地址為100.1.1.1

---------------------------------------------------------------------------------------------------------------------------

2.2.2 配置安全區(qū)域及策略

---------------------------------------------------------------------------------------------------------------------------

[H3C]security-zone name Trust? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

#進入安全區(qū)域Trust區(qū)域(信任區(qū)域)

[H3C-security-zone-Trust]import? interface? Vlan-interface? 2? ? ? ? ? ? ? ?

#在安全區(qū)域Trust區(qū)域中引入三層vlan2口

[H3C-security-zone-Trust]quit? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

#退出安全區(qū)域Trust區(qū)域

[H3C]security-zone name? Untrust? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

#進入安全區(qū)域Untrust區(qū)域(非信任區(qū)域)

[H3C-security-zone-Untrust]import? interface? Vlan-interface? 1? ? ? ? ? ? ?

#在安全區(qū)域Untrust區(qū)域中引入三層vlan1口

[H3C-security-zone-Untrust]quit? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

#退出安全區(qū)域Untrust區(qū)域

[H3C]object-group ip address? 1? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

#創(chuàng)建策略對象ip地址組1

[H3C-obj-grp-ip-1]network? subnet? 172.16.1.1 24? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

#配置測了對象組1的網(wǎng)段為172.16.1.1 掩碼為24位

[H3C-obj-grp-ip-1]quit? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

#退出策略對象組1

[H3C]object-policy ip nat? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

#創(chuàng)建ipv4對象策略nat

[H3C-object-policy-ip-nat]rule pass source-ip? 1? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

#配置ipv4對象策略nat ,規(guī)則位允許通過源ip位策略對象組1

[H3C-object-policy-ip-nat]quit? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

#退出ipv4對象策略nat? ? ? ? ?

[H3C]zone-pair? security? source? Trust destination? Untrust? ? ? ? ? ? ? ? ?

#配置從Trust到UnTrust的區(qū)域安全

[H3C-zone-pair-security-Trust-Untrust]object-policy? apply? ip nat? ? ? ? ? ?

#配置從Trust到UnTrust的區(qū)域安全,應(yīng)用ipv4對象策略nat

------------------------------------------------------------------------------------------------------------------------? ?

3.代碼共享

3.1 互聯(lián)網(wǎng)交換機配置代碼

--------------------------------------------------------------------------------------------------------------------------

sys

dhcp? enable

dhcp server ip-pool 1

network 172.16.1.1 mask? 255.255.255.0

gateway-list? 172.16.1.254

dns-list? 114.114.114.114 114.114.114.115

expired day? 1

interface? Vlan-interface? 1

ip address? 172.16.1.254 24

dhcp server apply? ip-pool? 1

dhcp select server

quit

vlan 2

quit

interface? Vlan-interface 2

ip address 172.16.0.2 30

quit

interface? GigabitEthernet? 1/0/1

port link-mode bridge

port link-type access

port access? vlan? 2

quit? ? ?

ip route-static 0.0.0.0 0 172.16.0.1

-------------------------------------------------------------------------------------------------------------------------?

3.2 互聯(lián)網(wǎng)防火墻代碼

-------------------------------------------------------------------------------------------------------------------------

sys

vlan 2

quit

interface? Vlan-interface? 2

ip address 172.16.0.1 30

quit

interface? GigabitEthernet? 1/0/1

port link-mode bridge

port link-type access

port access vlan? 2

quit

ip route-static 172.16.1.1 24 172.16.0.2

vlan 1

quit

interface? Vlan-interface? 1

ip add 100.1.1.2 30

quit

interface? GigabitEthernet? 1/0/0

port link-mode bridge

port link-type access

quit

ip route-static 0.0.0.0 0 100.1.1.1

security-zone name Trust

import? interface? Vlan-interface? 2

security-zone name? Untrust

import? interface? Vlan-interface? 1

object-group ip address? 1

network? subnet? 172.16.1.1 24

quit

object-policy ip nat

rule pass source-ip? 1

quit

zone-pair? security? source? Trust destination? Untrust

object-policy? apply? ip nat

acl? basic? 2000

rule permit? source? 172.16.1.1 0.0.0.255

quit

interface Vlan-interface? 1

nat outbound? 2000

--------------------------------------------------------------------------------------------------------------------------

原文鏈接:https://blog.csdn.net/qq_43017750/article/details/87557118

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容