Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
CN107241208A - A kind of message forwarding method, the first interchanger and related system - Google Patents
[go: Go Back, main page]

CN107241208A - A kind of message forwarding method, the first interchanger and related system - Google Patents

A kind of message forwarding method, the first interchanger and related system Download PDF

Info

Publication number
CN107241208A
CN107241208A CN201610186891.3A CN201610186891A CN107241208A CN 107241208 A CN107241208 A CN 107241208A CN 201610186891 A CN201610186891 A CN 201610186891A CN 107241208 A CN107241208 A CN 107241208A
Authority
CN
China
Prior art keywords
firewall
fire wall
message
network
session
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201610186891.3A
Other languages
Chinese (zh)
Other versions
CN107241208B (en
Inventor
杨华志
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201610186891.3A priority Critical patent/CN107241208B/en
Publication of CN107241208A publication Critical patent/CN107241208A/en
Application granted granted Critical
Publication of CN107241208B publication Critical patent/CN107241208B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0654Management of faults, events, alarms or notifications using network fault recovery
    • H04L41/0663Performing the actions predefined by failover planning, e.g. switching to standby network elements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/10Packet switching elements characterised by the switching fabric construction

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本申请实施例公开了一种报文转发方法,第一交换机及相关系统,该方法包括:第一交换机接收来自于第一网络的多个报文,第一交换机分别向第一防火墙和第二防火墙发送多个报文,第一交换机向第一防火墙和第二防火墙发送的报文是相同的,以使第一防火墙和第二防火墙均根据多个报文中的会话首报文建立会话首报文所属会话的会话表项,会话表项包含五元组,五元组用于判断流经防火墙的报文是否属于会话;第一交换机接收第一防火墙发送的来自于第二网络的会话的报文;第一交换机向第一网络转发来自于第二网络的会话的报文。采用本申请,第二防火墙能够在第一防火墙故障时基于自身建立的会话表项接替该第一防火墙的业务,避免了业务中断。

The embodiment of the present application discloses a message forwarding method, a first switch and a related system, the method includes: the first switch receives a plurality of messages from the first network, The firewall sends multiple packets, and the packets sent by the first switch to the first firewall and the second firewall are the same, so that both the first firewall and the second firewall establish a session header according to the session header packets in the multiple packets. The session table item of the session to which the message belongs, the session table item includes a quintuple, and the quintuple is used to judge whether the message flowing through the firewall belongs to the session; the first switch receives the session message from the second network sent by the first firewall message: the first switch forwards the message from the session of the second network to the first network. With this application, when the first firewall fails, the second firewall can take over the services of the first firewall based on the session entry established by itself, thereby avoiding service interruption.

Description

一种报文转发方法、第一交换机及相关系统A message forwarding method, first switch and related system

技术领域technical field

本发明涉及计算机技术领域,尤其涉及一种报文转发方法、第一交换机及相关系统。The present invention relates to the field of computer technology, in particular to a message forwarding method, a first switch and related systems.

背景技术Background technique

虚拟机软件(Virtual Machine ware,VMware)、内核虚拟机(Kernel-basedVirtual Machine,KVM)等环境的虚拟化技术的原理是将一台物理机的物理资源虚拟成多个虚拟机(Virtual Machine,VM),使得每个VM都可以实现物理机的功能。随着网络功能虚拟化(Network Function Virtualization,NFV)的不断演进,很多传统的网关,如防火墙、路由器等,都将部署到虚拟机上。多个虚拟机之间形成互为备份的容灾机制可以避免网关在的运行过程中出现网络流量所承载的业务中断的情况。Virtual machine software (Virtual Machine ware, VMware), Kernel-based Virtual Machine (Kernel-based Virtual Machine, KVM) and other environments virtualization technology principle is to virtualize the physical resources of a physical machine into multiple virtual machines (Virtual Machine, VM ), so that each VM can realize the function of a physical machine. With the continuous evolution of Network Function Virtualization (NFV), many traditional gateways, such as firewalls and routers, will be deployed on virtual machines. The mutual backup disaster recovery mechanism between multiple virtual machines can avoid the interruption of the business carried by the network traffic during the operation of the gateway.

请参见图1,图1是现有技术中的基于虚拟技术的防火墙,即虚拟防火墙,转发报文的场景示意图,其中除了以虚拟防火墙101和虚拟防火墙102为例的虚拟防火墙之外,还可能存在其他虚拟防火墙,图1只是以2个虚拟防火墙为例进行举例说明。虚拟防火墙101和虚拟防火墙102通过虚拟路由器冗余协议(Virtual Router Redundancy Protocol,VRRP)形成备份组100,该备份组100会从包含的多个虚拟防火墙中选举出一个虚拟防火墙作为主虚拟防火墙,除该主虚拟防火墙之外的虚拟防火墙均为备虚拟防火墙。主防火墙基于会话表项对报文进行包过滤,或者策略匹配等处理。当主虚拟防火墙出现故障时,备份组100会重新选举出一个虚拟防火墙作为新的主虚拟防火墙,交换机103和交换机104向该备份组100发送的报文时,只会由主虚拟防火墙来接收和转发该报文。Please refer to FIG. 1. FIG. 1 is a schematic diagram of a firewall based on virtual technology in the prior art, that is, a virtual firewall, forwarding a message. In addition to virtual firewalls taking virtual firewall 101 and virtual firewall 102 as examples, There are other virtual firewalls, and Figure 1 only uses two virtual firewalls as an example for illustration. The virtual firewall 101 and the virtual firewall 102 form a backup group 100 through a virtual router redundancy protocol (Virtual Router Redundancy Protocol, VRRP). Virtual firewalls other than the primary virtual firewall are standby virtual firewalls. The primary firewall performs packet filtering or policy matching on packets based on session entries. When the primary virtual firewall fails, the backup group 100 will re-elect a virtual firewall as the new primary virtual firewall, and the packets sent by the switches 103 and 104 to the backup group 100 will only be received and forwarded by the primary virtual firewall the message.

现有技术的缺陷在于,由于防火墙通常是基于会话表项对报文进行包过滤,或者策略匹配等处理。因此当前主虚拟防火墙需要周期性的将当前主虚拟防火墙上的会话表项备份到当前的备虚拟防火墙上,才能保证备虚拟防火墙在主虚拟防火墙出现故障时能够基于已备份的会话表项接替该主虚拟防火墙上的业务。如果备份该会话表项不及时则会导致一些业务中断。The disadvantage of the prior art is that the firewall usually performs packet filtering or policy matching on packets based on session entries. Therefore, the current active virtual firewall needs to periodically back up the session entries on the current active virtual firewall to the current standby virtual firewall to ensure that the standby virtual firewall can take over the session entries based on the backed up session entries when the active virtual firewall fails. Services on the primary virtual firewall. If the session entry is not backed up in time, some services will be interrupted.

发明内容Contents of the invention

本发明实施例公开了一种业务转发方法、第一交换机及相关系统,能够解决未及时备份会话表项而导致业务中断的问题。The embodiment of the invention discloses a service forwarding method, a first switch and a related system, which can solve the problem of service interruption caused by not backing up session entries in time.

第一方面,本发明实施例提供一种业务转发方法,该方法包括:In a first aspect, an embodiment of the present invention provides a service forwarding method, the method including:

第一交换机接收来自于第一网络的多个报文,所述第一交换机与第一防火墙、第二防火墙和所述第一网络相连,所述多个报文是所述第一网络与第二网络之间传输的报文,所述第一防火墙为主用防火墙,所述第二防火墙为备用防火墙,所述第一防火墙和第二防火墙分别与所述第一交换机和第二交换机连接,所述第二交换机还与所述第二网络连接;The first switch receives multiple messages from the first network, the first switch is connected to the first firewall, the second firewall and the first network, and the multiple messages are the first network and the second network. For messages transmitted between the two networks, the first firewall is the active firewall, the second firewall is the backup firewall, the first firewall and the second firewall are respectively connected to the first switch and the second switch, The second switch is also connected to the second network;

所述第一交换机分别向所述第一防火墙和所述第二防火墙发送所述多个报文,所述第一交换机向所述第一防火墙和所述第二防火墙发送的报文是相同的,以使所述第一防火墙和所述第二防火墙均根据所述多个报文中的会话首报文建立所述会话首报文所属会话的会话表项,所述会话表项包含五元组,所述五元组用于判断流经防火墙的报文是否属于所述会话;The first switch sends the plurality of packets to the first firewall and the second firewall respectively, and the packets sent by the first switch to the first firewall and the second firewall are the same so that both the first firewall and the second firewall establish a session entry for the session to which the session header packet belongs according to the session header packets in the plurality of packets, and the session entry includes five elements group, the five-tuple is used to determine whether the message flowing through the firewall belongs to the session;

所述第一交换机接收所述第一防火墙发送的来自于所述第二网络的所述会话的报文;receiving, by the first switch, the packet of the session from the second network sent by the first firewall;

所述第一交换机向所述第一网络转发所述来自于所述第二网络的所述会话的报文。The first switch forwards the packet of the session from the second network to the first network.

通过执行上述步骤,第一交换机向第一防火墙和第二防火墙发送同样的报文,使得该第一防火墙和第二防火墙根据该报文中的首报文建立相同的会话表项,这样一来,该第二防火墙不需要从该第一防火墙上备份该会话表项,当第一防火墙出现故障时,该第二防火墙可以直接基于自身建立的会话表项接替该第一防火墙上的业务,避免了业务中断。By performing the above steps, the first switch sends the same message to the first firewall and the second firewall, so that the first firewall and the second firewall establish the same session entry according to the first message in the message, so that , the second firewall does not need to back up the session entry from the first firewall. When the first firewall fails, the second firewall can directly take over the services on the first firewall based on the session entry established by itself, avoiding business interruption.

结合第一方面,在第一方面的第一种可能的实现方式中,所述第一交换机分别向所述第一防火墙和所述第二防火墙发送所述多个报文之后,所述方法还包括:With reference to the first aspect, in a first possible implementation manner of the first aspect, after the first switch sends the multiple packets to the first firewall and the second firewall respectively, the method further include:

所述第一交换机检测所述第一防火墙是否发生故障,或者所述第一交换机与所述第一防火墙之间的链路是否中断;The first switch detects whether the first firewall fails, or whether the link between the first switch and the first firewall is interrupted;

如果所述第一交换机检测到所述第一防火墙故障、或者所述第一交换机与所述第一防火墙之间的链路中断,则所述第一交换机接收并转发所述第二防火墙发送的来自于所述第二网络的所述会话的报文。If the first switch detects that the first firewall fails, or the link between the first switch and the first firewall is interrupted, the first switch receives and forwards the packets from the session on the second network.

结合第一方面的第一种可能的实现方式,在第一方面的第二种可能的实现方式中,所述第一交换机检测所述第一防火墙是否发生故障,具体为:With reference to the first possible implementation of the first aspect, in a second possible implementation of the first aspect, the first switch detects whether the first firewall fails, specifically:

所述第一交换机通过双向转发检测机制BFD检测所述第一防火墙是否故障。The first switch detects whether the first firewall is faulty through a bidirectional forwarding detection mechanism BFD.

具体地,交换机自身检测该第一防火墙是否故障,以便在检测到该第一防火墙故障时及时调整报文转发策略,提升了交换机的性能。Specifically, the switch itself detects whether the first firewall is faulty, so as to adjust the packet forwarding policy in time when the first firewall is detected to be faulty, thereby improving the performance of the switch.

结合第一方面的第一种可能的实现方式,或者第一方面的第二种可能的实现方式,在第一方面的第三种可能的实现方式中,所述第一交换机检测到所述第一防火墙故障、或者所述第一交换机与所述第一防火墙之间的链路中断之前,所述方法还包括:With reference to the first possible implementation of the first aspect, or the second possible implementation of the first aspect, in a third possible implementation of the first aspect, the first switch detects that the first Before a firewall fails, or the link between the first switch and the first firewall is interrupted, the method further includes:

所述第一交换机不接收所述第二防火墙发送的来自于所述第二网络的所述会话的报文,或者接收并丢弃所述第二防火墙发送的来自于所述第二网络的所述会话的报文。The first switch does not receive the session packet from the second network sent by the second firewall, or receives and discards the packet from the second network sent by the second firewall. Session messages.

结合第一方面的第三种可能的实现方式,在第一方面的第四种可能的实现方式中,所述第一交换机包括所述第一交换机与所述第一防火墙相连的第一接口,以及所述第一交换机与所述第二防火墙相连的第二接口,With reference to the third possible implementation manner of the first aspect, in a fourth possible implementation manner of the first aspect, the first switch includes a first interface connecting the first switch to the first firewall, and a second interface connecting the first switch to the second firewall,

所述第一交换机检测到所述第一防火墙故障、或者所述第一交换机与所述第一防火墙之间的链路中断之前,所述第一接口被设置为主接口,所述第二接口被设置为备接口;所述第一交换机通过所述第一接口接收并转发所述第一防火墙发送的来自于所述第二网络的所述会话的报文,所述第一交换机不接收所述第二防火墙发送的来自于所述第二网络的所述会话的报文,或者通过所述备接口接收所述第二防火墙发送的来自于所述第二网络的所述会话的报文,并丢弃通过所述备接口接收到的来自于所述第二网络的所述会话的报文;Before the first switch detects that the first firewall fails, or the link between the first switch and the first firewall is interrupted, the first interface is set as the main interface, and the second interface It is set as a backup interface; the first switch receives and forwards the message of the session from the second network sent by the first firewall through the first interface, and the first switch does not receive the receiving the session packet from the second network sent by the second firewall, or receiving the session packet from the second network sent by the second firewall through the standby interface, and discarding the packets received from the session of the second network through the standby interface;

所述第一交换机检测到所述第一防火墙故障、或者所述第一交换机与所述第一防火墙之间的链路中断之后,所述方法还包括:After the first switch detects that the first firewall fails, or the link between the first switch and the first firewall is interrupted, the method further includes:

将所述第一接口设置为备接口,将所述第二接口设置为主接口,通过所述第二接口接收并转发所述第二防火墙发送的来自于所述第二网络的所述会话的报文。Setting the first interface as a standby interface, setting the second interface as a main interface, receiving and forwarding the session from the second network sent by the second firewall through the second interface message.

第二方面,本发明实施例提供一种第一交换机,所述第一交换机包括网络接口,处理器和存储器,其中:In a second aspect, an embodiment of the present invention provides a first switch, where the first switch includes a network interface, a processor, and a memory, wherein:

所述网络接口用于接收报文和发送报文;The network interface is used to receive messages and send messages;

所述存储器用于存储指令和数据;The memory is used to store instructions and data;

所述处理器,用于读取所述存储器中存储的指令和数据,执行如下操作:The processor is configured to read instructions and data stored in the memory, and perform the following operations:

通过所述网络接口接收来自于第一网络的多个报文,所述第一交换机与第一防火墙、第二防火墙和所述第一网络相连,所述多个报文是所述第一网络与第二网络之间传输的报文,所述第一防火墙为主用防火墙,所述第二防火墙为备用防火墙,所述第一防火墙和第二防火墙分别与所述第一交换机和第二交换机连接,所述第二交换机还与所述第二网络连接;Receive a plurality of messages from the first network through the network interface, the first switch is connected to the first firewall, the second firewall and the first network, and the plurality of messages are the first network For messages transmitted between the second network and the first firewall, the first firewall is the active firewall, the second firewall is the backup firewall, the first firewall and the second firewall are connected to the first switch and the second switch respectively connected, the second switch is also connected to the second network;

通过所述网络接口分别向所述第一防火墙和所述第二防火墙发送所述多个报文,通过所述网络接口向所述第一防火墙和所述第二防火墙发送的报文是相同的,以使所述第一防火墙和所述第二防火墙均根据所述多个报文中的会话首报文建立所述会话首报文所属会话的会话表项,所述会话表项包含五元组,所述五元组用于判断流经防火墙的报文是否属于所述会话;Send the multiple packets to the first firewall and the second firewall respectively through the network interface, and the packets sent to the first firewall and the second firewall through the network interface are the same so that both the first firewall and the second firewall establish a session entry for the session to which the session header packet belongs according to the session header packets in the plurality of packets, and the session entry includes five elements group, the five-tuple is used to determine whether the message flowing through the firewall belongs to the session;

通过所述网络接口接收所述第一防火墙发送的来自于所述第二网络的所述会话的报文;receiving the packet of the session from the second network sent by the first firewall through the network interface;

通过所述网络接口向所述第一网络转发所述来自于所述第二网络的所述会话的报文。Forwarding the packet of the session from the second network to the first network through the network interface.

通过执行上述操作,第一交换机向第一防火墙和第二防火墙发送同样的报文,使得该第一防火墙和第二防火墙根据该报文中的首报文建立相同的会话表项,这样一来,该第二防火墙不需要从该第一防火墙上备份该会话表项,当第一防火墙出现故障时,该第二防火墙可以直接基于自身建立的会话表项接替该第一防火墙上的业务,避免了业务中断。By performing the above operations, the first switch sends the same message to the first firewall and the second firewall, so that the first firewall and the second firewall establish the same session entry according to the first message in the message, so that , the second firewall does not need to back up the session entry from the first firewall. When the first firewall fails, the second firewall can directly take over the services on the first firewall based on the session entry established by itself, avoiding business interruption.

结合第二方面,在第二方面的第一种可能的实现方式中,所述处理器通过所述网络接口分别向所述第一防火墙和所述第二防火墙发送所述多个报文之后,所述处理器还用于:With reference to the second aspect, in a first possible implementation manner of the second aspect, after the processor sends the multiple packets to the first firewall and the second firewall respectively through the network interface, The processor is also used to:

检测所述第一防火墙是否发生故障,或者所述第一交换机与所述第一防火墙之间的链路是否中断;Detecting whether the first firewall fails, or whether the link between the first switch and the first firewall is interrupted;

如果所述第一防火墙故障、或者所述第一交换机与所述第一防火墙之间的链路中断,则通过所述网络接口接收并转发所述第二防火墙发送的来自于所述第二网络的所述会话的报文。If the first firewall fails, or the link between the first switch and the first firewall is interrupted, receive and forward the data from the second network sent by the second firewall through the network interface. packets of the session.

结合第二方面的第一种可能的实现方式,在第二方面的第二种可能的实现方式中,所述处理器检测所述第一防火墙是否发生故障,具体为:With reference to the first possible implementation of the second aspect, in a second possible implementation of the second aspect, the processor detects whether the first firewall fails, specifically:

通过双向转发检测机制BFD检测所述第一防火墙是否故障。A bidirectional forwarding detection mechanism BFD is used to detect whether the first firewall is faulty.

具体地,交换机自身检测该第一防火墙是否故障,以便在检测到该第一防火墙故障时及时调整报文转发策略,提升了交换机的性能。Specifically, the switch itself detects whether the first firewall is faulty, so as to adjust the packet forwarding policy in time when the first firewall is detected to be faulty, thereby improving the performance of the switch.

结合第二方面的第一种可能的实现方式,或者第二方面的第二种可能的实现方式,在第二方面的第三种可能的实现方式中,所述处理器检测到所述第一防火墙故障、或者所述第一交换机与所述第一防火墙之间的链路中断之前,所述处理器还用于:With reference to the first possible implementation of the second aspect, or the second possible implementation of the second aspect, in a third possible implementation of the second aspect, the processor detects that the first Before the firewall fails, or the link between the first switch and the first firewall is interrupted, the processor is further configured to:

不接收所述第二防火墙发送的来自于所述第二网络的所述会话的报文,或者通过所述网络接口接收所述第二防火墙发送的来自于所述第二网络的所述会话的报文,并丢弃所述第二防火墙发送的来自于所述第二网络的所述会话的报文。Not receiving the session packet from the second network sent by the second firewall, or receiving the session packet from the second network sent by the second firewall through the network interface packets, and discard the packets sent by the second firewall from the session on the second network.

结合第二方面的第三种可能的实现方式,在第二方面的第四种可能的实现方式中,所述网络接口包括所述第一交换机与所述第一防火墙相连的第一接口,以及所述第一交换机与所述第二防火墙相连的第二接口,With reference to the third possible implementation manner of the second aspect, in a fourth possible implementation manner of the second aspect, the network interface includes a first interface connecting the first switch to the first firewall, and the second interface connecting the first switch to the second firewall,

所述处理器检测到所述第一防火墙故障、或者所述第一交换机与所述第一防火墙之间的链路中断之前,所述第一接口被设置为主接口,所述第二接口被设置为备接口;所述第一交换机通过所述第一接口接收并转发所述第一防火墙发送的来自于所述第二网络的所述会话的报文,所述第一交换机不接收所述第二防火墙发送的来自于所述第二网络的所述会话的报文,或者通过所述第二接口接收所述第二防火墙发送的来自于所述第二网络的所述会话的报文,并丢弃通过所述第二接口接收到的来自于所述第二网络的所述会话的报文;Before the processor detects that the first firewall is faulty or the link between the first switch and the first firewall is interrupted, the first interface is set as the main interface, and the second interface is set as the main interface. set as a backup interface; the first switch receives and forwards the message from the session of the second network sent by the first firewall through the first interface, and the first switch does not receive the receiving the session packet from the second network sent by the second firewall, or receiving the session packet from the second network sent by the second firewall through the second interface, and discarding the packets received through the second interface from the session of the second network;

所述处理器检测到所述第一防火墙故障、或者所述第一交换机与所述第一防火墙之间的链路中断之后,将所述第一接口设置为备接口,将所述第二接口设置为主接口,通过所述第二接口接收并转发所述第二防火墙发送的来自于所述第二网络的所述会话的报文。After the processor detects that the first firewall is faulty or the link between the first switch and the first firewall is interrupted, the first interface is set as the standby interface, and the second interface is set to Set as the main interface, receive and forward the message from the session of the second network sent by the second firewall through the second interface.

第三方面,本发明实施例提供一种第一交换机,所述第一交换机包括用于执行本发明实施例第一方面任一实现方式的部分或全部步骤的功能单元。In a third aspect, an embodiment of the present invention provides a first switch, where the first switch includes a functional unit configured to perform some or all of the steps in any implementation manner of the first aspect of the embodiments of the present invention.

第四方面,本发明实施例提供一种报文转发系统,所述系统包括第一交换机、第二交换机、第一防火墙和第二防火墙,其中,所述第一交换机与第一防火墙、第二防火墙和所述第一网络相连,所述第一防火墙为主用防火墙,所述第二防火墙为备用防火墙,所述第一防火墙和第二防火墙分别与所述第一交换机和第二交换机连接,所述第二交换机还与所述第二网络连接,其中:In a fourth aspect, an embodiment of the present invention provides a message forwarding system, the system includes a first switch, a second switch, a first firewall, and a second firewall, wherein the first switch communicates with the first firewall, the second The firewall is connected to the first network, the first firewall is an active firewall, the second firewall is a backup firewall, the first firewall and the second firewall are respectively connected to the first switch and the second switch, The second switch is also connected to the second network, wherein:

第一交换机,用于接收来自于第一网络的多个报文,所述多个报文是所述第一网络与第二网络之间传输的报文;分别向所述第一防火墙和所述第二防火墙发送所述多个报文,所述第一交换机向所述第一防火墙和所述第二防火墙发送的报文是相同的;The first switch is configured to receive multiple packets from the first network, the multiple packets are packets transmitted between the first network and the second network; The second firewall sends the plurality of packets, and the packets sent by the first switch to the first firewall and the second firewall are the same;

所述第一防火墙和所述第二防火墙,分别用于根据所述第一交换机发送的所述多个报文中的会话首报文建立所述会话首报文所属会话的会话表项,所述会话表项包含五元组,所述五元组用于判断流经防火墙的报文是否属于所述会话;The first firewall and the second firewall are respectively configured to establish a session entry of the session to which the session header message belongs according to the session header message in the plurality of messages sent by the first switch, so The session entry includes a quintuple, and the quintuple is used to determine whether the message flowing through the firewall belongs to the session;

所述第一防火墙,还用于向所述第一交换机转发来自所述第二网络的所述会话的报文;The first firewall is further configured to forward the packet of the session from the second network to the first switch;

所述第一交换机,还用于接收所述第一防火墙发送的来自于所述第二网络的所述会话的报文;The first switch is further configured to receive the packet of the session from the second network sent by the first firewall;

所述第一交换机,还用于向所述第一网络转发所述来自于所述第二网络的所述会话的报文。The first switch is further configured to forward the packet of the session from the second network to the first network.

通过运行该系统,第一交换机向第一防火墙和第二防火墙发送同样的报文,使得该第一防火墙和第二防火墙根据该报文中的首报文建立相同的会话表项,这样一来,该第二防火墙不需要从该第一防火墙上备份该会话表项,当第一防火墙出现故障时,该第二防火墙可以直接基于自身建立的会话表项接替该第一防火墙上的业务,避免了业务中断。By running the system, the first switch sends the same message to the first firewall and the second firewall, so that the first firewall and the second firewall establish the same session entry according to the first message in the message, so that , the second firewall does not need to back up the session entry from the first firewall. When the first firewall fails, the second firewall can directly take over the services on the first firewall based on the session entry established by itself, avoiding business interruption.

结合第四方面,在第四方面的第一种可能的实现方式中,所述第一交换机包括所述第一交换机与所述第一防火墙相连的第一接口,以及所述第一交换机与所述第二防火墙相连的第二接口,所述第二防火墙,还用于向所述第一交换机转发来自所述第二网络的所述会话的报文;With reference to the fourth aspect, in a first possible implementation manner of the fourth aspect, the first switch includes a first interface connecting the first switch to the first firewall, and the first switch is connected to the first A second interface connected to the second firewall, the second firewall is further configured to forward the message from the session of the second network to the first switch;

所述第一交换机,用于检测所述第一防火墙是否故障、或者所述第一交换机与所述第一防火墙之间的链路是否中断,并在检测出所述第一防火墙故障、或者所述第一交换机与所述第一防火墙之间的链路中断之前将所述第一接口设置为主接口,将所述第二接口设置为备接口;在检测出所述第一防火墙故障、或者所述第一交换机与所述第一防火墙之间的链路中断之后将所述第一接口设置为备接口,将所述第二接口设置为主接口;The first switch is configured to detect whether the first firewall is faulty, or whether the link between the first switch and the first firewall is interrupted, and when the first firewall is detected to be faulty, or the Before the link between the first switch and the first firewall is interrupted, the first interface is set as the main interface, and the second interface is set as the backup interface; when the failure of the first firewall is detected, or After the link between the first switch and the first firewall is interrupted, the first interface is set as a standby interface, and the second interface is set as a main interface;

在检测出所述第一防火墙故障、或者所述第一交换机与所述第一防火墙之间的链路中断之前,通过所述第一接口和所述第二接口分别接收所述第一防火墙和所述第二防火墙发送的来自于所述第二网络的所述会话的报文,并丢弃通过所述第二接口接收到的来自所述第二网络的所述会话的报文;Before the failure of the first firewall is detected, or the link between the first switch and the first firewall is interrupted, receiving the first firewall and the first firewall through the first interface and the second interface respectively The second firewall sends the packet from the session of the second network, and discards the packet received through the second interface from the session of the second network;

在检测出所述第一防火墙故障、或者所述第一交换机与所述第一防火墙之间的链路中断之后,通过所述第二接口分别接收所述第二防火墙发送的来自于所述第二网络的所述会话的报文,并向所述第一网络转发通过所述第二接口接收到的来自于所述第二网络的所述会话的报文。After detecting that the first firewall is faulty or the link between the first switch and the first firewall is interrupted, respectively receive the data from the second firewall sent by the second firewall through the second interface. A message of the session of the second network, and forward the message of the session of the second network received through the second interface to the first network.

结合第四方面,在第四方面的第二种可能的实现方式中,所述第二防火墙,还用于检测所述第二防火墙是否为备用防火墙,若第二防火墙为备用防火墙,则禁止向所述第一交换机转发来自所述第二网络的所述会话的报文,禁止向所述第二交换机转发来自所述第一网络的所述会话的报文。With reference to the fourth aspect, in a second possible implementation of the fourth aspect, the second firewall is also used to detect whether the second firewall is a backup firewall, and if the second firewall is a backup firewall, prohibiting the The first switch forwards the packets of the session from the second network, and prohibits forwarding the packets of the session from the first network to the second switch.

通过实施本发明实施例,第一交换机向第一防火墙和第二防火墙发送同样的报文,使得该第一防火墙和第二防火墙根据该报文中的首报文建立相同的会话表项,这样一来,该第二防火墙不需要从该第一防火墙上备份该会话表项,当第一防火墙出现故障时,该第二防火墙可以直接基于自身建立的会话表项接替该第一防火墙上的业务,避免了业务中断。By implementing the embodiment of the present invention, the first switch sends the same message to the first firewall and the second firewall, so that the first firewall and the second firewall establish the same session entry according to the first message in the message, thus First, the second firewall does not need to back up the session entry from the first firewall. When the first firewall fails, the second firewall can directly take over the business on the first firewall based on the session entry established by itself. , avoiding business interruption.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings that are required in the description of the embodiments or the prior art.

图1是现有技术中的基于虚拟技术的防火墙转发业务的场景示意图;FIG. 1 is a schematic diagram of a scenario of firewall forwarding services based on virtual technology in the prior art;

图2是本发明实施例提供的一种业务转发方法的流程示意图;FIG. 2 is a schematic flowchart of a service forwarding method provided by an embodiment of the present invention;

图3是本发明实施例提供的一种业务转发的场景示意图;FIG. 3 is a schematic diagram of a service forwarding scenario provided by an embodiment of the present invention;

图4是本发明实施例提供的一种逻辑链路的场景示意图;FIG. 4 is a schematic diagram of a logical link scenario provided by an embodiment of the present invention;

图5是本发明实施例提供的一种第一交换机的结构示意图;FIG. 5 is a schematic structural diagram of a first switch provided by an embodiment of the present invention;

图6是本发明实施例提供的又一种第一交换机的结构示意图;FIG. 6 is a schematic structural diagram of another first switch provided by an embodiment of the present invention;

图7是本发明实施例提供的一种报文转发系统的结构示意图。Fig. 7 is a schematic structural diagram of a message forwarding system provided by an embodiment of the present invention.

具体实施方式detailed description

下面将结合本发明实施例的附图对本发明实施例的技术方案进行详细描述。The technical solutions of the embodiments of the present invention will be described in detail below with reference to the drawings of the embodiments of the present invention.

请参见图2,图2是本发明实施例提供的一种业务转发方法的流程示意图,该方法包括但不限于如下步骤。Please refer to FIG. 2 . FIG. 2 is a schematic flowchart of a service forwarding method provided by an embodiment of the present invention. The method includes but is not limited to the following steps.

步骤S201:第一交换机接收来自于第一网络的多个报文。Step S201: the first switch receives multiple packets from the first network.

为了更好的理解本发明实施例的方案,首先参照图3对本发明实施例的应用场景进行介绍。图3中,第一交换机311与第一防火墙312、第二防火墙313和第一网络相连,该第二交换机314与第一防火墙312、第二防火墙313和第二网络相连,第一防火墙312为主用防火墙,第二防火墙313为备用防火墙,该第一交换机311和该第二交换机314均获知该第一防火墙311为主用防火墙,获知该第二防火墙314为备用防火墙;该第一网络中存在一个或多个客户端,该第二网络中也存在一个或多个客户端,不管该第一网络中的客户端向该第二网络中的客户端发送什么报文,都要首先将该报文发送给该第一交换机311,上述“多个报文”可以为同一时刻发送的,也可以为一段时间内先后发送的,上述“多个报文”中的“多个”旨在不限定发送的报文的类型。相应地,第一交换机311接收从该第一网络中发来的报文。In order to better understand the solution of the embodiment of the present invention, first, referring to FIG. 3 , the application scenario of the embodiment of the present invention is introduced. In Fig. 3, the first switch 311 is connected with the first firewall 312, the second firewall 313 and the first network, and the second switch 314 is connected with the first firewall 312, the second firewall 313 and the second network, and the first firewall 312 is The active firewall, the second firewall 313 is a standby firewall, the first switch 311 and the second switch 314 both know that the first firewall 311 is the active firewall, and know that the second firewall 314 is a standby firewall; in the first network There are one or more clients, and there are also one or more clients in the second network. No matter what message the client in the first network sends to the client in the second network, the The message is sent to the first switch 311. The above-mentioned "multiple messages" can be sent at the same time, and can also be sent successively within a period of time. The "multiple" in the above-mentioned "multiple messages" is intended not to Limit the type of packets sent. Correspondingly, the first switch 311 receives the message sent from the first network.

需要说明的是,本发明实施例中的第一防火墙312和第二防火墙313对外具有相同的地址信息,例如,具有相同的虚拟的网络协议(Internet Protocol,IP)地址和虚拟的媒体访问控制(Media Access Control,MAC)地址,该第一防火墙312向该第一交换机311发送的报文的源地址与该第二防火墙313向该第一交换机311发送的报文的源地址相同,该第一防火墙312向该第二交换机314发送的报文的源地址与该第二防火墙313向该第二交换机314发送的报文的源地址相同。可选的,该第一防火墙312和该第二防火墙313可以为虚拟的防火墙或物理防火墙,该第一交换机311和该第二交换机314可以为虚拟交换机或物理交换机。It should be noted that the first firewall 312 and the second firewall 313 in the embodiment of the present invention have the same external address information, for example, have the same virtual Internet Protocol (Internet Protocol, IP) address and virtual media access control ( Media Access Control (MAC) address, the source address of the message sent by the first firewall 312 to the first switch 311 is the same as the source address of the message sent by the second firewall 313 to the first switch 311, the first The source address of the packet sent by the firewall 312 to the second switch 314 is the same as the source address of the packet sent by the second firewall 313 to the second switch 314 . Optionally, the first firewall 312 and the second firewall 313 may be virtual firewalls or physical firewalls, and the first switch 311 and the second switch 314 may be virtual switches or physical switches.

在一种可选的方案中,该第一交换机311上包括第一接口3111和第二接口3112,该第二交换机314上包括第三接口3141和第四接口3142,该第一交换机311通过该第一接口3111与该第一防火墙312相连,形成连接第一交换机314和第一防火墙312的第一链路315,该第一交换机311通过该第二接口3112与该第二防火墙313相连,形成连接该第一交换机311和第二防火墙的第二链路316,该第二交换机314通过第三接口3141与该第一防火墙312相连,形成连接第二交换机314和第一防火墙312的第三链路317,第二交换机314通过该第四接口3142与该第二防火墙313相连,形成连接第二交换机314和第二防火墙313的第四链路318。如图4所示,可以通过链路聚合的方式将第一链路315和第二链路316捆绑在一起形成一条逻辑链路,图4中的防火墙实际是指第一防火墙312和第二防火墙313,未单独分别画出。类似地,通过链路聚合的方式将第三链路317和第四链路318捆绑在一起形成一条逻辑链路,该链路聚合可以为手工链路聚合,也可以为基于静态链路聚合控制协议(Link Aggregation ControlProtocol,LACP)的链路聚合。第一交换机311和第二交换机314均可以基于预先设置的第一防火墙312和第二防火墙313的主备关系,并检测第一防火墙312和第二防火墙313的运行状态,然后基于该主备关系及运行状态等来确定使用哪个链路,第一交换机311和第二交换机314可以通过eth-trunk机制将需要使用的链路上的接口切换为主接口,即优先级较高的接口,使报文可以通过该主接口对应的链路发送和接收。后续为了描述简洁,描述各个设备、接口、链路等时都不再标明编号,例如,第一交换机311描述为第一交换机,不再带编号311。In an optional solution, the first switch 311 includes a first interface 3111 and a second interface 3112, and the second switch 314 includes a third interface 3141 and a fourth interface 3142, and the first switch 311 uses the The first interface 3111 is connected to the first firewall 312 to form a first link 315 connecting the first switch 314 and the first firewall 312, and the first switch 311 is connected to the second firewall 313 through the second interface 3112 to form a The second link 316 connecting the first switch 311 and the second firewall, the second switch 314 is connected with the first firewall 312 through the third interface 3141, forming a third link connecting the second switch 314 and the first firewall 312 The second switch 314 is connected to the second firewall 313 through the fourth interface 3142 to form a fourth link 318 connecting the second switch 314 and the second firewall 313 . As shown in Figure 4, the first link 315 and the second link 316 can be bundled together to form a logical link through link aggregation, and the firewall in Figure 4 actually refers to the first firewall 312 and the second firewall 313, not drawn separately. Similarly, the third link 317 and the fourth link 318 are bundled together by means of link aggregation to form a logical link. The link aggregation can be manual link aggregation or static link aggregation control Protocol (Link Aggregation Control Protocol, LACP) link aggregation. Both the first switch 311 and the second switch 314 can be based on the preset active/standby relationship between the first firewall 312 and the second firewall 313, and detect the running status of the first firewall 312 and the second firewall 313, and then based on the active/standby relationship and operating status to determine which link to use, the first switch 311 and the second switch 314 can switch the interface on the link to be used through the eth-trunk mechanism to the main interface, that is, the interface with a higher priority, so that the report Files can be sent and received through the link corresponding to the main interface. For the sake of brevity in the description, numbers will not be indicated when describing various devices, interfaces, links, etc., for example, the first switch 311 is described as the first switch without the number 311 .

步骤S202:第一交换机分别向第一防火墙和第二防火墙发送该多个报文。Step S202: the first switch sends the multiple packets to the first firewall and the second firewall respectively.

具体地,该第一交换机接收到该多个报文后将该多个报文分别转发给该第一防火墙和该第二防火墙,该第一交换机向该第一防火墙发送的多个报文和向该第二防火墙发送的多个报文相同。例如,该第一交换机通过该第一接口和第二接口发送该多个报文来实现向该第一防火墙和第二防火墙发送该多个报文。该第一交换机可以同时给该第一防火墙和第二防火墙发送该多个报文,也可以分先后顺序发送,当分先后顺序发时哪个先发哪个后发此处暂不作限制,优选的,该第一交换机同时给该第一防火墙和第二防火墙发送该多个报文。Specifically, after receiving the multiple packets, the first switch forwards the multiple packets to the first firewall and the second firewall respectively, and the multiple packets sent by the first switch to the first firewall and The multiple packets sent to the second firewall are the same. For example, the first switch sends the multiple packets through the first interface and the second interface to implement sending the multiple packets to the first firewall and the second firewall. The first switch can send the plurality of messages to the first firewall and the second firewall at the same time, and can also send them in sequence. When sending them in sequence, there is no restriction on which one is sent first and which one is sent later. Preferably, the The first switch sends the multiple packets to the first firewall and the second firewall at the same time.

步骤S203:所述第一防火墙和所述第二防火墙接收该第一交换机发送的报文,判断接收到的报文中是否存在首报文,若存在则根据该首报文建立会话。Step S203: the first firewall and the second firewall receive the packet sent by the first switch, judge whether there is a header packet in the received packet, and if so, establish a session according to the header packet.

具体地,该第一防火墙和该第二防火墙各自接收该第一交换机发送的报文,并各自对接收到的报文进行解析以判断接收到的报文中是否包含首报文;以下举例对该首报文进行说明,第一网络中的客户端A与第二网络中的客户端B进通信话之前需要先建立会话,会话建立后可以基于该会话传输数据,客户端A与客户端B建立会话需要通过发送首报文来实现,该首报文为建立TCP/IP连接时三次握手过程中的SYN(全称:synchronous)报文,客户端A与客户端B之间建立了会话后,即可基于该会话发送数据报文以传输数据。该第一防火墙和该第二防火墙在接收到报文后对报文进行解析来判断该接收到的报文是首报文还是会话建立后的数据报文。Specifically, the first firewall and the second firewall each receive the message sent by the first switch, and respectively analyze the received message to determine whether the received message contains the first message; The first message explains that a session needs to be established before client A in the first network communicates with client B in the second network. After the session is established, data can be transmitted based on the session. Client A and client B The establishment of a session needs to be realized by sending the first message, which is the SYN (full name: synchronous) message in the three-way handshake process when establishing a TCP/IP connection. After the session is established between client A and client B, A data packet can then be sent based on the session to transmit data. After receiving the message, the first firewall and the second firewall analyze the message to determine whether the received message is the first message or the data message after the session is established.

该第一防火墙判断出接收到的报文为首报文时,获取该首报文中包含的五元组,该五元组包括:源IP地址、源端口、目的IP地址、目的端口和协议号,然后根据该五元组建立会话表项,该会话表项中包含上述五元组的信息;同样地,该第二防火墙判断出接收到的报文为首报文时,也获取该首报文中的五元组并基于该五元组建立会话表项;由于该第一交换机向该第一防火墙和该第二防火墙发送的报文相同,因此只要发送的首报文在传输过程中没有出现丢包的情况,则该第一防火墙与该第二防火墙会基于接收到的相同首报文建立相同的会话表项。When the first firewall judges that the received message is the first message, it obtains the five-tuple contained in the first message, and the five-tuple includes: source IP address, source port, destination IP address, destination port and protocol number , and then establish a session entry according to the quintuple, and the session entry contains the information of the quintuple; similarly, when the second firewall determines that the received packet is a header packet, it also obtains the header packet 5-tuple in the 5-tuple and establish a session entry based on the 5-tuple; since the first switch sends the same message to the first firewall and the second firewall, as long as the first message sent does not appear in the transmission process In the case of packet loss, the first firewall and the second firewall will establish the same session entry based on the same received first packet.

以下对本发明实施例中的“五元组”进行举例说明,假设该客户端A的IP地址是192.168.1.1,用户abc使用端口20000向客户端B发起TCP连接,通过文件传输协议(File Transfer Protocol,FTP)从客户端B下载文件,客户端B的IP地址是1.1.1.1,提供服务的端口号是30000,那么客户端A向客户端B发送的首报文包含的五元组的信息如表1所示。The "quintuple" in the embodiment of the present invention is illustrated below, assuming that the IP address of the client A is 192.168.1.1, and the user abc uses port 20000 to initiate a TCP connection to the client B, through the File Transfer Protocol (File Transfer Protocol) , FTP) to download files from client B, the IP address of client B is 1.1.1.1, and the port number of the service is 30000, then the first message sent by client A to client B contains the quintuple information such as Table 1 shows.

源IP地址source IP address 源端口source port 目的IP地址Destination IP address 目的端口destination port 协议protocol 192.168.1.1192.168.1.1 2000020000 1.1.1.11.1.1.1 3000030000 TCPTCP

表1Table 1

该五元组用于该第一防火墙和该第二防火墙判断后续接收到的报文是否为已建立的该会话的报文,如果对后续接收到的报文解析后发现接收到的报文中包含的五元组与已建立的会话中的五元组相同,则表明接收到的报文属于上述会话的报文。需要说明的是,虽然表1和表2中的源IP与目的IP地址进行对换,源端口与目的端口进行了对换,但表2所示的五元组与表1所示的五元组相同。The five-tuple is used by the first firewall and the second firewall to determine whether the subsequent received message is a message of the session that has been established. If the received message is analyzed after the received message is found If the included quintuple is the same as the quintuple in the established session, it indicates that the received message belongs to the message of the above session. It should be noted that although the source IP and destination IP addresses in Table 1 and Table 2 are swapped, and the source port and destination port are swapped, the quintuple shown in Table 2 is the same as the quintuple shown in Table 1. Groups are the same.

源IP地址source IP address 源端口source port 目的IP地址Destination IP address 目的端口destination port 协议protocol 1.1.1.11.1.1.1 3000030000 192.168.1.1192.168.1.1 2000020000 TCPTCP

表2Table 2

在一种可选的方案中,该第一防火墙和第二防火墙还可以基于七元组建立会话,该七元组在五元组的基础上多了“应用”和“用户”两个因素,例如,该“应用”为上述FTP,该“用户”为上述abc。需要说明的是,在判断报文是否为已建立的该会话的报文时,除了判断该报文是否包含上述五元组,或者七元组外,还可能要判断该报文是否包含其他因素,其他因素具体有哪些因素此处暂不作限制。In an optional solution, the first firewall and the second firewall can also establish a session based on a seven-tuple, and the seven-tuple adds two factors of "application" and "user" on the basis of the five-tuple, For example, the "application" is the above-mentioned FTP, and the "user" is the above-mentioned abc. It should be noted that, when judging whether a packet is a packet of an established session, in addition to judging whether the packet contains the above-mentioned five-tuple or seven-tuple, it may also be necessary to judge whether the packet contains other factors , and other factors are not limited here.

步骤S204:该第一防火墙将接收到的报文转发给第二交换机。Step S204: the first firewall forwards the received packet to the second switch.

具体地,当该第一防火墙接收到的报文包含首报文时,该第一防火墙除了基于该首报文建立会话外,在一种可选的方案中,该第一防火墙还会判断自身是备用防火墙还是主用防火墙,如果是主用防火墙则该第一防火墙将该首报文转发给该第二交换机,由于该第一防火墙在开始时被配置为主用防火墙,因此该第一防火墙会将该首报文转发该第二交换机;在又一种可选的方案中,该第一防火墙不判断自身是主用防火墙还是备用防火墙,而是直接将接收到的该首报文转发给该第二交换机。该首报文通过该第二交换机最终发送给该客户端B后以便建立客户端A与客户端B之间的会话。Specifically, when the packet received by the first firewall contains the first packet, in addition to establishing a session based on the first packet, the first firewall also judges its own Is it a standby firewall or an active firewall? If it is an active firewall, the first firewall forwards the first packet to the second switch. Since the first firewall is initially configured as an active firewall, the first firewall The first packet will be forwarded to the second switch; in another optional solution, the first firewall does not judge whether it is the active firewall or the standby firewall, but directly forwards the received first packet to the the second switch. The first packet is finally sent to the client B through the second switch so as to establish a session between the client A and the client B.

进一步地,当该第一防火墙接收该第一交换机发送的报文中包含除首报文以外的数据报文时,该第一防火墙根据已经建立的会话表项判断该数据报文是否为该会话表项对应的会话的报文,若该数据报文是该会话的报文,在一种可选的方案中,该第一防火墙在获知自身为主用防火墙后,根据与该会话对应的过滤策略或转发策略对报文进行处理,例如根据与该会话对应的策略将该数据报文转发给该第二交换机;在又一种可选的方案中,该第一防火墙直接将接收到的该数据报文转发给该第二交换机。Further, when the first firewall receives a data packet other than the first packet in the packet sent by the first switch, the first firewall judges whether the data packet is the session If the data packet is a packet of the session corresponding to the entry, in an optional solution, after the first firewall knows that it is the active firewall, it policy or forwarding policy to process the message, for example forwarding the data message to the second switch according to the policy corresponding to the session; in yet another optional solution, the first firewall directly forwards the received The data packet is forwarded to the second switch.

第二防火墙的对报文的处理方法与第一防火墙类似。当该第二防火墙接收到的报文包含首报文时,该第二防火墙除了基于该首报文建立会话外,在一种可选的方案中,该第二防火墙还会判断自身是备用防火墙还是主用防火墙,如果是备用防火墙,则该第二防火墙接收到该首报文并基于该首报文建立会话后,丢弃掉该首报文,由于该第二防火墙在开始时被配置为备用防火墙,因此该第二防火墙会丢弃掉该首报文。在又一种可选的方案中,该第二防火墙不判断自身是主用防火墙还是备用防火墙,而是直接将接收到的该首报文转发给该第二交换机。The packet processing method of the second firewall is similar to that of the first firewall. When the packet received by the second firewall contains the first packet, in addition to establishing a session based on the first packet, in an optional solution, the second firewall will also determine that it is a standby firewall It is still the active firewall. If it is a backup firewall, the second firewall discards the first packet after receiving the first packet and establishing a session based on the first packet. Since the second firewall is initially configured as a backup Firewall, so the second firewall will discard the first packet. In yet another optional solution, the second firewall does not judge whether it is an active firewall or a standby firewall, but directly forwards the received first packet to the second switch.

进一步地,当第二防火墙接收该第一交换机发送的报文中包含除首报文以外的数据报文时,该第二防火墙根据已经建立的会话表项判断该数据报文是否为该会话表项对应的会话的报文,若该数据报文是该会话的报文,在一种可选的方案中,该第二防火墙获知自身为备用防火墙后,将该数据报文丢弃掉;在又一种可选的方案中,该第二防火墙直接将接收到的该数据报文转发给该第二交换机。Further, when the second firewall receives a data packet other than the first packet in the packet sent by the first switch, the second firewall judges whether the data packet is the session entry according to the established session entry. Item corresponding to the message of the session, if the data message is the message of the session, in an optional solution, after the second firewall learns that it is a backup firewall, the data message is discarded; In an optional solution, the second firewall directly forwards the received data packet to the second switch.

以下举例说明该第一防火墙和该第二防火墙如何判断自己是主用防火墙还是备用防火墙:例如,当该第一防火墙和该第二防火墙处于VRRP协议中的相同备份组时,该第一防火墙和该第二防火墙可以通过VRRP协议来获知自身在备份组中的优先级,如果该第一防火墙的优先级不是最高的则表明该第一防火墙在该备份组中属于备用防火墙,如果该第一防火墙的优先级最高的则表明该第一防火墙在该备份组中属于主用防火墙;如果该第二防火墙的优先级不是最高的则表明该第二防火墙在该备份组中属于备用防火墙,如果该第二防火墙的优先级最高的则表明该第二防火墙在该备份组中属于主用防火墙;该第一防火墙还可以通过其他方式获知自身优先级的高低,例如,该第一交换机或该第二交换机发送通知消息给该第二防火墙和第二防火墙,以告知哪个为主用防火墙,哪个为备用防火墙。The following example illustrates how the first firewall and the second firewall determine whether they are active firewalls or backup firewalls: For example, when the first firewall and the second firewall are in the same backup group in the VRRP protocol, the first firewall and the second firewall The second firewall can know its own priority in the backup group through the VRRP protocol. If the priority of the first firewall is not the highest, it indicates that the first firewall belongs to the backup firewall in the backup group. If the first firewall If the priority of the second firewall is not the highest, it indicates that the second firewall belongs to the standby firewall in the backup group. The highest priority of the second firewall indicates that the second firewall belongs to the active firewall in the backup group; the first firewall can also learn the level of its own priority through other methods, for example, the first switch or the second switch A notification message is sent to the second firewall and the second firewall to inform which one is the active firewall and which one is the standby firewall.

步骤S205:第二交换机向该第一防火墙发送来自该第二网络的报文。Step S205: the second switch sends the message from the second network to the first firewall.

具体地,当客户端A与客户端B之间的会话建立成功后,客户端B可以通过该第二网络向客户端A发送该会话的报文,当发送的该会话的报文转发到该第二交换机后,第二交换机将接收到的报文转发给第一防火墙和第二防火墙,例如,通过第三接口转发该会话的报文和通过第四接口转发该会话的报文。同样的,客户端A可以通过该第一网络向该客户端B发送该会话的报文,当发送的该会话的报文转发到该第一交换机后,该第一交换机将接收到的报文转发给该第一防火墙和该第二防火墙,例如,通过第一接口转发该会话的报文和通过第二接口转发该会话的报文。Specifically, when the session between client A and client B is successfully established, client B can send the message of the session to client A through the second network, and when the sent message of the session is forwarded to the After the second switch, the second switch forwards the received message to the first firewall and the second firewall, for example, forwarding the message of the session through the third interface and forwarding the message of the session through the fourth interface. Similarly, the client A can send the session message to the client B through the first network, and after the sent message of the session is forwarded to the first switch, the first switch will receive the message Forwarding to the first firewall and the second firewall, for example, forwarding the packet of the session through the first interface and forwarding the packet of the session through the second interface.

步骤S206:该第一防火墙接收并向该第一交换机转发该会话的报文。Step S206: the first firewall receives and forwards the packet of the session to the first switch.

具体地,该第一防火墙接收该第二交换机转发的该报文,在一种可选的方案中,该第一防火墙在获知自身为主用防火墙后判断该报文中是否包含上述会话表项中的五元组,若包含则将该报文转发给第一交换机。在又一种可选的方案中,该第一防火墙无需确认自身为主用防火墙还是备用防火墙,而是直接判断接收到的该报文中是否包含上述会话表项中的五元组,若包含则将该报文转发给第一交换机。Specifically, the first firewall receives the message forwarded by the second switch. In an optional solution, the first firewall determines whether the message contains the session entry after learning that it is the active firewall. If the five-tuple in is contained, the packet is forwarded to the first switch. In yet another optional solution, the first firewall does not need to confirm whether it is the active firewall or the standby firewall, but directly determines whether the received packet contains the quintuple in the above session entry, and if it contains Then forward the packet to the first switch.

当上述第二交换机给该第二防火墙发送了与向第一防火墙发送的报文同样的报文时,在一种可选的方案中,该第二防火墙在获知自身为备用防火墙时,丢弃接收到的该会话的报文,在又一种可选的方案中,该第二防火墙接收该第二交换机发送的该报文,无需确认自身为主用防火墙还是备用防火墙,直接判断该报文中是否包含已建立的会话表中的五元组信息,若包含则将接收到的该报文转发给该第一交换机。When the above-mentioned second switch sends the same message to the second firewall as the message sent to the first firewall, in an optional solution, when the second firewall knows that it is a standby firewall, it discards the received message. In yet another optional solution, the second firewall receives the message sent by the second switch without confirming whether it is the active firewall or the standby firewall, and directly judges whether the message is in the message. Whether to include the five-tuple information in the established session table, and if yes, forward the received message to the first switch.

步骤S207:该第一交换机接收该第一防火墙发送的报文。Step S207: the first switch receives the packet sent by the first firewall.

步骤S208:该第一交换机向该第一网络转发该第一防火墙发送报文。Step S208: the first switch forwards the packet sent by the first firewall to the first network.

具体地,该第一交换机接收到该第一防火墙发送的报文后,将接收到的报文转发到该第一网络中。需要说明的是,当上述第二防火墙有向该第一交换机转发上述会话的报文时,该第一交换机不接收该第二防火墙发送的报文,或者该第一交换机接收该第二防火墙发送的报文,但是丢弃该第二防火墙发送的报文,例如,该第一交换机可以将与该第一防火墙相连的第一接口设置为主接口,将与该第二防火墙相连的第二接口设置为备接口,该第一交换机通过该第一接口和该第二接口接收报文,但是丢弃通过备接口接收到的报文,或者该第一交换机根本就不通过作为备接口的第二接口接收报文。Specifically, after receiving the packet sent by the first firewall, the first switch forwards the received packet to the first network. It should be noted that when the above-mentioned second firewall forwards the packet of the above-mentioned session to the first switch, the first switch does not receive the packet sent by the second firewall, or the first switch receives the packet sent by the second firewall. packets, but discard the packets sent by the second firewall. For example, the first switch can set the first interface connected to the first firewall as the main interface, and set the second interface connected to the second firewall as the main interface. For the backup interface, the first switch receives packets through the first interface and the second interface, but discards the packets received through the backup interface, or the first switch does not receive packets through the second interface as the backup interface at all. message.

通过执行步骤S201~208,该第一防火墙和该第二防火墙根据相同的首报文建立了同一会话的会话表项,该第一防火墙未故障时转发该会话的报文,当该第一防火墙故障时无需将该会话表项备份到该第二防火墙,该第二防火墙自身建立的上述会话表项即可用于接替该会话的报文的转发。By executing steps S201-208, the first firewall and the second firewall establish a session entry of the same session according to the same first message, and forward the message of the session when the first firewall is not faulty, and when the first firewall In case of a failure, there is no need to back up the session entry to the second firewall, and the above session entry established by the second firewall itself can be used to forward packets of the session.

以下通过步骤S209~S212描述发生主备倒换后,第二防火墙作为新的主用防火墙接替该报文转发的一种实现方式。In the following, steps S209-S212 describe an implementation manner in which the second firewall acts as the new active firewall to take over the forwarding of the message after the master-standby switchover occurs.

步骤S209:该第二交换机向该第二防火墙发送该会话的报文。Step S209: the second switch sends the packet of the session to the second firewall.

具体地,该第二交换机可以实时或者定时检测该第一防火墙是否故障;也可以由其他设备来检测该第一防火墙是否故障,然后将检测的结果通知给该第二交换机。该第二交换机检测该第一防火墙是否故障的方式可以具体为:通过双向转发检测(Bidirectional Forwarding Detection,BFD)机制检测与该第一防火墙相连的链路,或者该第一防火墙所在的设备的软件,或者该第一防火墙所在的设备的网卡是否故障;或者判断持续未接收到该第一防火墙发送的报文的时间是否超过预先设定的一个时间阈值,超过该时间阈值则表明故障。当然还可以通过其他方式检测该第一防火墙是否故障,其他方式此处不一一举例。Specifically, the second switch may detect whether the first firewall is faulty in real time or periodically; other devices may also detect whether the first firewall is faulty, and then notify the second switch of the detection result. The manner in which the second switch detects whether the first firewall is faulty may specifically be: detecting the link connected to the first firewall through a bidirectional forwarding detection (Bidirectional Forwarding Detection, BFD) mechanism, or the software of the device where the first firewall is located , or whether the network card of the device where the first firewall is located is faulty; or judge whether the time for not receiving the message sent by the first firewall exceeds a preset time threshold, and exceeding the time threshold indicates a failure. Of course, other methods may also be used to detect whether the first firewall is faulty, and other methods are not listed here.

当检测出该第一防火墙故障或者所述第一交换机与所述第一防火墙之间的链路中断时,该第二交换机将该第二防火墙作为主用防火墙,如果该第二交换机再接收到来自第二网络的报文,在一种可选的方案中,该第二交换机向该第二防火墙发送该报文,而不再向该第一防火墙发送该报文,例如,该第二交换机将第四接口设置为新的主接口,将第三接口设置为备接口,然后通过作为新主接口的第四接口发送报文,不通过作为备接口的第三接口发送报文。在又一种可选的方案中,该第二交换机重新设置主接口和备接口之后,向该第一防火墙和该第二防火墙都发送该报文。在又一种可选的方案中,该第二交换机向该第二防火墙发送该报文,并且检测该第一防火墙故障或者所述第一交换机与所述第一防火墙之间的链路中断后是否恢复正常了,如果恢复正常了,那么该第二交换机下一次接收到来自该第二网络的报文时,将接收到的该报文发送给该第一防火墙和该第二防火墙。其他的可选方案在这里不再一一列举。When detecting that the first firewall fails or the link between the first switch and the first firewall is interrupted, the second switch uses the second firewall as the active firewall, and if the second switch receives A packet from the second network, in an optional solution, the second switch sends the packet to the second firewall instead of sending the packet to the first firewall, for example, the second switch The fourth interface is set as the new main interface, the third interface is set as the standby interface, and then the message is sent through the fourth interface as the new main interface, and the message is not sent through the third interface as the standby interface. In yet another optional solution, after the second switch resets the primary interface and the standby interface, it sends the message to both the first firewall and the second firewall. In yet another optional solution, the second switch sends the message to the second firewall, and after detecting that the first firewall fails or the link between the first switch and the first firewall is interrupted, Whether it is back to normal, if it is back to normal, when the second switch receives a message from the second network next time, it will send the received message to the first firewall and the second firewall. Other alternatives are not listed here one by one.

步骤S210:该第二防火墙接收并向第一交换机转发该会话的报文。Step S210: the second firewall receives and forwards the packet of the session to the first switch.

具体地,该第二防火墙接收该第二交换机发送的报文并判断接收到的报文中是否存在首报文;当该第二防火墙接收到的报文包含首报文时,该第二防火墙除了基于该首报文建立会话外,在一种可选的方案中,该第二防火墙还会判断自身是备用防火墙还是主用防火墙,如果是主用防火墙则该第二防火墙将该首报文转发给该第一交换机,由于该第一防火墙已经故障,因此该第二防火墙已被配置为了主用防火墙,因此该第二防火墙会将该首报文转发该第一交换机。在又一种可选的方案中,该第二防火墙不判断自身是主用防火墙还是备用防火墙,而是直接将接收到的该首报文转发给该第一交换机。Specifically, the second firewall receives the message sent by the second switch and judges whether there is a first message in the received message; when the message received by the second firewall contains the first message, the second firewall In addition to establishing a session based on the first packet, in an optional solution, the second firewall will also determine whether it is a standby firewall or an active firewall. If it is an active firewall, the second firewall will use the first packet Forwarding to the first switch, because the first firewall has failed, so the second firewall has been configured as the active firewall, so the second firewall will forward the first packet to the first switch. In yet another optional solution, the second firewall does not judge whether it is an active firewall or a standby firewall, but directly forwards the received first packet to the first switch.

进一步地,当该第二防火墙接收该第二交换机发送的报文中包含除首报文以外的数据报文时,该第二防火墙根据已经建立的会话表项判断该数据报文是否为该会话表项对应的会话的报文,若该数据报文是该会话的报文,在一种可选的方案中,该第二防火墙在获知自身为主用防火墙后,将该数据报文转发给该第一交换机;在又一种可选的方案中,该第二防火墙省略确认自身为主用防火墙或备用防火墙,而是直接将接收到的该数据报文转发给该第一交换机。Further, when the second firewall receives a data packet other than the first packet in the packet sent by the second switch, the second firewall judges whether the data packet is the session If the data packet is a packet of the session corresponding to the entry, in an optional solution, the second firewall forwards the data packet to the The first switch; in yet another optional solution, the second firewall omits confirming itself as the active firewall or the backup firewall, but directly forwards the received data packet to the first switch.

需要说明的是,当该第一防火墙也接收到该第二交换机发送的报文,且该报文中包含首报文时,该第一防火墙除了基于该首报文建立会话外,在一种可选的方案中,该第一防火墙还会判断自身是备用防火墙还是主用防火墙,如果是备用防火墙则该第一防火墙接收到该首报文并基于该首报文建立会话后,丢弃掉该首报文。由于该第一防火墙在步骤S209中被检测出故障,因此该第一防火墙被配置为了备用防火墙而不再是主用防火墙,因此该第一防火墙会丢弃掉该首报文。在又一种可选的方案中,该第一防火墙省略判断自身是主用防火墙还是备用防火墙,而是直接将接收到的该首报文转发给该第一交换机。It should be noted that, when the first firewall also receives the message sent by the second switch, and the message contains the first message, the first firewall establishes a session based on the first message, in a In an optional solution, the first firewall will also judge whether it is a backup firewall or an active firewall. If it is a backup firewall, the first firewall will discard the first packet after receiving the first packet and establishing a session based on the first packet. first message. Since the first firewall is detected to be faulty in step S209, the first firewall is configured as a standby firewall and is no longer the active firewall, so the first firewall discards the first packet. In yet another optional solution, the first firewall omits judging whether it is the active firewall or the standby firewall, but directly forwards the received first packet to the first switch.

进一步地,当第一防火墙接收该第二交换机发送的报文中包含除首报文以外的数据报文时,该第一防火墙根据已经建立的会话表项判断该数据报文是否为该会话表项对应的会话的报文,若该数据报文是该会话的报文,在一种可选的方案中,该第一防火墙获知自身为备用防火墙后,将该数据报文丢弃掉;在又一种可选的方案中,该第一防火墙省略判断自身是主用防火墙还是备用防火墙,直接将接收到的该数据报文转发给该第一交换机。Further, when the first firewall receives a data packet other than the first packet in the packet sent by the second switch, the first firewall judges whether the data packet is the session entry according to the established session entry. Item corresponding to the message of the session, if the data message is the message of the session, in an optional solution, after the first firewall learns that it is a backup firewall, the data message is discarded; In an optional solution, the first firewall skips judging whether it is the active firewall or the standby firewall, and directly forwards the received data packet to the first switch.

步骤S211:该第一交换机接收该第二防火墙发送的报文。Step S211: the first switch receives the packet sent by the second firewall.

步骤S212:该第一交换机向该第一网络转发该第二防火墙发送报文。Step S212: the first switch forwards the message sent by the second firewall to the first network.

具体地,该第一交换机可以实时或者定时检测该第一防火墙是否故障;也可以由其他设备来检测该第一防火墙是否故障,然后将检测的结果通知给该第一交换机。该第一交换机检测该第一防火墙是否故障的方式可以具体为:通过BFD机制检测与该第一防火墙相连的链路,或者该第一防火墙所在的设备的软件,或者该第一防火墙所在的设备的网卡是否故障;或者判断持续未接收到该第一防火墙发送的报文的时间是否超过预先设定的一个时间阈值,超过该时间阈值则表明故障。当然还可以通过其他方式检测该第一防火墙是否故障,其他方式此处不一一举例。Specifically, the first switch may detect whether the first firewall is faulty in real time or periodically; other devices may also detect whether the first firewall is faulty, and then notify the first switch of the detection result. The way for the first switch to detect whether the first firewall is faulty may specifically be: detecting the link connected to the first firewall through the BFD mechanism, or the software of the device where the first firewall is located, or the device where the first firewall is located Whether the network card of the first firewall is faulty; or judge whether the time for not receiving the message sent by the first firewall exceeds a preset time threshold, and exceeding the time threshold indicates a fault. Of course, other methods may also be used to detect whether the first firewall is faulty, and other methods are not listed here.

如果该第一交换机在第一防火墙未故障且该第一防火墙与该第一交换机之间的链路未中断时,不接收该第二防火墙发送的报文,则在检测出该第一防火墙故障或者该链路中断时,将该第二防火墙作为主用防火墙,并接收该第二防火墙发送的报文并将该报文转发到第一网络中。If the first switch does not receive the message sent by the second firewall when the first firewall is not faulty and the link between the first firewall and the first switch is not interrupted, then when the first firewall fault is detected, Or when the link is interrupted, the second firewall is used as the active firewall, and receives the message sent by the second firewall and forwards the message to the first network.

如果该第一交换机在第一防火墙未故障且该第一防火墙与该第一交换机之间的链路未中断时,接收并丢弃该第二防火墙发送的报文,则在检测出该第一防火墙故障或者该链路中断时,将该第二防火墙作为主用防火墙,不再丢弃该第二防火墙发送的报文而是将该报文转发到第一网络中。If the first switch receives and discards the packet sent by the second firewall when the first firewall is not faulty and the link between the first firewall and the first switch is not interrupted, then when the first firewall is detected When a fault occurs or the link is interrupted, the second firewall is used as the active firewall, and the message sent by the second firewall is no longer discarded but forwarded to the first network.

例如,该第一交换机将第二接口设置为新的主接口,将第一接口设置为备接口,第一交换机可以通过作为新主接口的第二接口接收报文,并将通过该第二接口接收到的报文转发给该第一网络。For example, the first switch sets the second interface as the new main interface, and sets the first interface as the standby interface, the first switch can receive packets through the second interface as the new main interface, and will pass through the second interface The received message is forwarded to the first network.

在图2所描述的方法中,第一交换机向第一防火墙和第二防火墙发送同样的报文,使得该第一防火墙和第二防火墙根据该报文中的首报文建立相同的会话表项,这样一来,该第二防火墙不需要从该第一防火墙上备份该会话表项,当第一防火墙出现故障时,该第二防火墙可以直接基于自身建立的会话表项接替该第一防火墙上的业务,避免了业务中断。In the method described in FIG. 2, the first switch sends the same message to the first firewall and the second firewall, so that the first firewall and the second firewall establish the same session entry according to the first message in the message In this way, the second firewall does not need to back up the session entry from the first firewall. When the first firewall fails, the second firewall can directly replace the session entry on the first firewall based on the session entry established by itself. business, avoiding business interruption.

上述详细阐述了本发明实施例的方法,为了便于更好地实施本发明实施例的上述方案,相应地,下面提供了本发明实施例的交换机。The method in the embodiment of the present invention has been described in detail above. In order to facilitate better implementation of the above solutions in the embodiment of the present invention, correspondingly, the switch in the embodiment of the present invention is provided below.

请参见图5,图5是本发明实施例提供的一种第一交换机50,该第一交换机50包括处理器501、存储器502和网络接口503,所述处理器501、存储器502和网络接口503通过总线相互连接。Please refer to FIG. 5. FIG. 5 is a first switch 50 provided by an embodiment of the present invention. The first switch 50 includes a processor 501, a memory 502, and a network interface 503. The processor 501, memory 502, and network interface 503 connected to each other via a bus.

存储器502包括但不限于是随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或者快闪存储器)、或便携式只读存储器(CD-ROM)。Memory 502 includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), or portable read-only memory (CD-ROM).

