双防火墙+双核心交换机,故障自动切换的配置方法

admin 2024-10-06 10:15:19 0

扫一扫用手机浏览

文章目录 [+]

上一篇文章中,我们讲述了双防火墙的根基设置装备摆设,也便是应用心跳线设置装备摆设防火墙的HRP,产生故障的时刻,主动切换。

因为焦点互换机还没设置装备摆设完成,以是也未便测试,本日这篇文章会完结,以是后面会有故障测试的截图。

照料到没看上一篇文章的读者,照样要把拓扑图贴一下,便于文章的浏览。

双防火墙+双核心交换机,故障自动切换的配置方法
(图片来源网络,侵删)


重申一下,上图中,AR1代表运营商双出口收集,事实上并不存在这台装备;而且,银行也并没有采纳PPPOE链路,只是为了趁便展现一下PPPOE的设置装备摆设罢了。

两台华为的防火墙,fw1为主,fw2为备;两台华为焦点互换机,没有采纳堆叠技术,而是采纳VRRP技术进行设置装备摆设。

一、焦点互换机的根基设置装备摆设

[SW1]int Eth-Trunk 12

[SW1-Eth-Trunk12]mode lacp-static //两台焦点互换机设置装备摆设eth-trunk,而且设定聚合模式

[SW1-Eth-Trunk12]trunkport GigabitEthernet 0/0/2 to 0/0/3

[SW1-Eth-Trunk12]q

[SW1]vlan batch 10 20 100 //创立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 //收集装备之间的衔接接口设置装备摆设为trunk模式

[SW1-port-group]p t a v a //容许所有VLAN经由过程

[SW1-port-group]quit

[SW1]int g0/0/6

[SW1-GigabitEthernet0/0/6]p l a //6口和7口设置装备摆设为access模式,而且划在VLAN100内

[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的设置装备摆设,根本上差不多,就不再反复了,下面两台接入层的互换机,也很简单

二、接入互换机的根基设置装备摆设

[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

三、互换机设置装备摆设MSTP和VRRP

[SW1]stp mode mstp //切换为mstp模式,应该是默认值,稳妥起见,照样输入一遍吧

[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的数据流量

[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接口是衔接电脑和服务器,以是设置为边沿端口,加速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

继续设置装备摆设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的数据流量

[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

两台焦点互换机上都设置装备摆设了DHCP,你们猜会不会有地址池冲突。会不会有DHCP服务冲突。

不仅是两台焦点,下面的接入层互换机,也要做响应的设置装备摆设

[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

上一篇文章中,两台防火墙也设置装备摆设了OSPF,如今OSPF能跑起来了:


这时刻,PC1和PC2是无法拜访PC3和Server1的,由于PC3和Server1在VLAN10里面,而VLAN10的网关是防火墙的VRRP IP,有些人会问,VLAN10的网关为什么不放在互换机的VRRP上呢。

由于,服务器更必要平安防护,以是拜访服务器必需颠末防火墙老师的批准和监管,嘿嘿。

以是,我们必要设置装备摆设响应的平安策略才行。

security-policy

rule name in2server //创立平安策略,名称本身知道意义就行

source-zone trust //源平安区域:trust

destination-zone dmz //目标平安区域:dmz

destination-address 192.168.100.0 mask 255.255.255.0 //目的地址

service ftp //FTP服务

service http //HTTP服务

service icmp //Ping服务

action permit //行动:容许

这条平安策略的意思是:容许trust区域内的电脑拜访DMZ区域内的服务器,但仅限于http、ftp,ping只是为了测试罢了,加不加无所谓,先测试一下吧。


Client1可以或许拜访Server1上面的HTTP服务了,紧接着再来一条上彀的策略吧:

security-policy

rule name internet

source-zone dmz local trust //local是指防火墙自己,要不要容许衔接互联网,那就见仁见智了

destination-zone untrust //互联网确定是untrust区域

action permit

想上互联网,只有平安策略还不行,还要设置装备摆设NAT策略:

nat-policy

rule name internet

source-zone trust

action source-nat easy-ip

设置装备摆设完成,来模拟一下防火墙故障,看看VRRP是否会主动切换,直接在模拟器中“结束”FW1,PC1上tracert反省前途径:


从上图中可以看到,FW1故障之前,PC1是走PPPOE拨号的宽带出去的,FW1故障失落线后,PC1就从固定IP的链路出去了。

再来看防火墙的VRRP状况吧:


FW2已经接替FW1,成为VLAN100的Master装备,阐明防火墙VRRP设置装备摆设正确,实时相应,没有影响PC上彀;

再看一下互换机的VRRP,由于FW1的故障,焦点互换机的VRRP也会感知,从而切换Master脚色:


固然只是FW1挂了,焦点1在正常事情中,然则因为链路down了,以是,此刻的焦点2照样独自承担了所有,VLAN10和VLAN20的数目流量全体走焦点2了。

至此,双防火墙+双焦点互换机的设置装备摆设根本上完成,后面便是一些细节上的调整和完美了。

标签:

相关文章

清苑新能源车,引领绿色出行新潮流

随着全球气候变化和能源危机的日益严峻,绿色出行已成为全球共识。作为我国新能源产业的佼佼者,清苑新能源车凭借其卓越的性能和环保理念,...

家电资讯 2024-12-29 阅读3 评论0