防火墙双机热备(主备分担)

embedded/2025/3/19 6:23:58/

目录

引言

主备备份实验

 1、基本配置

2、双机热备配置

查看双机热备状态

主备切换

路由影响


引言

传统VRRP方式无法实现主、备用防火墙状态信息和多组VRRP状态的一致性,所以可能会导致流量的回包不从首包通过的防火墙回包,防火墙会因为状态检测机制丢弃此报文,所以防火墙使用VGMP统一管理VRRP的状态。

img

双机热备的部署模式有三种,主备备份、负载分担、镜像模式。其中主备分担和镜像模式的VGMP的状态,主是active,备是standby;而负载分担模式中,两个防火墙的状态都是load-balance。

 


主备备份实验

img

 1、基本配置

FW1:(配置地址、VRRP、接口加入安全区域)

[FW1]interface GigabitEthernet1/0/0
[FW1-GigabitEthernet1/0/0] ip address 192.168.10.2 24
[FW1-GigabitEthernet1/0/0] vrrp vrid 1 virtual-ip 192.168.10.1 active
​
[FW1]interface GigabitEthernet1/0/1
[FW1-GigabitEthernet1/0/1] ip address 1.1.1.2 29
[FW1-GigabitEthernet1/0/1] vrrp vrid 2 virtual-ip 1.1.1.1 active
​
[FW1]interface GigabitEthernet1/0/2
[FW1-GigabitEthernet1/0/2] ip address 10.1.1.1 30[FW1]firewall zone trust
[FW1-zone-trust] add interface GigabitEthernet1/0/0
​
[FW1]firewall zone untrust                     
[FW1-zone-untrust] add interface GigabitEthernet1/0/1
​
[FW1]firewall zone name hrp
[FW1-zone-hrp] set priority 51
[FW1-zone-hrp] add interface GigabitEthernet1/0/2

 FW2:(配置地址、VRRP、接口加入安全区域)

[FW2]interface GigabitEthernet1/0/0
[FW2-GigabitEthernet1/0/0] ip address 192.168.10.3 24
[FW2-GigabitEthernet1/0/0] vrrp vrid 1 virtual-ip 192.168.10.1 standby
​
[FW2]interface GigabitEthernet1/0/1
[FW2-GigabitEthernet1/0/1] ip address 1.1.1.3 29
[FW2-GigabitEthernet1/0/1] vrrp vrid 2 virtual-ip 1.1.1.1 standby
​
[FW2]interface GigabitEthernet1/0/2
[FW2-GigabitEthernet1/0/2] ip address 10.1.1.2 30
​
[FW2]firewall zone trust
[FW2-zone-trust] add interface GigabitEthernet1/0/0
​
[FW2]firewall zone untrust                     
[FW2-zone-untrust] add interface GigabitEthernet1/0/1
​
[FW2]firewall zone name hrp
[FW2-zone-hrp] set priority 51
[FW2-zone-hrp] add interface GigabitEthernet1/0/2

 

2、双机热备配置

 FW1:(配置心跳接口、开启HRP)

[FW1]hrp interface G1/0/2 remote 10.1.1.2
[FW1]hrp enable

 FW2: (配置心跳接口、开启HRP)

[FW2]hrp interface g1/0/2 remote 10.1.1.1
[FW2]hrp enable

 


查看双机热备状态

 FW1:(作为主设备,Role 为Active)

HRP_M[FW1]display hrp state  verbose 
2025-03-16 03:11:08.760 Role: active, peer: standbyRunning priority: 45000, peer: 45000Backup channel usage: 0.00%Stable time: 0 days, 0 hours, 0 minutesLast state change information: 2025-03-16 3:07:01 HRP core state changed, old_state = abnormal(standby), new_state = normal, local_priority = 45000, peer_priority = 45000.
​Configuration:hello interval:              1000mspreempt:                     60smirror configuration:        offmirror session:              offtrack trunk member:          onauto-sync configuration:     onauto-sync connection-status: onadjust ospf-cost:            onadjust ospfv3-cost:          onadjust bgp-cost:             onnat resource:                off
​Detail information:GigabitEthernet1/0/0 vrrp vrid 1: activeGigabitEthernet1/0/1 vrrp vrid 2: activeospf-cost: +0ospfv3-cost: +0bgp-cost: +0

 FW2: (作为备设备,Role 为Standby)