处理器501可以是一个或多个中央处理器(Central Processing Unit,简称CPU),在处理器501是一个CPU的情况下,该CPU可以是单核CPU,也可以是多核CPU。The processor 501 may be one or more central processing units (Central Processing Unit, CPU for short). In the case where the processor 501 is a CPU, the CPU may be a single-core CPU or a multi-core CPU.

网络接口503可以是有线接口,例如光纤分布式数据接口(Fiber DistributedData Interface,简称FDDI)、千兆以太网(Gigabit Ethernet,简称GE)接口;网络接口503也可以是无线接口。The network interface 503 may be a wired interface, such as a Fiber Distributed Data Interface (FDDI for short) or a Gigabit Ethernet (GE for short); the network interface 503 may also be a wireless interface.

存储器502还用于存储会话表项、相关指令及数据等信息。The memory 502 is also used to store information such as session entries, related instructions, and data.

所述第一交换机50中的处理器501用于读取所述存储器502中存储的程序代码后,执行以下操作:The processor 501 in the first switch 50 is configured to perform the following operations after reading the program code stored in the memory 502:

通过所述网络接口503接收来自于第一网络的多个报文,所述第一交换机50与第一防火墙、第二防火墙和所述第一网络相连,所述多个报文是所述第一网络与第二网络之间传输的报文,所述第一防火墙为主用防火墙,所述第二防火墙为备用防火墙,所述第一防火墙和第二防火墙分别与所述第一交换机50和第二交换机连接,所述第二交换机还与所述第二网络连接;A plurality of messages from the first network are received through the network interface 503, the first switch 50 is connected to the first firewall, the second firewall and the first network, and the plurality of messages are the first network For messages transmitted between a network and a second network, the first firewall is the active firewall, the second firewall is the standby firewall, the first firewall and the second firewall are connected to the first switch 50 and the second firewall respectively. connected to a second switch, the second switch is also connected to the second network;

