网络防火墙高可用性配置全解析
1. 冗余接口的创建与应用
1.1 冗余接口概述
除了使用冗余防火墙来实现高可用性(HA),冗余接口也是一种可行的方案。冗余接口的核心思想在于,避免因切换到不同防火墙而带来的干扰。通过合理布线,使每个防火墙与各网段都有冗余连接,当出现问题时,流量只需切换到同一防火墙的不同接口,而非切换到另一台防火墙。
冗余接口并非NSRP的一部分,但常与NSRP配合构建全网状(full - mesh)设置。而且,即使不启用NSRP,也能创建冗余接口。若将冗余接口与NSRP结合使用,可以像绑定物理接口一样将VSI绑定到冗余接口,也可将冗余接口作为本地接口而非VSI。
1.2 物理接口分组为冗余接口
创建冗余接口时,需将两个或更多物理接口分组。在冗余接口组中,一个接口作为主接口,用于收发流量,除非其链路中断;而备用接口链路始终开启,但处于非活动状态,发送到它的流量会被丢弃。
冗余接口创建后,可像配置其他接口一样进行配置,包括分配到区域、设置IP地址等,还能在无编号VPN隧道中引用。值得注意的是,物理接口无需与冗余接口分配到同一区域。
1.3 简单冗余接口设置示例
为简化操作,以部分设置为例,将ethernet1和ethernet2接口分组为冗余接口,并绑定到内部区域。正常情况下,所有流量通过ethernet1传输;若该链路故障,流量会立即切换到ethernet2。
从CLI配置:
set interface redundant1 zone inside
set interface redundant1 ip 192.168.41.1/24
set interface ethernet1 group redundant1
set interface ethernet2 group redundant1
从Web界面配置:
- 进入Network | Interfaces | New Redundant IF。
- 输入接口名称为redundant1。
- 输入区域名称为inside。
- 指定IP地址和子网掩码为192.168.41.1/24。
- 点击OK创建冗余接口。
- 进入Network | Interfaces | ethernet1 | Edit。
- 将“Set As Member Of”设置为redundant1。
- 点击OK。
- 进入Network | Interfaces | ethernet2 | Edit。
- 将“Set As Member Of”设置为redundant1。
- 点击OK。
1.4 更改冗余接口的主接口
默认情况下,添加到冗余接口组的第一个物理接口成为主接口。若需要,可后续更改。假设冗余接口redundant1由物理接口ethernet1和ethernet2组成,且当前ethernet1为主接口,要将主接口更改为ethernet2,操作如下:
从CLI配置:
set interface redundant1 phy primary ethernet2
从Web界面:无法通过Web界面更改冗余接口的主接口。
2. 充分利用完整NSRP
2.1 NSRP - Lite的不足及解决方案
NSRP - Lite存在两个主要不足。一是在故障转移时,现有会话和VPN信息等会丢失;二是在NSRP集群中,大部分时间有一台防火墙处于闲置状态,难以向管理层解释购买额外防火墙的必要性。
针对第一个问题,Juniper/NetScreen提出了RTO镜像(RTO mirroring),该功能仅在完整NSRP中可用。
2.2 使用RTO镜像同步状态
RTO镜像可解决防火墙故障转移时的干扰问题,它能将所有动态信息(RTOs)在VSD之间主动镜像。发生故障转移时,新主VSD已拥有所有状态信息,可在最小干扰下恢复流量操作。
启用RTO镜像较为简单,但需确保防火墙之间的配置同步。在尝试启用前,可运行“exec nsrp sync global - config checksum”命令验证配置是否同步。
示例:在NSRP集群中启用RTO镜像
从CLI配置:
set nsrp cluster id 1
set nsrp rto - mirror sync
从Web界面配置:
- 进入Network | NSRP | Cluster。
- 输入集群ID为1。
- 点击Apply。
- 进入Network | NSRP | Synchronization。
- 选择NSRP RTO Synchronization。
- 选择NSRP Session Synchronization。
- 点击Apply。
2.3 防止某些会话备份
在NSRP中,“no - session - backup”选项有不同含义。它表示由特定策略创建的会话不会被其他VSD镜像,故障转移时,这些未镜像的会话将被丢弃,需重新建立。这在应对针对不安全协议的拒绝服务(DOS)攻击时可能有用。
示例:防止FTP会话备份
从CLI配置:
set policy from trust to untrust any any ftp permit no - session - backup
从Web界面配置:
- 进入Policies,创建从Trust区域到Untrust区域的新策略。
- 选择源和目标地址为any。
- 选择服务为FTP。
- 设置策略动作为Permit。
- 点击Advanced。
- 取消选择HA Session Backup选项,然后点击Return。
- 点击OK保存新策略。
2.4 设置Active/Active集群
设置Active/Active NSRP集群与Active/Passive集群类似,但Active/Active集群有多个VSD组。正常情况下,第一台防火墙作为第一个VSD组的主VSD和第二个VSD组的备用VSD,反之亦然。通过正确设置优先级即可实现VSD的分布。
由于每个VSD包含自己的VSI集,与使用单个VSD相比,每个网络会有多个IP地址。为利用此设置,需配置相邻网络节点在这些IP地址之间进行负载均衡。例如,路由器可通过设置两条成本相同的路由,分别指向一个VSI IP地址;若NetScreens为LAN提供默认网关,可将LAN上一半的主机配置为使用第一个VSD的IP地址,另一半使用另一个VSD的IP地址作为默认网关。
设置Active/Active配置时,必须复制路由。若第二个VSD没有路由,它会将所有流量通过HA数据链路转发到第一个VSD,应避免这种情况。此外,需考虑每台防火墙在正常情况下的负载应不超过50%,因为故障转移时,所有流量将通过剩余的防火墙。
示例:典型的Active/Active设置
假设有两台NetScreens为办公室LAN提供通往互联网的默认网关,它们连接到冗余交换机和冗余互联网边界路由器。客户端主机一半使用第一个VSD的内部IP地址,另一半使用第二个VSD的内部IP地址作为默认网关。路由器运行VRRP,NetScreens使用基于ARP的IP跟踪各自路由器的IP地址。
从CLI配置:
set zone name office
set zone name internet
set zone office vrouter trust - vr
set zone internet vrouter trust - vr
set interface ethernet1 zone office
set interface ethernet1 ip 192.168.62.1/24
set interface ethernet1 route
set interface ethernet2 zone internet
set interface ethernet2 ip 172.16.0.1/29
set interface ethernet2 route
# on firewall A, use this command
set interface ethernet2 manage - ip 172.16.0.2
# on firewall B, use this command instead
set interface ethernet2 manage - ip 172.16.0.4
#
set interface ethernet7 zone ha
set interface ethernet8 zone ha
set nsrp cluster id 1
set nsrp cluster name deepthought
set nsrp vsd - group id 1
set interface ethernet1:1 ip 192.168.62.2/24
set interface ethernet2:1 ip 172.16.0.3/29
set vrouter trust - vr route 0.0.0.0/0 interface ethernet2 gateway 172.16.0.5
set vrouter trust - vr route 0.0.0.0/0 interface ethernet2:1 gateway 172.16.0.6
set nsrp monitor interface ethernet1
set nsrp monitor interface ethernet2
set nsrp vsd - group id 0 monitor track - ip ip 172.16.0.5
set nsrp vsd - group id 0 monitor track - ip ip 172.16.0.5 method arp
set nsrp vsd - group id 0 monitor track - ip ip 172.16.0.5 weight 255
set nsrp vsd - group id 0 monitor track - ip
set nsrp vsd - group id 1 monitor track - ip ip 172.16.0.6
set nsrp vsd - group id 1 monitor track - ip ip 172.16.0.6 method arp
set nsrp vsd - group id 1 monitor track - ip ip 172.16.0.5 weight 255
set nsrp vsd - group id 1 monitor track - ip
set nsrp rto - mirror sync
set nsrp secondary - path ethernet1
set nsrp vsd - group master - always - exists
set arp always - on - dest
# on firewall A, use these commands
set hostname deepthoughtA
set nsrp vsd - group id 0 priority 1
set nsrp vsd - group id 0 preempt
set nsrp vsd - group id 0 preempt hold - down 45
set nsrp vsd - group id 1 priority 2
# on firewall B, use these commands instead
set hostname deepthoughtB
set nsrp vsd - group id 0 priority 2
set nsrp vsd - group id 1 priority 1
set nsrp vsd - group id 1 preempt
set nsrp vsd - group id 1 preempt hold - down 45
#
从Web界面配置步骤较多,这里不再赘述,可参考前面文档中详细的步骤说明。
2.5 网络拓扑结构示例
下面是一个简单的mermaid流程图,展示了Active/Active设置中的网络拓扑关系:
graph LR
classDef startend fill:#F5EBFF,stroke:#BE8FED,stroke-width:2px;
classDef process fill:#E5F6FF,stroke:#73A6FF,stroke-width:2px;
A(办公室LAN):::process -->|部分主机| B(NetScreen A - VSD 0):::process
A -->|部分主机| C(NetScreen B - VSD 1):::process
B -->|互联网链路| D(互联网边界路由器A):::process
C -->|互联网链路| E(互联网边界路由器B):::process
B <-->|HA链路| C
D <-->|VRRP| E
2.6 配置总结表格
| 配置项 | 说明 |
|---|---|
| 区域设置 | 设置办公室和互联网区域,并关联虚拟路由器 |
| 接口配置 | 为接口分配区域、IP地址和路由 |
| NSRP集群设置 | 设置集群ID、名称和VSD组 |
| 路由配置 | 为不同VSD组配置默认路由 |
| 监控设置 | 监控接口和跟踪IP地址 |
| RTO镜像 | 启用RTO镜像同步状态信息 |
| 优先级设置 | 为不同防火墙的VSD组设置优先级 |
3. 实现全网状Active/Active设置
3.1 全网状Active/Active设置概述
全网状Active/Active设置是实现高可用性的高级方法,通常包含冗余接口、RTO镜像和多个VSD组。这种设置的搭建和测试颇具挑战,需要根据实际网络情况调整配置。
3.2 示例:全网状Active/Active设置
本示例基于前面的Active/Active设置,不同之处在于采用了全网状布线,需要在NetScreens上进行配置更改,引入冗余接口。
从CLI配置:
set zone name office
set zone name internet
set zone office vrouter trust-vr
set zone internet vrouter trust-vr
set interface redundant1 zone office
set interface redundant1 ip 192.168.62.1/24
set interface redundant1 route
set interface ethernet1 zone office
set interface ethernet1 group redundant1
set interface ethernet2 zone office
set interface ethernet2 group redundant1
set interface redundant2 zone internet
set interface redundant2 ip 172.16.0.1/29
set interface redundant2 route
set interface ethernet3 zone internet
set interface ethernet3 group redundant2
set interface ethernet4 zone internet
set interface ethernet4 group redundant2
# on firewall A, use this command
set interface redundant2 manage-ip 172.16.0.2
# on firewall B, use this command instead
set interface redundant2 manage-ip 172.16.0.4
#
set interface ethernet7 zone ha
set interface ethernet8 zone ha
set nsrp cluster id 1
set nsrp cluster name deepthought
set nsrp vsd-group id 1
set interface redundant1:1 ip 192.168.62.2/24
set interface redundant2:1 ip 172.16.0.3/29
set vrouter trust-vr route 0.0.0.0/0 interface redundant2 gateway 172.16.0.5
set vrouter trust-vr route 0.0.0.0/0 interface redundant2:1 gateway 172.16.0.6
set nsrp monitor interface redundant1
set nsrp monitor interface redundant2
set nsrp vsd-group id 0 monitor track-ip ip 172.16.0.5
set nsrp vsd-group id 0 monitor track-ip ip 172.16.0.5 method arp
set nsrp vsd-group id 0 monitor track-ip ip 172.16.0.5 weight 255
set nsrp vsd-group id 0 monitor track-ip
set nsrp vsd-group id 1 monitor track-ip ip 172.16.0.6
set nsrp vsd-group id 1 monitor track-ip ip 172.16.0.6 method arp
set nsrp vsd-group id 1 monitor track-ip ip 172.16.0.5 weight 255
set nsrp vsd-group id 1 monitor track-ip
set nsrp rto-mirror sync
set nsrp secondary-path redundant1
set nsrp vsd-group master-always-exists
set arp always-on-dest
# on firewall A, use these commands
set hostname deepthoughtA
set nsrp vsd-group id 0 priority 1
set nsrp vsd-group id 0 preempt
set nsrp vsd-group id 0 preempt hold-down 45
set nsrp vsd-group id 1 priority 2
# on firewall B, use these commands instead
set hostname deepthoughtB
set nsrp vsd-group id 0 priority 2
set nsrp vsd-group id 1 priority 1
set nsrp vsd-group id 1 preempt
set nsrp vsd-group id 1 preempt hold-down 45
#
从Web界面配置:
- 进入Network | Zones | New创建新区域。
- 输入区域名称为office。
- 选择trust-vr作为虚拟路由器名称。
- 点击OK。
- 再次点击New。
- 输入区域名称为internet。
- 选择trust-vr作为虚拟路由器名称。
- 点击OK。
- 进入Network | Interfaces,选择Redundant IF后点击New。
- 输入区域名称为office。
- 分配IP地址和子网掩码为192.168.62.1/24。
- 选择Route作为接口模式。
- 点击OK。
- 选择Redundant IF后再次点击New。
- 输入区域名称为internet。
- 分配IP地址和子网掩码为172.16.0.1/29。
- 选择Route作为接口模式。
- 点击Apply。
- 在Firewall A上输入172.16.0.2作为管理IP,在Firewall B上输入172.16.0.4。
- 点击OK。
- 进入Network | Interfaces | ethernet1 | Edit。
- 输入区域名称为office。
- 设置As Member Of为redundant1。
- 点击OK。
- 进入Network | Interfaces | ethernet2 | Edit。
- 输入区域名称为office。
- 设置As Member Of为redundant1。
- 点击OK。
- 进入Network | Interfaces | ethernet3 | Edit。
- 输入区域名称为internet。
- 设置As Member Of为redundant2。
- 点击OK。
- 进入Network | Interfaces | ethernet4 | Edit。
- 输入区域名称为internet。
- 设置As Member Of为redundant2。
- 点击OK。
- 进入Network | Interfaces | ethernet7 | Edit。
- 选择HA作为区域名称。
- 点击OK。
- 进入Network | Interfaces | ethernet8 | Edit。
- 选择HA作为区域名称。
- 点击OK。
- 进入Network | NSRP | Cluster。
- 选择Cluster ID并输入1作为ID。
- 点击Apply。
- 进入Network | NSRP | VSD Group | New。
- 设置Group ID为1。
- 点击OK。
- 进入Network | Interfaces | New。
- 选择VSI IF。
- 选择redundant1作为VSI Base。
- 选择VSD Group 1。
- 分配IP地址和子网掩码为192.168.62.2/24。
- 点击Apply。
- 选择VSI IF后点击New。
- 选择redundant2作为VSI Base。
- 选择VSD Group 1。
- 分配IP地址和子网掩码为172.16.0.3/29。
- 点击Apply。
- 进入Network | Routing | Routing Entries | New。
- 选择trust-vr作为虚拟路由器名称。
- 输入IP地址和子网掩码为0.0.0.0/0.0.0.0。
- 选择Gateway而不是Next Hop Virtual Router Name。
- 选择redundant2。
- 输入网关IP地址为172.16.0.5。
- 点击OK。
- 选择trust-vr作为虚拟路由器名称。
- 点击New。
- 输入IP地址和子网掩码为0.0.0.0/0.0.0.0。
- 选择Gateway而不是Next Hop Virtual Router Name。
- 选择redundant2:1。
- 输入网关IP地址为172.16.0.6。
- 点击OK。
- 进入Network | NSRP | Monitor | Interface | VSD ID: Device | Edit interface。
- 选择redudant1。
- 设置权重为255。
- 选择redundant2。
- 设置权重为255。
- 点击Apply。
- 进入Network | NSRP | Monitor | Track IP | New。
- 输入跟踪IP为172.16.0.5。
- 设置权重为255。
- 更改方法为ARP。
- 设置VSD Group ID为0。
- 点击OK。
- 点击New。
- 输入跟踪IP为172.16.0.6。
- 设置权重为255。
- 更改方法为ARP。
- 设置VSD Group ID为1。
- 点击OK。
- 进入Network | NSRP | Monitor | Track IP | VSD ID : 0 | Edit。
- 选择Enable Track IP。
- 点击Apply。
- 进入Network | NSRP | Monitor | Track IP | VSD ID : 1 | Edit。
- 选择Enable Track IP。
- 点击Apply。
- 进入Network | NSRP | Synchronization。
- 选择NSRP RTO Synchronization。
- 选择NSRP Session Synchronization。
- 点击Apply。
- 进入Network | NSRP | Link。
- 选择redundant1作为Secondary Link。
- 点击Apply。
3.3 全网状Active/Active设置流程图
graph LR
classDef startend fill:#F5EBFF,stroke:#BE8FED,stroke-width:2px;
classDef process fill:#E5F6FF,stroke:#73A6FF,stroke-width:2px;
A(办公室LAN):::process -->|部分主机| B(NetScreen A - 冗余接口1 - VSD 0):::process
A -->|部分主机| C(NetScreen B - 冗余接口1 - VSD 1):::process
B -->|互联网链路| D(互联网边界路由器A):::process
C -->|互联网链路| E(互联网边界路由器B):::process
B <-->|HA链路| C
D <-->|VRRP| E
B -->|冗余链路| F(互联网边界路由器B):::process
C -->|冗余链路| D
3.4 全网状Active/Active设置配置总结表格
| 配置项 | 说明 |
|---|---|
| 区域设置 | 设置办公室和互联网区域,并关联虚拟路由器 |
| 冗余接口配置 | 创建冗余接口,分组物理接口,分配区域和IP地址 |
| NSRP集群设置 | 设置集群ID、名称和VSD组 |
| 路由配置 | 为不同VSD组的冗余接口配置默认路由 |
| 监控设置 | 监控冗余接口和跟踪IP地址 |
| RTO镜像 | 启用RTO镜像同步状态信息 |
| 优先级设置 | 为不同防火墙的VSD组设置优先级 |
4. 总结
通过本文,我们详细介绍了网络防火墙高可用性配置的多种方法,包括冗余接口的创建与应用、充分利用完整NSRP以及实现全网状Active/Active设置。每种方法都有其特点和适用场景,在实际网络环境中,可根据需求选择合适的配置方案。同时,在进行配置时,务必仔细测试,确保网络的高可用性和稳定性。
冗余接口可避免防火墙切换带来的干扰,NSRP - Lite的不足可通过RTO镜像解决,而全网状Active/Active设置则是实现高可用性的高级方案。希望这些内容能帮助你更好地配置网络防火墙,保障网络的正常运行。
超级会员免费看
1336

被折叠的 条评论
为什么被折叠?



