上一篇文章中,我們講述了雙防火墻的基礎(chǔ)配置,也就是利用心跳線配置防火墻的HRP,發(fā)生故障的時(shí)候,自動(dòng)切換。
由于核心交換機(jī)還沒(méi)配置完成,所以也不便測(cè)試,今天這篇文章會(huì)完結(jié),所以后面會(huì)有故障測(cè)試的截圖。
照顧到?jīng)]看上一篇文章的讀者,還是要把拓?fù)鋱D貼一下,便于文章的閱讀。
重申一下,上圖中,AR1代表運(yùn)營(yíng)商雙出口網(wǎng)絡(luò),事實(shí)上并不存在這臺(tái)設(shè)備;并且,銀行也并沒(méi)有采用PPPOE鏈路,只是為了順便展示一下PPPOE的配置而已。
兩臺(tái)華為的防火墻,fw1為主,fw2為備;兩臺(tái)華為核心交換機(jī),沒(méi)有采用堆疊技術(shù),而是采用VRRP技術(shù)進(jìn)行配置。
[SW1]int Eth-Trunk 12
[SW1-Eth-Trunk12]mode lacp-static //兩臺(tái)核心交換機(jī)配置eth-trunk,并且設(shè)定聚合模式
[SW1-Eth-Trunk12]trunkport GigabitEthernet 0/0/2 to 0/0/3
[SW1-Eth-Trunk12]q
[SW1]vlan batch 10 20 100 //創(chuàng)建VLAN
[SW1]port-group group-member Eth-Trunk 12 GigabitEthernet 0/0/1 g0/0/4 g0/0/5
[SW1-port-group]p l t //網(wǎng)絡(luò)設(shè)備之間的連接接口配置為trunk模式
[SW1-port-group]p t a v a //允許所有VLAN通過(guò)
[SW1-port-group]quit
[SW1]int g0/0/6
[SW1-GigabitEthernet0/0/6]p l a //6口和7口配置為access模式,并且劃在VLAN100內(nèi)
[SW1-GigabitEthernet0/0/6]p d v 100
[SW1-GigabitEthernet0/0/6]q
[SW1]int g0/0/7
[SW1-GigabitEthernet0/0/7]p l a
[SW1-GigabitEthernet0/0/7]p d v 100
[SW1-GigabitEthernet0/0/7]q
核心2的配置,基本上差不多,就不再重復(fù)了,下面兩臺(tái)接入層的交換機(jī),也很簡(jiǎn)單
[SW3]vlan batch 10 20 100
[SW3]port-group group-member e0/0/1 e0/0/2
[SW3-port-group]p l t
[SW3-port-group]p t a v a
[SW3-port-group]q
[SW3]int e0/0/3
[SW3-Ethernet0/0/3]p l a
[SW3-Ethernet0/0/3]p d v 10
[SW3-Ethernet0/0/3]q
[SW4]vlan batch 10 20 100
[SW4]port-group group-member e0/0/1 e0/0/2
[SW4-port-group]p l t
[SW4-port-group]p t a v a
[SW4-port-group]q
[SW4]port-group group-member e0/0/3 e0/0/4
[SW4-port-group]p l a
[SW4-port-group]p d v 20
[SW4-port-group]q
[SW1]stp mode mstp //切換為mstp模式,應(yīng)該是默認(rèn)值,穩(wěn)妥起見(jiàn),還是輸入一遍吧
[SW1]stp region-configuration
[SW1-mst-region]region-name huawei
[SW1-mst-region]revision-level 1
[SW1-mst-region]instance 1 vlan 10 100 //sw1主要跑vlan10和vlan100的數(shù)據(jù)流量
[SW1-mst-region]instance 2 vlan 20
[SW1-mst-region]ac region-configuration
[SW1-mst-region]quit
[SW1]stp instance 1 root primary
[SW1]stp instance 2 root secondary
[SW1]int g0/0/6 //6和7接口是連接電腦和服務(wù)器,所以設(shè)置為邊緣端口,加快STP收斂
[SW1-GigabitEthernet0/0/6]stp edged-port enable
[SW1-GigabitEthernet0/0/6]int g0/0/7
[SW1-GigabitEthernet0/0/7]stp edged-port enable
[SW1-GigabitEthernet0/0/7]q
MSTP配完了,緊接著配置VRRP
[SW1]int vlan 10
[SW1-Vlanif10]ip add 192.168.10.1 24
[SW1-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.254
[SW1-Vlanif10]vrrp vrid 1 priority 120
[SW1-Vlanif10]quit
[SW1]int vlan 20
[SW1-Vlanif20]ip add 192.168.20.1 24
[SW1-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.254
[SW1-Vlanif20]q
繼續(xù)配置DHCP Server
[SW1]dhcp enable
[SW1]ip pool VLAN10
[SW1-ip-pool-vlan10]network 192.168.10.0 mask 24
[SW1-ip-pool-vlan10]excluded-ip-address 192.168.10.1 192.168.10.10
[SW1-ip-pool-vlan10]gateway-list 192.168.10.254
[SW1-ip-pool-vlan10]dns-list 114.114.114.114
[SW1-ip-pool-vlan10]q
[SW1]int Vlanif 10
[SW1-Vlanif10]dhcp select global
[SW1-Vlanif10]q
[SW1]ip pool VLAN20
[SW1-ip-pool-vlan20]network 192.168.20.0 mask 24
[SW1-ip-pool-vlan20]excluded-ip-address 192.168.20.1 192.168.20.10
[SW1-ip-pool-vlan20]gateway-list 192.168.20.254
[SW1-ip-pool-vlan20]dns-list 114.114.114.114
[SW1-ip-pool-vlan20]q
[SW1]int vlan 20
[SW1-Vlanif20]dhcp select global
[SW1-Vlanif20]q
[SW2]stp region-configuration
[SW2-mst-region] region-name huawei
[SW2-mst-region] revision-level 1
[SW2-mst-region] instance 1 vlan 10 100
[SW2-mst-region] instance 2 vlan 20
[SW2-mst-region] active region-configuration
[SW2]stp instance 1 root secondary
[SW2]stp instance 2 root primary //sw2主要跑vlan20的數(shù)據(jù)流量
[SW2]int vlan 10
[SW2-Vlanif10]ip address 192.168.10.2 24
[SW2-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.254
[SW2-Vlanif10]q
[SW2]int vlan 20
[SW2-Vlanif20]ip address 192.168.20.2 24
[SW2-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.254
[SW2-Vlanif20]vrrp vrid 2 priority 120
[SW2-Vlanif20]q
[SW2]ip pool vlan10
[SW2-ip-pool-vlan10] gateway-list 192.168.10.254
[SW2-ip-pool-vlan10] network 192.168.10.0 mask 255.255.255.0
[SW2-ip-pool-vlan10] excluded-ip-address 192.168.10.1 192.168.10.10
[SW2-ip-pool-vlan10] dns-list 114.114.114.114
[SW2]ip pool vlan20
[SW2-ip-pool-vlan20] gateway-list 192.168.20.254
[SW2-ip-pool-vlan20] network 192.168.20.0 mask 255.255.255.0
[SW2-ip-pool-vlan20] excluded-ip-address 192.168.20.1 192.168.20.10
[SW2-ip-pool-vlan20] dns-list 114.114.114.114
[SW2-ip-pool-vlan20]q
[SW2]dhcp enable
[SW2]int vlan 10
[SW2-Vlanif10]dhcp se gl
[SW2-Vlanif10]q
[SW2]int vlan 20
[SW2-Vlanif20]dhcp se gl
[SW2-Vlanif20]q
兩臺(tái)核心交換機(jī)上都配置了DHCP,你們猜會(huì)不會(huì)有地址池沖突?會(huì)不會(huì)有DHCP服務(wù)沖突?
不僅是兩臺(tái)核心,下面的接入層交換機(jī),也要做相應(yīng)的配置
[SW3]stp region-configuration
[SW3-mst-region] region-name huawei
[SW3-mst-region] revision-level 1
[SW3-mst-region] instance 1 vlan 10 100
[SW3-mst-region] instance 2 vlan 20
[SW3-mst-region] active region-configuration
[SW3]int e0/0/3
[SW3-Ethernet0/0/3]stp ed enable
[SW3-Ethernet0/0/3]q
[SW4]stp region-configuration
[SW4-mst-region] region-name huawei
[SW4-mst-region] revision-level 1
[SW4-mst-region] instance 1 vlan 10 100
[SW4-mst-region] instance 2 vlan 20
[SW4-mst-region] active region-configuration
[SW4]int e0/0/3
[SW4-Ethernet0/0/3]stp edged-port enable
[SW4-Ethernet0/0/3]q
[SW4]int e0/0/4
[SW4-Ethernet0/0/4]stp edged-port enable
[SW4-Ethernet0/0/4]q
一頓操作猛如虎,PC拿到IP;
[SW1]vlan 111
[SW1-vlan111]q
[SW1]int Vlanif 111
[SW1-Vlanif111]ip add 172.16.111.1 24
[SW1-Vlanif111]quit
[SW1]ospf router-id 172.1.1.1
[SW1-ospf-1]area 0
[SW1-ospf-1-area-0.0.0.0]net 192.168.10.1 0.0.0.0
[SW1-ospf-1-area-0.0.0.0]net 192.168.20.1 0.0.0.0
[SW1-ospf-1-area-0.0.0.0]net 172.16.111.1 0.0.0.0
[SW1-ospf-1-area-0.0.0.0]q
[SW2]vlan 112
[SW2-vlan112]q
[SW2]int vlan 112
[SW2-Vlanif112]ip add 172.16.112.2 24
[SW2-Vlanif112]q
[SW2]ospf router-id 172.16.112.2
[SW2-ospf-1]area 0
[SW2-ospf-1-area-0.0.0.0]network 192.168.10.2 0.0.0.0
[SW2-ospf-1-area-0.0.0.0]network 192.168.20.2 0.0.0.0
[SW2-ospf-1-area-0.0.0.0]net 172.16.112.2 0.0.0.0
[SW2-ospf-1-area-0.0.0.0]q
上一篇文章中,兩臺(tái)防火墻也配置了OSPF,現(xiàn)在OSPF能跑起來(lái)了:
這時(shí)候,PC1和PC2是無(wú)法訪問(wèn)PC3和Server1的,因?yàn)镻C3和Server1在VLAN10里面,而VLAN10的網(wǎng)關(guān)是防火墻的VRRP IP,有些人會(huì)問(wèn),VLAN10的網(wǎng)關(guān)為什么不放在交換機(jī)的VRRP上呢?
因?yàn)?,服?wù)器更需要安全防護(hù),所以訪問(wèn)服務(wù)器必須經(jīng)過(guò)防火墻先生的同意和監(jiān)管,嘿嘿。
所以,我們需要配置相應(yīng)的安全策略才行。
security-policy
rule name in2server //創(chuàng)建安全策略,名稱(chēng)自己知道意義就行
source-zone trust //源安全區(qū)域:trust
destination-zone dmz //目的安全區(qū)域:dmz
destination-address 192.168.100.0 mask 255.255.255.0 //目標(biāo)地址
service ftp //FTP服務(wù)
service http //HTTP服務(wù)
service icmp //Ping服務(wù)
action permit //行為:允許
這條安全策略的意思是:允許trust區(qū)域內(nèi)的電腦訪問(wèn)DMZ區(qū)域內(nèi)的服務(wù)器,但僅限于http、ftp,ping只是為了測(cè)試而已,加不加無(wú)所謂,先測(cè)試一下吧。
Client1能夠訪問(wèn)Server1上面的HTTP服務(wù)了,緊接著再來(lái)一條上網(wǎng)的策略吧:
security-policy
rule name internet
source-zone dmz local trust //local是指防火墻本身,要不要允許連接互聯(lián)網(wǎng),那就見(jiàn)仁見(jiàn)智了
destination-zone untrust //互聯(lián)網(wǎng)肯定是untrust區(qū)域
action permit
想上互聯(lián)網(wǎng),只有安全策略還不行,還要配置NAT策略:
nat-policy
rule name internet
source-zone trust
action source-nat easy-ip
配置完成,來(lái)模擬一下防火墻故障,看看VRRP是否會(huì)自動(dòng)切換,直接在模擬器中“停止”FW1,PC1上tracert檢查出路徑:
從上圖中可以看到,F(xiàn)W1故障之前,PC1是走PPPOE撥號(hào)的寬帶出去的,F(xiàn)W1故障掉線后,PC1就從固定IP的鏈路出去了。
再來(lái)看防火墻的VRRP狀態(tài)吧:
FW2已經(jīng)接替FW1,成為VLAN100的Master設(shè)備,說(shuō)明防火墻VRRP配置正確,及時(shí)響應(yīng),沒(méi)有影響PC上網(wǎng);
再看一下交換機(jī)的VRRP,因?yàn)镕W1的故障,核心交換機(jī)的VRRP也會(huì)感知,從而切換Master角色:
雖然只是FW1掛了,核心1在正常工作中,但是由于鏈路down了,所以,此刻的核心2還是獨(dú)自承擔(dān)了所有,VLAN10和VLAN20的數(shù)量流量全部走核心2了。
至此,雙防火墻+雙核心交換機(jī)的配置基本上完成,后面就是一些細(xì)節(jié)上的調(diào)整和完善了。
聯(lián)系客服