通过所述网络接口503分别向所述第一防火墙和所述第二防火墙发送所述多个报文,通过所述网络接口503向所述第一防火墙和所述第二防火墙发送的报文是相同的,以使所述第一防火墙和所述第二防火墙均根据所述多个报文中的会话首报文建立所述会话首报文所属会话的会话表项,所述会话表项包含五元组,所述五元组用于判断流经防火墙的报文是否属于所述会话;Send the multiple packets to the first firewall and the second firewall respectively through the network interface 503, and the packets sent to the first firewall and the second firewall through the network interface 503 are The same, so that both the first firewall and the second firewall establish the session entry of the session to which the session header packet belongs according to the session header packet in the plurality of packets, and the session entry includes A quintuple, the quintuple is used to determine whether the message flowing through the firewall belongs to the session;

通过所述网络接口503接收所述第一防火墙发送的来自于所述第二网络的所述会话的报文;receiving the session packet from the second network sent by the first firewall through the network interface 503;

通过所述网络接口503向所述第一网络转发所述来自于所述第二网络的所述会话的报文。Forward the packet of the session from the second network to the first network through the network interface 503 .

通过执行上述操作,第一交换机50向第一防火墙和第二防火墙发送同样的报文,使得该第一防火墙和第二防火墙根据该报文中的首报文建立相同的会话表项,这样一来,该第二防火墙不需要从该第一防火墙上备份该会话表项,当第一防火墙出现故障时,该第二防火墙可以直接基于自身建立的会话表项接替该第一防火墙上的业务,避免了业务中断。By performing the above operations, the first switch 50 sends the same message to the first firewall and the second firewall, so that the first firewall and the second firewall establish the same session entry according to the first message in the message, so that Therefore, the second firewall does not need to back up the session entry from the first firewall. When the first firewall fails, the second firewall can directly take over the services on the first firewall based on the session entry established by itself. Business interruption is avoided.