HRP_S[FW2]display hrp state verbose  
2025-03-16 03:10:43.150 Role: standby, peer: activeRunning priority: 45000, peer: 45000Backup channel usage: 0.00%Stable time: 0 days, 0 hours, 0 minutesLast state change information: 2025-03-16 3:07:01 HRP link changes to up.
​Configuration:hello interval:              1000mspreempt:                     60smirror configuration:        offmirror session:              offtrack trunk member:          onauto-sync configuration:     onauto-sync connection-status: onadjust ospf-cost:            onadjust ospfv3-cost:          onadjust bgp-cost:             onnat resource:                off
​Detail information:GigabitEthernet1/0/0 vrrp vrid 1: standbyGigabitEthernet1/0/1 vrrp vrid 2: standbyospf-cost: +65500ospfv3-cost: +65500bgp-cost: +100

验证备机无法配置安全策略、NAT策略等等,比如进入NAT策略的视图都会报错。

HRP_S[FW2]nat-policy Error: The device is in HRP standby state, so this command can not be executed.

 


主备切换

FW1:关闭主防火墙的一个配置了VRRP的接口 

HRP_M[FW1]interface g1/0/1 (+B)
HRP_M[FW1-GigabitEthernet1/0/1]shutdown 

 FW1:主防火墙的角色会立马发生转变,变成Role 是 Standby

HRP_S[FW1]display hrp state  
2025-03-16 03:14:00.580 Role: standby, peer: active (should be "active-standby")Running priority: 44998, peer: 45000Backup channel usage: 0.00%Stable time: 0 days, 0 hours, 0 minutesLast state change information: 2025-03-16 3:13:45 HRP core state changed, old_state = normal, new_state = abnormal(standby), local_priority = 44998, peer_priority = 45000.

 FW2:备防火墙的角色会立马发生转变,变成Role 是 Active


HRP_M[FW2]display hrp state
2025-03-16 03:14:12.050 Role: active, peer: standby (should be "standby-active")Running priority: 45000, peer: 44998Backup channel usage: 0.00%Stable time: 0 days, 0 hours, 0 minutesLast state change information: 2025-03-16 3:13:44 HRP core state changed, old_state = normal, new_state = abnormal(active), local_priority = 45000, peer_priority = 44998.

 FW1:恢复主防火墙的接口,查看切换状态

HRP_S[FW1]interface g1/0/1 (+B)
HRP_S[FW1-GigabitEthernet1/0/1]undo shutdown 

(主防火墙一分钟之后会抢占回来,因为默认的抢占就是60S)

 


路由影响

双机热备除了主墙响应VRRP的地址以外,对于网络中路由的宣告也有影响。

备墙会增加OSPF、ISIS、BGP的cost值,从而影响网络的流量,走到主墙上。(在最后几行)

HRP_S[FW2]display hrp state verbose  
2025-03-16 03:10:43.150 Role: standby, peer: activeRunning priority: 45000, peer: 45000Backup channel usage: 0.00%Stable time: 0 days, 0 hours, 0 minutesLast state change information: 2025-03-16 3:07:01 HRP link changes to up.
​Configuration:hello interval:              1000mspreempt:                     60smirror configuration:        offmirror session:              offtrack trunk member:          onauto-sync configuration:     onauto-sync connection-status: onadjust ospf-cost:            onadjust ospfv3-cost:          onadjust bgp-cost:             onnat resource:                off
​Detail information:GigabitEthernet1/0/0 vrrp vrid 1: standbyGigabitEthernet1/0/1 vrrp vrid 2: standbyospf-cost: +65500ospfv3-cost: +65500bgp-cost: +100

 FW1 :(配置OSPF)

HRP_M[FW1]ospf 1 router-id 1.1.1.1
HRP_M[FW1-ospf-1]area 0
HRP_M[FW1-ospf-1-area-0.0.0.0]network 192.168.10.0 0.0.0.255
HRP_M[FW1-ospf-1-area-0.0.0.0]network 1.1.1.0 0.0.0.7 

  FW2 :(配置OSPF)

HRP_S[FW2]ospf 1 router-id 2.2.2.2
HRP_S[FW2-ospf-1] area 0.0.0.0
HRP_S[FW2-ospf-1-area-0.0.0.0]  network 1.1.1.0 0.0.0.7
HRP_S[FW2-ospf-1-area-0.0.0.0]  network 192.168.10.0 0.0.0.255

ISP:(配置OSPF)

[ISP]inter g1/0
[ISP-GigabitEthernet1/0]ip address  1.1.1.4 29
[ISP]inter g2/0
[ISP-GigabitEthernet2/0]ip address 39.156.66.1 28
​
[ISP]ospf 1 router-id 3.3.3.3
[ISP-ospf-1]area  0
[ISP-ospf-1-area-0.0.0.0]network 39.156.66.0 0.0.0.15
[ISP-ospf-1-area-0.0.0.0]network 1.1.1.0 0.0.0.7

