本文配置目標:華為防火牆雙機熱備,電信和聯通雙運營商、固定IP接入,華為核心交換機配置VRRP。
為保護客戶隱私,電信和聯通的IP位址為虛構,如有雷同,純屬巧合。
真實拓撲圖如下所示,電信和聯通給的掩碼都是29,如果掩碼都是30,恐怕不能這麼連接。
回來用模擬器還原了配置,注意AR3以及下面的兩台交換機,是用來模擬運營商接入的,實際環境中只是兩個光貓而已。
一、配置模擬運營商接入的設備
1、路由器的配置:
配置各接口IP,並且宣告進OSPF
interface GigabitEthernet0/0/0
ip address 33.1.1.3 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 34.1.1.3 255.255.255.0
#
interface LoopBack0
ip address 3.3.3.3 255.255.255.255
#
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 33.1.1.3 0.0.0.0
network 34.1.1.3 0.0.0.0
#
2、交換機SW3的配置:
創建VLAN,配置IP,並且宣告進OSPF
vlan batch 33 130 222
#
interface Vlanif33
ip address 33.1.1.1 255.255.255.0
#
interface Vlanif222
ip address 222.92.76.1 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 222
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 222
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 33
#
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 222.92.76.1 0.0.0.0
network 33.1.1.1 0.0.0.0
#
3、交換機SW4的配置:
vlan batch 34 130
#
interface Vlanif34
ip address 34.1.1.4 255.255.255.0
#
interface Vlanif130
ip address 130.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 130
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 130
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 34
#
ospf 1 router-id 4.4.4.4
area 0.0.0.0
network 130.1.1.1 0.0.0.0
network 34.1.1.4 0.0.0.0
#
二、防火牆的配置
以FW1的配置為例說明
1、配置各接口IP
2、配置NAT策略
電信的NAT策略:
聯通的NAT策略:
3、配置上網案例策略:
4、配置IP-LINK,也可以在創建默認的路由順便創建
5、配置默認路由
電信和聯通各有一條默認路由
6、配置通向區域網的回程路由
7、配置FW2,過程略,方法同上;
8、在FW1上配置雙機熱備(主)
9、在FW2上配置雙機熱備(備)
三、核心交換機和接入交換機的配置
1、核心交換機CE1的配置
vlan batch 9 to 10
#
stp enable
Stp mode mstp
#
stp region-configuration
region-name test
revision-level 1
instance 1 vlan 9 to 10
#
stp instance 1 root primary
#
interface Vlanif9
description ith
ip address 192.168.9.1 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.9.254
vrrp vrid 1 priority 120
vrrp vrid 1 preempt timer delay 15
vrrp vrid 1 track interface GE1/0/0 reduce 40
#
interface Vlanif10
ip address 192.168.10.1 255.255.255.0
vrrp vrid 2 virtual-ip 192.168.10.254
vrrp vrid 2 priority 120
vrrp vrid 2 track interface GE1/0/0 reduce 40
#
interface GE1/0/0
undo portswitch
undo shutdown
ip address 11.1.1.1 255.255.255.248
#
interface GE1/0/1
undo shutdown
port link-type trunk
port trunk allow-pass vlan all
#
interface GE1/0/2
undo shutdown
port link-type trunk
port trunk allow-pass vlan 9 to 10
#
interface GE1/0/3
undo shutdown
port link-type trunk
port trunk allow-pass vlan 9 to 10
#
ip route-static 0.0.0.0 0.0.0.0 11.1.1.2 preference 50
ip route-static 0.0.0.0 0.0.0.0 13.1.1.2 preference 70
#
2、核心交換機CE2的配置
vlan batch 9 to 10
#
stp enable
Stp mode mstp
#
stp region-configuration
region-name test
revision-level 1
instance 1 vlan 9 to 10
#
stp instance 1 root secondary
#
interface Vlanif9
ip address 192.168.9.2 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.9.254
#
interface Vlanif10
ip address 192.168.10.2 255.255.255.0
vrrp vrid 2 virtual-ip 192.168.10.254
#
interface MEth0/0/0
undo shutdown
#
interface GE1/0/0
undo shutdown
port link-type trunk
port trunk allow-pass vlan 9 to 10
#
interface GE1/0/1
undo shutdown
port link-type trunk
port trunk allow-pass vlan 9 to 10
#
interface GE1/0/2
undo shutdown
port link-type trunk
port trunk allow-pass vlan 9 to 10
#
interface GE1/0/3
undo portswitch
undo shutdown
ip address 13.1.1.1 255.255.255.248
#
ip route-static 0.0.0.0 0.0.0.0 11.1.1.2 preference 70
ip route-static 0.0.0.0 0.0.0.0 13.1.1.2 preference 50
#
3、接入交換機SW1的配置:
vlan batch 9 to 10
#
stp region-configuration
region-name test
revision-level 1
instance 1 vlan 9 to 10
active region-configuration
#
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 9 to 10
#
interface Ethernet0/0/2
port link-type trunk
port trunk allow-pass vlan 9 to 10
#
interface Ethernet0/0/3
port link-type access
port default vlan 9
stp edged-port enable
#
interface Ethernet0/0/4
port link-type access
port default vlan 10
stp edged-port enable
#
4、接入交換機SW2的配置
和SW1的配置非常接近,就不再重複貼出來了。
四、災難測試
1、模擬VRRP Master交換機故障
如上圖所示,停止CE1交換機後,上網流量切換到右邊了;
2、模擬防火牆FW1故障
關停防火牆FW1之後,HRP狀態切換了,右側備機切換為激活狀態,上網流量切換到FW2上面了,說明配置正確。