在一种可选的方案中,所述处理器501通过所述网络接口503分别向所述第一防火墙和所述第二防火墙发送所述多个报文之后,所述处理器501还用于:In an optional solution, after the processor 501 respectively sends the multiple packets to the first firewall and the second firewall through the network interface 503, the processor 501 is further configured to: :

检测所述第一防火墙是否发生故障,或者所述第一交换机50与所述第一防火墙之间的链路是否中断;Detecting whether the first firewall fails, or whether the link between the first switch 50 and the first firewall is interrupted;

如果所述第一防火墙故障、或者所述第一交换机50与所述第一防火墙之间的链路中断,则通过所述网络接口503接收并转发所述第二防火墙发送的来自于所述第二网络的所述会话的报文。If the first firewall fails, or the link between the first switch 50 and the first firewall is interrupted, the network interface 503 receives and forwards the data sent by the second firewall from the first firewall. The packets of the session of the two networks.

在又一种可选的方案中,所述处理器501检测所述第一防火墙是否发生故障,具体为:通过双向转发检测机制BFD检测所述第一防火墙是否故障。In yet another optional solution, the processor 501 detects whether the first firewall fails, specifically: detecting whether the first firewall fails through a bidirectional forwarding detection mechanism BFD.

具体地,交换机自身检测该第一防火墙是否故障,以便在检测到该第一防火墙故障时及时调整报文转发策略,提升了交换机的性能。Specifically, the switch itself detects whether the first firewall is faulty, so as to adjust the packet forwarding policy in time when the first firewall is detected to be faulty, thereby improving the performance of the switch.