PC (测试访问外部的服务器

VPCS> ping 39.156.66.14
​
84 bytes from 39.156.66.14 icmp_seq=1 ttl=62 time=15.340 ms
84 bytes from 39.156.66.14 icmp_seq=2 ttl=62 time=24.609 ms
84 bytes from 39.156.66.14 icmp_seq=3 ttl=62 time=16.693 ms
84 bytes from 39.156.66.14 icmp_seq=4 ttl=62 time=16.757 ms
84 bytes from 39.156.66.14 icmp_seq=5 ttl=62 time=15.839 ms

 查看会话表

 FW1:

HRP_M[FW1]display firewall session table          
2025-03-16 03:34:32.710 Current Total Sessions : 8icmp  VPN: public --> public  192.168.10.10:49990 --> 39.156.66.14:2048

 FW2:(因为是备墙,所以会同步主墙的会话表,所以带有remote字样)

HRP_S[FW2]display firewall session table  
2025-03-16 03:34:26.770 Current Total Sessions : 5icmp  VPN: public --> public  Remote 192.168.10.10:49990 --> 39.156.66.14:2048


http://www.ppmy.cn/embedded/173780.html

相关文章

【Java篇】一法不变,万象归一:方法封装与递归的思想之道

文章目录 Java 方法的使用:从基础到递归的全面解析一、方法的概念及使用1.1 什么是方法 (method)?1.2 方法定义1.3 方法调用的执行过程1.4 实参和形参的关系1.5 没有返回值的方法 二、方法重载2.1 为什么需要方法重载2.2 方法重载的概念2.2.4 C 和 Java 的比较&…

采购与供应链项目建议书(46页PPT)(文末有下载方式)

资料解读:采购与供应链项目建议书(46页PPT) 详细资料请看本解读文章的最后内容。 引言 在当今竞争激烈的市场环境中,采购与供应链管理已成为企业核心竞争力的重要组成部分。本文将对《采购与供应链项目建议书》进行详细解读&am…

linux 命令 tail

tail 是 Linux 中用于查看文件末尾内容的命令&#xff0c;常用于日志监控和大文件快速浏览。以下是其核心用法及常见选项&#xff1a; 基本语法 tail [选项] 文件名 常用选项 显示末尾行数 -n <行数> 或 --lines<行数> 指定显示文件的最后若干行&#xff08;…

Spring Boot 整合 Redis 使用教程

Redis 是一种高性能的键值存储数据库&#xff0c;常用于缓存、会话管理和消息队列等场景。Spring Boot 通过 Spring Data Redis 提供了简洁的整合方式。 1. 环境准备 1.1 添加依赖 在 pom.xml 中添加 Redis 依赖&#xff08;Spring Boot 3.x&#xff09;&#xff1a; <de…

波士顿咨询X大型制造业数字化转型战略规划项目(98页PPT)(文末有下载方式)

资料解读&#xff1a;波士顿咨询 X 大型制造业数字化转型战略规划项目&#xff08;98 页&#xff09; 详细资料请看本解读文章的最后内容。在当下数字化浪潮席卷全球的时代&#xff0c;制造业作为国家经济发展的重要支柱&#xff0c;其数字化转型进程备受关注。这份由波士顿咨…

使用Ajax技术进行动态网页的爬虫(pycharm)

Ajax&#xff08;Asynchronous JavaScript and XML&#xff09;技术在现代Web开发中广泛应用。 它允许网页在不重新加载整个页面的情况下&#xff0c;通过JavaScript与服务器进行异步通信&#xff0c;动态更新部分内容。这种技术对爬虫的功能和作用产生了显著影响&#xff0c;…

杂谈:前端 UI 框架和 UI 组件库的区别

前端技术的概念比较多&#xff0c;容易搞混。 比如有些新人不理解前端 UI 框架和 UI 组件库的区别&#xff0c;今天我来简单说明一下两者的区别。 两者的区别 新人会搞混这两个概念&#xff0c;主要是因为在有些话语中&#xff0c;它们是同等的地位&#xff0c;比如下面这两…

五、AIGC大模型_07ChromaDB与RAG实战

0、向量数据库概述 向量数据库是一种新型的数据库&#xff0c;专门用于存储和检索高维向量数据&#xff0c;它结合了传统数据库&#xff08;如关系型、文档型&#xff09;的特点&#xff0c;并针对向量数据的特性进行了优化&#xff0c;主要用于支持语义检索、推荐系统、机器学…