拓扑说明:
防火墙旁挂核心交换机,核心交换机分为北向和南向,分别是PC2和PC1模拟,允许PC1访问PC2,不允许PC2主动访问PC1,FW-1为Master、FW-2为Backup。整网运行OSPF协议。业务运行在虚拟防火墙上,流量走向:PC1->LSW1->FW->LSW1->PC2。
根防火墙(主)配置如下(主备墙配置类似):
# sysname FW-1 # hrp enable hrp interface GigabitEthernet1/0/5 remote 1.1.1.2 hrp mirror session enable //配置会话热备 hrp track interface GigabitEthernet1/0/6 //监控物理链路,发生故障后进行主备切换 # vsys enable //开启虚拟系统功能 resource-class r0 # vsys name A 1 //创建虚拟系统并分配资源给虚拟系统 assign interface GigabitEthernet1/0/6.100 assign interface GigabitEthernet1/0/6.200 # ip vpn-instance A ipv4-family ipv6-family # ip vpn-instance default ipv4-family # bfd # interface GigabitEthernet1/0/5 //心跳HRP接口 undo shutdown ip address 1.1.1.1 255.255.255.252 service-manage ping permit # interface GigabitEthernet1/0/6 undo shutdown # interface GigabitEthernet1/0/6.100 vlan-type dot1q 100 ip binding vpn-instance A ip address 10.0.34.1 255.255.255.248 vrrp vrid 1 virtual-ip 10.0.34.6 active //主墙配置active 备墙配置standby # interface GigabitEthernet1/0/6.200 vlan-type dot1q 200 ip binding vpn-instance A ip address 10.0.12.1 255.255.255.248 vrrp vrid 2 virtual-ip 10.0.12.6 active //主墙配置active 备墙配置standby # firewall zone local set priority 100 # firewall zone trust set priority 85 add interface GigabitEthernet0/0/0 # firewall zone untrust set priority 5 # firewall zone dmz set priority 50 add interface GigabitEthernet1/0/5 # ospf 1 vpn-instance A //配置虚拟系统的OSPF协议,这里开启BFD为了快速感知故障 bfd all-interfaces enable area 0.0.0.0 network 10.0.12.0 0.0.0.7 network 10.0.34.0 0.0.0.7 # firewall zone local set priority 100 # firewall zone trust set priority 85 add interface GigabitEthernet1/0/6.100 # firewall zone untrust set priority 5 add interface GigabitEthernet1/0/6.200 # firewall zone dmz set priority 50 # security-policy //配置协议,让PC1访问PC2 rule name Trust_Untrust source-zone trust destination-zone untrust action permit # return
该配置中主要的两个要点:
一、是track物理链路,也可以考虑通过IP-link探测对端,但是这个场景意义不大,因为是直连链路,对端交换机IP配置在逻辑接口上。
二、OSPF BFD的必要性,如果没有OSPF BFD主备倒换后,会导致路由停留一阵子才会被撤销,这个时候流量依旧向主墙转发,因此导致大量丢包发生,如果配置OSPF BFD,当链路发生故障引起主备倒换后,协议会快速发现问题并撤销路由
实验现象:
然后断开主防火墙与交换机之间链路
回复主墙与交换机之间链路:主设备回切会有60秒的抢占延迟,也就是需要60s的时间才会切换回去,此时路由协议已经收敛完毕,回切不会导致丢包发生