在又一种可选的方案中,所述处理器501检测到所述第一防火墙故障、或者所述第一交换机50与所述第一防火墙之间的链路中断之前,所述处理器501还用于:In yet another optional solution, before the processor 501 detects that the first firewall fails, or the link between the first switch 50 and the first firewall is interrupted, the processor 501 Also used for:

不接收所述第二防火墙发送的来自于所述第二网络的所述会话的报文,或者通过所述网络接口503接收所述第二防火墙发送的来自于所述第二网络的所述会话的报文,并丢弃所述第二防火墙发送的来自于所述第二网络的所述会话的报文。Not receiving the session packet from the second network sent by the second firewall, or receiving the session from the second network sent by the second firewall through the network interface 503 and discarding the packets sent by the second firewall from the session on the second network.

在又一种可选的方案中,所述网络接口503包括所述第一交换机50与所述第一防火墙相连的第一接口,以及所述第一交换机50与所述第二防火墙相连的第二接口,In yet another optional solution, the network interface 503 includes a first interface connecting the first switch 50 to the first firewall, and a first interface connecting the first switch 50 to the second firewall. two interfaces,

所述处理器501检测到所述第一防火墙故障、或者所述第一交换机50与所述第一防火墙之间的链路中断之前,所述第一接口被设置为主接口,所述第二接口被设置为备接口;所述第一交换机50通过所述第一接口接收并转发所述第一防火墙发送的来自于所述第二网络的所述会话的报文,所述第一交换机50不接收所述第二防火墙发送的来自于所述第二网络的所述会话的报文,或者通过所述第二接口接收所述第二防火墙发送的来自于所述第二网络的所述会话的报文,并丢弃通过所述第二接口接收到的来自于所述第二网络的所述会话的报文;Before the processor 501 detects that the first firewall fails, or the link between the first switch 50 and the first firewall is interrupted, the first interface is set as the main interface, and the second The interface is set as a standby interface; the first switch 50 receives and forwards the message from the session of the second network sent by the first firewall through the first interface, and the first switch 50 Not receiving the session packet from the second network sent by the second firewall, or receiving the session from the second network sent by the second firewall through the second interface and discarding packets received through the second interface from the session of the second network;

所述处理器501检测到所述第一防火墙故障、或者所述第一交换机50与所述第一防火墙之间的链路中断之后,将所述第一接口设置为备接口,将所述第二接口设置为主接口,通过所述第二接口接收并转发所述第二防火墙发送的来自于所述第二网络的所述会话的报文。After the processor 501 detects that the first firewall is faulty or the link between the first switch 50 and the first firewall is interrupted, it sets the first interface as a standby interface, and sets the second The second interface is set as the main interface, and receives and forwards the message of the session from the second network sent by the second firewall through the second interface.

需要说明的是,该交换机50的具体实现还可以对应参照图2所示的方法实施例的相应描述,此处不再赘述。It should be noted that, for the specific implementation of the switch 50, reference may also be made to the corresponding description of the method embodiment shown in FIG. 2 , which will not be repeated here.

通过执行上述操作,第一交换机50向第一防火墙和第二防火墙发送同样的报文,使得该第一防火墙和第二防火墙根据该报文中的首报文建立相同的会话表项,这样一来,该第二防火墙不需要从该第一防火墙上备份该会话表项,当第一防火墙出现故障时,该第二防火墙可以直接基于自身建立的会话表项接替该第一防火墙上的业务,避免了业务中断。By performing the above operations, the first switch 50 sends the same message to the first firewall and the second firewall, so that the first firewall and the second firewall establish the same session entry according to the first message in the message, so that Therefore, the second firewall does not need to back up the session entry from the first firewall. When the first firewall fails, the second firewall can directly take over the services on the first firewall based on the session entry established by itself. Business interruption is avoided.

请参见图6,图6是本发明实施例提供的又一种第一交换机60的结构示意图,该第一交换机60可以包括接收单元601和发送单元602,接收单元601和发送单元602的详细描述如下。Please refer to FIG. 6. FIG. 6 is a schematic structural diagram of another first switch 60 provided by an embodiment of the present invention. The first switch 60 may include a receiving unit 601 and a sending unit 602. Detailed descriptions of the receiving unit 601 and the sending unit 602 as follows.

接收单元601用于接收来自于第一网络的多个报文,所述第一交换机60与第一防火墙、第二防火墙和所述第一网络相连,所述多个报文是所述第一网络与第二网络之间传输的报文,所述第一防火墙为主用防火墙,所述第二防火墙为备用防火墙,所述第一防火墙和第二防火墙分别与所述第一交换机60和第二交换机连接,所述第二交换机还与所述第二网络连接;The receiving unit 601 is configured to receive multiple packets from the first network, the first switch 60 is connected to the first firewall, the second firewall, and the first network, and the multiple packets are the first For messages transmitted between the network and the second network, the first firewall is the active firewall, the second firewall is the backup firewall, and the first firewall and the second firewall are connected to the first switch 60 and the second firewall respectively. Two switches are connected, and the second switch is also connected to the second network;

发送单元602用于分别向所述第一防火墙和所述第二防火墙发送所述多个报文,所述第一交换机60向所述第一防火墙和所述第二防火墙发送的报文是相同的,以使所述第一防火墙和所述第二防火墙均根据所述多个报文中的会话首报文建立所述会话首报文所属会话的会话表项,所述会话表项包含五元组,所述五元组用于判断流经防火墙的报文是否属于所述会话;The sending unit 602 is configured to send the plurality of packets to the first firewall and the second firewall respectively, and the packets sent by the first switch 60 to the first firewall and the second firewall are the same so that both the first firewall and the second firewall establish a session entry for the session to which the session header packet belongs according to the session header packets in the plurality of packets, and the session entry includes five A tuple, the five-tuple is used to determine whether the message flowing through the firewall belongs to the session;

接收单元601还用于接收所述第一防火墙发送的来自于所述第二网络的所述会话的报文;The receiving unit 601 is further configured to receive the packet sent by the first firewall from the session of the second network;

发送单元602还用于向所述第一网络转发所述来自于所述第二网络的所述会话的报文。The sending unit 602 is further configured to forward the packet of the session from the second network to the first network.

通过运行上述单元,第一交换机60向第一防火墙和第二防火墙发送同样的报文,使得该第一防火墙和第二防火墙根据该报文中的首报文建立相同的会话表项,这样一来,该第二防火墙不需要从该第一防火墙上备份该会话表项,当第一防火墙出现故障时,该第二防火墙可以直接基于自身建立的会话表项接替该第一防火墙上的业务,避免了业务中断。By running the above units, the first switch 60 sends the same message to the first firewall and the second firewall, so that the first firewall and the second firewall establish the same session entry according to the first message in the message, so that Therefore, the second firewall does not need to back up the session entry from the first firewall. When the first firewall fails, the second firewall can directly take over the services on the first firewall based on the session entry established by itself. Business interruption is avoided.

在一种可选的方案中,所述第一交换机60还包括检测单元,该检测单元用于在发送单元602分别向所述第一防火墙和所述第二防火墙发送所述多个报文之后,检测所述第一防火墙是否发生故障,或者所述第一交换机60与所述第一防火墙之间的链路是否中断;In an optional solution, the first switch 60 further includes a detection unit, the detection unit is configured to send the plurality of packets to the first firewall and the second firewall respectively after the sending unit 602 , detecting whether the first firewall fails, or whether the link between the first switch 60 and the first firewall is interrupted;

如果所述第一交换机60检测到所述第一防火墙故障、或者所述第一交换机60与所述第一防火墙之间的链路中断,则接收单元601还用于接收所述第二防火墙发送的来自于所述第二网络的所述会话的报文,所述发送单元602还用于转发所述第二防火墙发送的来自于所述第二网络的所述会话的报文。If the first switch 60 detects that the first firewall fails, or the link between the first switch 60 and the first firewall is interrupted, the receiving unit 601 is further configured to receive the The packet of the session from the second network, the sending unit 602 is further configured to forward the packet of the session from the second network sent by the second firewall.

在又一种可选的方案中,所述检测单元具体用于通过双向转发检测机制BFD检测所述第一防火墙是否故障。In yet another optional solution, the detection unit is specifically configured to detect whether the first firewall is faulty through a bidirectional forwarding detection mechanism BFD.

具体地,交换机自身检测该第一防火墙是否故障,以便在检测到该第一防火墙故障时及时调整报文转发策略,提升了交换机的性能。Specifically, the switch itself detects whether the first firewall is faulty, so as to adjust the packet forwarding policy in time when the first firewall is detected to be faulty, thereby improving the performance of the switch.

在又一种可选的方案中,所述第一交换机60还包括丢弃单元,在所述检测单元检测到所述第一防火墙故障、或者所述第一交换机60与所述第一防火墙之间的链路中断之前,接收单元601还用于不接收所述第二防火墙发送的来自于所述第二网络的所述会话的报文,或者接收单元601用于接收所述第二防火墙发送的来自于所述第二网络的所述会话的报文,所述丢弃单元用于丢弃接收单元601接收到的所述第二防火墙发送的来自于所述第二网络的所述会话的报文。In yet another optional solution, the first switch 60 further includes a discarding unit, and when the detection unit detects a failure of the first firewall, or between the first switch 60 and the first firewall Before the link of the network is interrupted, the receiving unit 601 is further configured not to receive the packet sent by the second firewall from the session of the second network, or the receiving unit 601 is configured to receive the packet sent by the second firewall. The packet from the session of the second network, the discarding unit is configured to discard the packet received by the receiving unit 601 and sent by the second firewall from the session of the second network.

在又一种可选的方案中,所述第一交换机60包括所述第一交换机60与所述第一防火墙相连的第一接口,以及所述第一交换机60与所述第二防火墙相连的第二接口,In yet another optional solution, the first switch 60 includes a first interface through which the first switch 60 is connected to the first firewall, and an interface through which the first switch 60 is connected to the second firewall. the second interface,

检测单元检测到所述第一防火墙故障、或者所述第一交换机60与所述第一防火墙之间的链路中断之前,所述第一接口被设置为主接口,所述第二接口被设置为备接口;第一交换机60接收单元601通过所述第一接口接收所述第一防火墙发送的来自于所述第二网络的所述会话的报文,发送单元602转发接收单元601通过所述第一接口接收到的所述第一防火墙发送的来自于所述第二网络的所述会话的报文,第一交换机60接收单元601不接收所述第二防火墙发送的来自于所述第二网络的所述会话的报文,或者接收单元601通过所述备接口接收所述第二防火墙发送的来自于所述第二网络的所述会话的报文,丢弃单元丢弃接收单元601通过所述备接口接收到的来自于所述第二网络的所述会话的报文;Before the detection unit detects that the first firewall is faulty, or the link between the first switch 60 and the first firewall is interrupted, the first interface is set as the main interface, and the second interface is set as For the backup interface; the receiving unit 601 of the first switch 60 receives through the first interface the packet sent by the first firewall from the session of the second network, and the sending unit 602 forwards the message sent by the receiving unit 601 through the The receiving unit 601 of the first switch 60 does not receive the packet sent by the second firewall and sent by the second firewall from the session of the second network received by the first interface. The message of the session of the network, or the receiving unit 601 receives the message of the session from the second network sent by the second firewall through the standby interface, and the discarding unit discards the message sent by the receiving unit 601 through the The packet received by the standby interface from the session of the second network;

所述第一交换机60还包括配置单元,配置单元用于在检测单元检测到所述第一防火墙故障、或者所述第一交换机60与所述第一防火墙之间的链路中断之后,将所述第一接口设置为备接口,将所述第二接口设置为主接口,接收单元601还用于在该配置单元将第二接口设置为主接口后,通过所述第二接口接收所述第二防火墙发送的来自于所述第二网络的所述会话的报文,发送单元602还用于转发接收单元601通过所述第二接口接收到的所述第二防火墙发送的来自于所述第二网络的所述会话的报。The first switch 60 also includes a configuration unit, configured to configure the The first interface is set as a backup interface, the second interface is set as a main interface, and the receiving unit 601 is further configured to receive the second interface through the second interface after the configuration unit sets the second interface as the main interface. The second firewall sends the message from the session of the second network, and the sending unit 602 is further configured to forward the message received by the receiving unit 601 through the second interface and sent by the second firewall from the second network. A report of the session of the two networks.

需要说明的是,该交换机60的具体实现还可以对应参照图2所示的方法实施例的相应描述,此处不再赘述。It should be noted that, for the specific implementation of the switch 60, reference may also be made to the corresponding description of the method embodiment shown in FIG. 2 , which will not be repeated here.

通过运行上述单元,第一交换机60向第一防火墙和第二防火墙发送同样的报文,使得该第一防火墙和第二防火墙根据该报文中的首报文建立相同的会话表项,这样一来,该第二防火墙不需要从该第一防火墙上备份该会话表项,当第一防火墙出现故障时,该第二防火墙可以直接基于自身建立的会话表项接替该第一防火墙上的业务,避免了业务中断。By running the above units, the first switch 60 sends the same message to the first firewall and the second firewall, so that the first firewall and the second firewall establish the same session entry according to the first message in the message, so that Therefore, the second firewall does not need to back up the session entry from the first firewall. When the first firewall fails, the second firewall can directly take over the services on the first firewall based on the session entry established by itself. Business interruption is avoided.

上述详细阐述了本发明实施例的方法和交换机,为了便于更好地实施本发明实施例的上述方案,相应地,下面提供了本发明实施例的系统。The method and the switch of the embodiment of the present invention have been described in detail above. In order to better implement the above solution of the embodiment of the present invention, correspondingly, the system of the embodiment of the present invention is provided below.

请参见图7、图7是本发明实施例提供的一种报文转发系统70,该文件转发系统70包括第一交换机701、第二交换机702、第一防火墙703和第二防火墙704,其中,所述第一交换机701与第一防火墙703、第二防火墙704和所述第一网络相连,所述第一防火墙703为主用防火墙,所述第二防火墙704为备用防火墙,所述第一防火墙703和第二防火墙704分别与所述第一交换机701和第二交换机702连接,所述第二交换机702还与所述第二网络连接,其中:Please refer to FIG. 7. FIG. 7 is a message forwarding system 70 provided by an embodiment of the present invention. The file forwarding system 70 includes a first switch 701, a second switch 702, a first firewall 703, and a second firewall 704, wherein, The first switch 701 is connected to the first firewall 703, the second firewall 704 and the first network, the first firewall 703 is the active firewall, the second firewall 704 is the backup firewall, the first firewall 703 and the second firewall 704 are respectively connected to the first switch 701 and the second switch 702, and the second switch 702 is also connected to the second network, wherein:

第一交换机701,用于接收来自于第一网络的多个报文,所述多个报文是所述第一网络与第二网络之间传输的报文;分别向所述第一防火墙703和所述第二防火墙704发送所述多个报文,所述第一交换机701向所述第一防火墙703和所述第二防火墙704发送的报文是相同的;The first switch 701 is configured to receive multiple packets from the first network, the multiple packets are packets transmitted between the first network and the second network; Sending the multiple packets with the second firewall 704, the packets sent by the first switch 701 to the first firewall 703 and the second firewall 704 are the same;

所述第一防火墙703和所述第二防火墙704,分别用于根据所述第一交换机701发送的所述多个报文中的会话首报文建立所述会话首报文所属会话的会话表项,所述会话表项包含五元组,所述五元组用于判断流经防火墙的报文是否属于所述会话;The first firewall 703 and the second firewall 704 are respectively configured to establish a session table of the session to which the session header message belongs according to the session header message in the plurality of messages sent by the first switch 701 item, the session entry includes a five-tuple, and the five-tuple is used to determine whether the message flowing through the firewall belongs to the session;

所述第一防火墙703,还用于向所述第一交换机701转发来自所述第二网络的所述会话的报文;The first firewall 703 is further configured to forward the packet of the session from the second network to the first switch 701;

所述第一交换机701,还用于接收所述第一防火墙703发送的来自于所述第二网络的所述会话的报文;The first switch 701 is further configured to receive the packet of the session from the second network sent by the first firewall 703;

所述第一交换机701,还用于向所述第一网络转发所述来自于所述第二网络的所述会话的报文。The first switch 701 is further configured to forward the packet of the session from the second network to the first network.

通过运行该报文转发系统70,第一交换机701向第一防火墙703和第二防火墙704发送同样的报文,使得该第一防火墙703和第二防火墙704根据该报文中的首报文建立相同的会话表项,这样一来,该第二防火墙704不需要从该第一防火墙703上备份该会话表项,当第一防火墙703出现故障时,该第二防火墙704可以直接基于自身建立的会话表项接替该第一防火墙703上的业务,避免了业务中断。By running the message forwarding system 70, the first switch 701 sends the same message to the first firewall 703 and the second firewall 704, so that the first firewall 703 and the second firewall 704 establish The same session entry, so that the second firewall 704 does not need to back up the session entry from the first firewall 703. When the first firewall 703 fails, the second firewall 704 can directly establish The session entry takes over the service on the first firewall 703, avoiding service interruption.

在一种可选的方案中,In an alternative,

所述第一交换机701包括所述第一交换机701与所述第一防火墙703相连的第一接口,以及所述第一交换机701与所述第二防火墙704相连的第二接口,所述第二防火墙704,还用于向所述第一交换机701转发来自所述第二网络的所述会话的报文;The first switch 701 includes a first interface connecting the first switch 701 to the first firewall 703, and a second interface connecting the first switch 701 to the second firewall 704, the second The firewall 704 is further configured to forward the packet of the session from the second network to the first switch 701;

所述第一交换机701,用于检测所述第一防火墙703是否故障、或者所述第一交换机701与所述第一防火墙703之间的链路是否中断,并在检测出所述第一防火墙703故障、或者所述第一交换机701与所述第一防火墙703之间的链路中断之前将所述第一接口设置为主接口,将所述第二接口设置为备接口;在检测出所述第一防火墙703故障、或者所述第一交换机701与所述第一防火墙703之间的链路中断之后将所述第一接口设置为备接口,将所述第二接口设置为主接口;The first switch 701 is configured to detect whether the first firewall 703 fails, or whether the link between the first switch 701 and the first firewall 703 is interrupted, and detects that the first firewall 703 failure, or before the link between the first switch 701 and the first firewall 703 is interrupted, the first interface is set as the main interface, and the second interface is set as the standby interface; After the first firewall 703 fails, or the link between the first switch 701 and the first firewall 703 is interrupted, the first interface is set as a standby interface, and the second interface is set as a main interface;

在检测出所述第一防火墙703故障、或者所述第一交换机701与所述第一防火墙703之间的链路中断之前,通过所述第一接口和所述第二接口分别接收所述第一防火墙703和所述第二防火墙704发送的来自于所述第二网络的所述会话的报文,并丢弃通过所述第二接口接收到的来自所述第二网络的所述会话的报文;Before the failure of the first firewall 703 is detected, or the link between the first switch 701 and the first firewall 703 is interrupted, the first interface and the second interface respectively receive the first A firewall 703 and the second firewall 704 send the message from the session of the second network, and discard the message received through the second interface from the session of the second network arts;

在检测出所述第一防火墙703故障、或者所述第一交换机701与所述第一防火墙703之间的链路中断之后,通过所述第二接口分别接收所述第二防火墙704发送的来自于所述第二网络的所述会话的报文,并向所述第一网络转发通过所述第二接口接收到的来自于所述第二网络的所述会话的报文。After detecting that the first firewall 703 is faulty or the link between the first switch 701 and the first firewall 703 is interrupted, the second interface respectively receives the data sent by the second firewall 704 from the packet of the session on the second network, and forward the packet of the session from the second network received through the second interface to the first network.

在又一种可选的方案中所述第二防火墙704,还用于检测所述第二防火墙704是否为备用防火墙,若第二防火墙704为备用防火墙,则禁止向所述第一交换机701转发来自所述第二网络的所述会话的报文,禁止向所述第二交换机702转发来自所述第一网络的所述会话的报文。In yet another optional solution, the second firewall 704 is also used to detect whether the second firewall 704 is a backup firewall, and if the second firewall 704 is a backup firewall, forwarding to the first switch 701 is prohibited. The packet from the session on the second network is prohibited from forwarding the packet from the session on the first network to the second switch 702 .

进一步地,第一交换机701的具体实现还可以对应参照图5所示实施例中的第一交换机50和图6所示实施例中的第一交换机60的实现;第二交换机702的具体实现还可以对应参照图5和图6所示实施例中的第二交换机实现;第一防火墙703的具体实现还可以对应参照图5和图6所示实施例中的第一防火墙实现;第二防火墙704的具体实现还可以对应参照图5和图6所示实施例中的第二防火墙实现。Further, the specific implementation of the first switch 701 can also correspond to the implementation of the first switch 50 in the embodiment shown in FIG. 5 and the first switch 60 in the embodiment shown in FIG. 6; the specific implementation of the second switch 702 can also It can be implemented correspondingly with reference to the second switch in the embodiment shown in Figure 5 and Figure 6; the specific implementation of the first firewall 703 can also be implemented with reference to the first firewall in the embodiment shown in Figure 5 and Figure 6; the second firewall 704 The specific implementation may also correspond to the implementation of the second firewall in the embodiment shown in FIG. 5 and FIG. 6 .

通过运行该报文转发系统70,第一交换机701向第一防火墙703和第二防火墙704发送同样的报文,使得该第一防火墙703和第二防火墙704根据该报文中的首报文建立相同的会话表项,这样一来,该第二防火墙704不需要从该第一防火墙703上备份该会话表项,当第一防火墙703出现故障时,该第二防火墙704可以直接基于自身建立的会话表项接替该第一防火墙703上的业务,避免了业务中断。By running the message forwarding system 70, the first switch 701 sends the same message to the first firewall 703 and the second firewall 704, so that the first firewall 703 and the second firewall 704 establish The same session entry, so that the second firewall 704 does not need to back up the session entry from the first firewall 703. When the first firewall 703 fails, the second firewall 704 can directly establish The session entry takes over the service on the first firewall 703, avoiding service interruption.

综上所述,通过实施本发明实施例,第一交换机向第一防火墙和第二防火墙发送同样的报文,使得该第一防火墙和第二防火墙根据该报文中的首报文建立相同的会话表项,这样一来,该第二防火墙不需要从该第一防火墙上备份该会话表项,当第一防火墙出现故障时,该第二防火墙可以直接基于自身建立的会话表项接替该第一防火墙上的业务,避免了业务中断。To sum up, by implementing the embodiment of the present invention, the first switch sends the same message to the first firewall and the second firewall, so that the first firewall and the second firewall establish the same message according to the first message in the message. In this way, the second firewall does not need to back up the session entry from the first firewall. When the first firewall fails, the second firewall can directly replace the first firewall based on the session entry established by itself. A service on the firewall avoids service interruption.

本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented through computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. During execution, it may include the processes of the embodiments of the above-mentioned methods. The aforementioned storage medium includes various media capable of storing program codes such as ROM, RAM, magnetic disk or optical disk.

以上实施例仅揭露了本发明中较佳实施例,不能以此来限定本发明之权利范围,本领域普通技术人员可以理解实现上述实施例的全部或部分流程,并依本发明权利要求所作的等同变化,仍属于发明所涵盖的范围。The above embodiments only disclose the preferred embodiments of the present invention, and cannot limit the scope of rights of the present invention with this. Those of ordinary skill in the art can understand the whole or part of the process of realizing the above embodiments, and make according to the claims of the present invention Equivalent changes still belong to the scope covered by the invention.

Claims (13)

1. a kind of message forwarding method, it is characterised in that including:
First interchanger receives the multiple messages for coming from first network, first interchanger and the first fire prevention Wall, the second fire wall are connected with the first network, and the multiple message is the first network and the second net The message transmitted between network, first fire wall is master firewall, and second fire wall is standby anti- Wall with flues, first fire wall and the second fire wall are connected with first interchanger and second switch respectively, The second switch also with second network connection;
First interchanger sends the multiple report to first fire wall and second fire wall respectively Text, the message that first interchanger is sent to first fire wall and second fire wall is identical, So that first fire wall and second fire wall are built all in accordance with the session first message in the multiple message The session entry of the affiliated session of session first message is found, the session entry includes five-tuple, described five yuan Whether the message that group is used to judge to flow through fire wall belongs to the session;
First interchanger receives the meeting for coming from second network that first fire wall is sent The message of words;
Come from the session of second network described in first interchanger to first network forwarding Message.
2. according to the method described in claim 1, it is characterised in that first interchanger is respectively to described First fire wall and second fire wall are sent after the multiple message, and methods described also includes:
Whether the first fire wall described in the first exchange machine testing breaks down, or first interchanger Whether the link between first fire wall interrupts;
If first interchanger detect the first fire wall failure or first interchanger with Link down between first fire wall, then first interchanger receive and forward it is described second fire prevention The message for the session for coming from second network that wall is sent.
3. method according to claim 2, it is characterised in that described first exchanges described in machine testing the Whether one fire wall breaks down, and is specially:
First interchanger by two-way converting testing mechanism BFD detect first fire wall whether failure.
4. according to the method in claim 2 or 3, it is characterised in that first interchanger is detected Link down between the first fire wall failure or first interchanger and first fire wall Before, methods described also includes:
What first interchanger did not received that second fire wall sends comes from the described of second network The message of session, or receive and abandon the institute for coming from second network that second fire wall is sent State the message of session.
5. method according to claim 4, it is characterised in that first interchanger includes described the The first interface that one interchanger is connected with first fire wall, and first interchanger and described second The connected second interface of fire wall,
First interchanger detect the first fire wall failure or first interchanger with it is described Before link down between first fire wall, the first interface is arranged to main interface, and described second connects Mouth is arranged to standby interface;First interchanger is received by the first interface and forwards described first to prevent The message for the session for coming from second network that wall with flues is sent, first interchanger does not receive institute The message of the session for coming from second network of the second fire wall transmission is stated, or by described standby The message for the session for coming from second network that second fire wall described in interface is sent, and lose Abandon by the standby interface to the session for coming from second network message;
First interchanger detect the first fire wall failure or first interchanger with it is described After link down between first fire wall, methods described also includes:
The first interface is set to standby interface, the second interface main interface is set to, by described Second interface receives and forwarded the session for coming from second network of the second fire wall transmission Message.
6. a kind of first interchanger, it is characterised in that first interchanger include processor, memory and Network interface, wherein:
The network interface is used to receive message and sends message;
The memory is used for store instruction and data;
The processor, for reading the instruction and data stored in the memory, performs following operation:
Received by the network interface and come from multiple messages of first network, first interchanger and the One fire wall, the second fire wall are connected with the first network, the multiple message be the first network with The message transmitted between second network, first fire wall is master firewall, and second fire wall is Slave firewall, first fire wall and the second fire wall are exchanged with first interchanger and second respectively Machine connect, the second switch also with second network connection;
Send the multiple to first fire wall and second fire wall respectively by the network interface Message, the message sent by the network interface to first fire wall and second fire wall is phase With, so that first fire wall and second fire wall are first all in accordance with the session in the multiple message Message sets up the session entry of the affiliated session of session first message, and the session entry includes five-tuple, institute State five-tuple be used for judge flow through the message of fire wall and whether belong to the session;
Come from by what network interface reception first fire wall was sent described in second network The message of session;
By the meeting for coming from second network described in the network interface to first network forwarding The message of words.
7. the first interchanger according to claim 6, it is characterised in that the processor passes through described After network interface sends the multiple message to first fire wall and second fire wall respectively, institute Processor is stated to be additionally operable to:
Detect whether first fire wall breaks down, or first interchanger and the described first fire prevention Whether the link between wall interrupts;
If between the first fire wall failure or first interchanger and first fire wall Link down, then received by the network interface and forward coming from for the second fire wall transmission described The message of the session of second network.
8. the first interchanger according to claim 7, it is characterised in that the processor detection is described Whether the first fire wall breaks down, and is specially:
By two-way converting testing mechanism BFD detect first fire wall whether failure.
9. the first interchanger according to claim 7 or 8, it is characterised in that the processor detection Into the link between the first fire wall failure or first interchanger and first fire wall Before disconnected, the processor is additionally operable to:
The message for the session for coming from second network that second fire wall is sent is not received, or Person receives the meeting for coming from second network that second fire wall is sent by the network interface The message of words, and abandon the report for the session for coming from second network that second fire wall is sent Text.
10. the first interchanger according to claim 9, it is characterised in that the network interface includes The first interface that first interchanger is connected with first fire wall, and first interchanger and institute The connected second interface of the second fire wall is stated,
The processor detects the first fire wall failure or first interchanger and described first Before link down between fire wall, the first interface is arranged to main interface, the second interface quilt It is set to standby interface;First interchanger is received by the first interface and forwards first fire wall The message of the session for coming from second network sent, first interchanger does not receive described the The message for the session for coming from second network that two fire walls are sent, or connect by described second Mouth receives the message for the session for coming from second network that second fire wall is sent, and abandons The message of the session for coming from second network received by the second interface;
The processor detects the first fire wall failure or first interchanger and described first After link down between fire wall, the first interface is set to standby interface, by the second interface Main interface is set to, is received by the second interface and forwards what second fire wall sent to come from institute State the message of the session of the second network.
11. a kind of message forwarding system, it is characterised in that the system includes the first interchanger, the second friendship Change planes, the first fire wall and the second fire wall;Wherein, first interchanger and the first fire wall, second Fire wall is connected with the first network, and first fire wall is master firewall, second fire wall For slave firewall, first fire wall and the second fire wall are handed over first interchanger and second respectively Change planes connection, the second switch also with second network connection, wherein:
First interchanger, multiple messages of first network is come from for receiving, the multiple message is described The message transmitted between first network and the second network;Respectively to first fire wall and second fire prevention Wall sends the multiple message, and first interchanger is sent out to first fire wall and second fire wall The message sent is identical;
First fire wall and second fire wall, are respectively used to what is sent according to first interchanger Session first message in the multiple message sets up the session entry of the affiliated session of session first message, described Session entry includes five-tuple, and whether the message that the five-tuple is used to judge to flow through fire wall belongs to the meeting Words;
First fire wall, is additionally operable to first interchanger forwarding from described in second network The message of session;
First interchanger, be additionally operable to reception the first fire wall transmission comes from second network The session message;
First interchanger, be additionally operable to the first network forwarding described in come from second network The message of the session.
12. system according to claim 11, it is characterised in that first interchanger includes described The first interface that first interchanger is connected with first fire wall, and first interchanger and described the The connected second interface of two fire walls, second fire wall is additionally operable to come to first interchanger forwarding From the message of the session of second network;
First interchanger, for detect first fire wall whether failure or it is described first exchange Whether the link between machine and first fire wall interrupts, and detect the first fire wall failure, Or set the first interface before the link down between first interchanger and first fire wall Main interface is set to, the second interface is set to standby interface;Detect the first fire wall failure, Or set the first interface after the link down between first interchanger and first fire wall Standby interface is set to, the second interface is set to main interface;
Detect the first fire wall failure or first interchanger and first fire wall it Between link down before, by the first interface and the second interface receive respectively it is described first fire prevention The message for the session for coming from second network that wall and second fire wall are sent, and abandon logical Cross the message for the session from second network that the second interface is received;
Detect the first fire wall failure or first interchanger and first fire wall it Between link down after, pass through coming from that the second interface receives that second fire wall sends respectively The message of the session of second network, and connect to first network forwarding by the second interface What is received comes from the message of the session of second network.
13. method according to claim 11, it is characterised in that:
Second fire wall, is additionally operable to whether detection second fire wall is slave firewall, if second Fire wall is slave firewall, then forbids to first interchanger forwarding from described in second network The message of session, forbids forwarding the message of the session from the first network to the second switch.
CN201610186891.3A 2016-03-29 2016-03-29 A message forwarding method, first switch and related system Active CN107241208B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610186891.3A CN107241208B (en) 2016-03-29 2016-03-29 A message forwarding method, first switch and related system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610186891.3A CN107241208B (en) 2016-03-29 2016-03-29 A message forwarding method, first switch and related system

Publications (2)

Publication Number Publication Date
CN107241208A true CN107241208A (en) 2017-10-10
CN107241208B CN107241208B (en) 2020-02-21

Family

ID=59983866

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610186891.3A Active CN107241208B (en) 2016-03-29 2016-03-29 A message forwarding method, first switch and related system

Country Status (1)

Country Link
CN (1) CN107241208B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108989352A (en) * 2018-09-03 2018-12-11 平安科技(深圳)有限公司 Method of realizing fireproof wall, device, computer equipment and storage medium
CN110138656A (en) * 2019-05-28 2019-08-16 新华三技术有限公司 Method for processing business and device
CN111181985A (en) * 2019-12-31 2020-05-19 奇安信科技集团股份有限公司 Data transmission method, data transmission system, firewall device and storage medium
CN111314200A (en) * 2020-02-29 2020-06-19 新华三技术有限公司 Message forwarding method and device
CN114301766A (en) * 2021-12-30 2022-04-08 山石网科通信技术股份有限公司 Communication method, communication apparatus, storage medium, and processor
CN115225397A (en) * 2022-07-22 2022-10-21 山石网科通信技术股份有限公司 A control method, device, firewall and computer-readable storage medium
CN116633885A (en) * 2023-04-20 2023-08-22 杭州迪普科技股份有限公司 Firewall dual-machine switching setting method and device

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101257490A (en) * 2008-02-03 2008-09-03 杭州华三通信技术有限公司 Method and device for processing packet under fireproof wall side road mode
CN101848100A (en) * 2009-03-23 2010-09-29 北京鼎信高科信息技术有限公司 Fire wall dual-computer hot-standby system based on CONNTRACK synchronism
CN101557317B (en) * 2009-05-26 2011-06-29 杭州华三通信技术有限公司 System, device and method for realizing session active backup in dual-machine hot standby network
US8001279B2 (en) * 2001-12-21 2011-08-16 International Business Machines Corporation Method of synchronizing firewalls in a communication system based upon a server farm
CN102821099A (en) * 2012-07-24 2012-12-12 北京星网锐捷网络技术有限公司 Message forwarding method, message forwarding equipment and message forwarding system
CN102904818A (en) * 2012-09-27 2013-01-30 北京星网锐捷网络技术有限公司 Method and device for updating ARP (Address Resolution Protocol) information table
CN103441987A (en) * 2013-07-30 2013-12-11 曙光信息产业(北京)有限公司 Method and device for managing dual-computer firewall system
CN103973674A (en) * 2014-04-09 2014-08-06 汉柏科技有限公司 Method and device for synchronizing host and backup information
CN104506513A (en) * 2014-12-16 2015-04-08 北京星网锐捷网络技术有限公司 Firewall flow graph backup method, firewall and firewall system

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8001279B2 (en) * 2001-12-21 2011-08-16 International Business Machines Corporation Method of synchronizing firewalls in a communication system based upon a server farm
CN101257490A (en) * 2008-02-03 2008-09-03 杭州华三通信技术有限公司 Method and device for processing packet under fireproof wall side road mode
CN101848100A (en) * 2009-03-23 2010-09-29 北京鼎信高科信息技术有限公司 Fire wall dual-computer hot-standby system based on CONNTRACK synchronism
CN101557317B (en) * 2009-05-26 2011-06-29 杭州华三通信技术有限公司 System, device and method for realizing session active backup in dual-machine hot standby network
CN102821099A (en) * 2012-07-24 2012-12-12 北京星网锐捷网络技术有限公司 Message forwarding method, message forwarding equipment and message forwarding system
CN102904818A (en) * 2012-09-27 2013-01-30 北京星网锐捷网络技术有限公司 Method and device for updating ARP (Address Resolution Protocol) information table
CN103441987A (en) * 2013-07-30 2013-12-11 曙光信息产业(北京)有限公司 Method and device for managing dual-computer firewall system
CN103973674A (en) * 2014-04-09 2014-08-06 汉柏科技有限公司 Method and device for synchronizing host and backup information
CN104506513A (en) * 2014-12-16 2015-04-08 北京星网锐捷网络技术有限公司 Firewall flow graph backup method, firewall and firewall system

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108989352A (en) * 2018-09-03 2018-12-11 平安科技(深圳)有限公司 Method of realizing fireproof wall, device, computer equipment and storage medium
CN110138656A (en) * 2019-05-28 2019-08-16 新华三技术有限公司 Method for processing business and device
CN110138656B (en) * 2019-05-28 2022-03-01 新华三技术有限公司 Service processing method and device
CN111181985A (en) * 2019-12-31 2020-05-19 奇安信科技集团股份有限公司 Data transmission method, data transmission system, firewall device and storage medium
CN111314200A (en) * 2020-02-29 2020-06-19 新华三技术有限公司 Message forwarding method and device
CN111314200B (en) * 2020-02-29 2023-10-20 新华三技术有限公司 Message forwarding method and device
CN114301766A (en) * 2021-12-30 2022-04-08 山石网科通信技术股份有限公司 Communication method, communication apparatus, storage medium, and processor
CN115225397A (en) * 2022-07-22 2022-10-21 山石网科通信技术股份有限公司 A control method, device, firewall and computer-readable storage medium
CN115225397B (en) * 2022-07-22 2024-05-03 山石网科通信技术股份有限公司 Control method, control device, firewall and computer readable storage medium
CN116633885A (en) * 2023-04-20 2023-08-22 杭州迪普科技股份有限公司 Firewall dual-machine switching setting method and device

Also Published As

Publication number Publication date
CN107241208B (en) 2020-02-21

Similar Documents

Publication Publication Date Title
CN108574614B (en) Message processing method, device and network system
CN110166356B (en) Method and network equipment for sending message
CN107846342B (en) Method, device and system for forwarding VXLAN message
CN107241208B (en) A message forwarding method, first switch and related system
CN105164991B (en) Redundant Network Protocol System
CN107360092B (en) System and method for load balancing in a data network
US9755958B2 (en) Fast convergence in VRRP with multipoint bidirectional forwarding detection
CN104081731B (en) Network system and method for managing topology
CN103873368B (en) Ethernet message forwarding method and access device
US9455916B2 (en) Method and system for changing path and controller thereof
CN104104570A (en) Aggregation processing method in IRF (Intelligent Resilient Framework) system and device
WO2016063188A1 (en) Method and system for implementing ethernet oam in a software-defined networking (sdn) system
US10581669B2 (en) Restoring control-plane connectivity with a network management entity
CN107078924A (en) The method, apparatus and system of two-way converting detection are carried out to aggregated links
CN104410570B (en) A kind of data transmission method and device based on VRRP
WO2021082812A1 (en) Message sending method and first network device
CN104365070B (en) The method and apparatus for the optimization greeted for multi-link transparent interconnection LAN
US10447581B2 (en) Failure handling at logical routers according to a non-preemptive mode
CN108289044B (en) Data forwarding method, link state method for determining static route, and network device
CN101909006A (en) Two-way forwarding detection message sending and receiving method and its device and communication system
CN107332793B (en) A message forwarding method, related equipment and system
CN102984058A (en) Network communication method based on open stream, controller and exchangers
JPWO2014069502A1 (en) COMMUNICATION SYSTEM, ROUTE INFORMATION EXCHANGE DEVICE, COMMUNICATION NODE, ROUTE INFORMATION TRANSFER METHOD, AND PROGRAM
EP3291486B1 (en) Selective transmission of bidirectional forwarding detection (bfd) messages for verifying multicast connectivity
CN107770061B (en) Method and forwarding device for forwarding message

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant