Message forwarding method and device, computer equipment and storage medium

By retaining the virtual MAC and virtual IP in the gateway device in the VRRP group and continuing to forward the target data packets after switching, the problem of service traffic interruption caused by link failure of the VRRP backup group is solved, and the avoidance of service churn and the correct forwarding of data packets is achieved.

CN119583439APending Publication Date: 2025-03-07CHINA TELECOM CLOUD TECH CO LTD

Patent Information

Application Number
CN202411791387.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-03-07

AI Technical Summary

Technical Problem

In the event of a link failure between VRRP backup groups, the backup gateway device needs to wait for the timer to time out before switching to the main gateway device, resulting in service traffic interruption and service churn.

Method used

After the gateway identity of the gateway device is switched from the primary gateway to the standby gateway, the virtual media access control address MAC and virtual network address IP are retained, and after receiving the target data packet, the data packet is forwarded to the target switch based on the message transmission information, the virtual MAC and the virtual IP.

Benefits of technology

Ensure that the main gateway device can still process a small amount of service traffic in a timely manner after switching to the backup gateway device, avoid service loss, and ensure the correct forwarding of target data packets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119583439A_ABST
    Figure CN119583439A_ABST
Patent Text Reader

Abstract

The invention relates to a message forwarding method and device, computer equipment and a storage medium. The method comprises the following steps: after the gateway identity of the gateway equipment is switched from a main gateway to a standby gateway, reserving a virtual media access control address MAC and a virtual network address IP configured when the gateway identity of the gateway equipment is the main gateway; after receiving a target data message sent by a source switch, forwarding the target data message to a target switch according to message transmission information, the virtual MAC and the virtual IP of the target data message; wherein the message transmission information comprises a target MAC and a target IP of the target data message. By adopting the method, a small amount of service flow can be timely processed after the main gateway equipment is switched to the standby gateway equipment, and the service loss is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer network technology, and in particular to a message forwarding method, apparatus, computer equipment and storage medium. Background Art

[0002] User terminals in a LAN usually access external networks by configuring a default gateway. If the default gateway device fails, all user traffic to the external network will be terminated. VRRP (Virtual Router Redundancy Protocol) can not only achieve gateway backup, but also solve the problem of conflicts between multiple gateways, thereby improving network reliability.

[0003] However, when the link between the VRRP backup groups fails, VRRP packets cannot be exchanged normally at this time, and the backup gateway device needs to wait for the timer to time out before switching to the active gateway device. During the waiting period, business traffic will still be sent to the active gateway device, which will cause business loss. Summary of the invention

[0004] Based on this, it is necessary to provide a message forwarding method, device, computer equipment and storage medium to address the above technical problems, which can ensure that the main gateway device can process a small amount of business traffic in a timely manner after switching to a backup gateway device to avoid business loss.

[0005] In a first aspect, the present application provides a message forwarding method, which is applied to a gateway device in a VRRP group, including:

[0006] After the gateway identity of the gateway device is switched from the primary gateway to the backup gateway, retaining the virtual media access control address MAC and the virtual network address IP configured when the gateway identity of the gateway device is the primary gateway;

[0007] After receiving the target data message sent by the source switch, the target data message is forwarded to the target switch according to the message transmission information, virtual MAC and virtual IP of the target data message; wherein the message transmission information includes the destination MAC and destination IP of the target data message.

[0008] In one embodiment, forwarding the target data packet to the target switch according to the packet transmission information, the virtual MAC and the virtual IP of the target data packet includes:

[0009] Determine whether the target data message meets the processing condition according to the destination MAC, the virtual MAC and the actual MAC of the gateway device;

[0010] If it matches, the target data message is forwarded to the target switch according to the switch type of the source switch and the destination IP.

[0011] In one embodiment, forwarding the target data message to the target switch according to the switch type of the source switch and the destination IP address includes:

[0012] If it is determined that the source switch is a first switch according to the switch type of the source switch, the target data message is forwarded to the target switch; wherein the first switch is a switch between the network end and the gateway device;

[0013] If the source switch is determined to be a second switch according to the switch type of the source switch, the destination IP and the virtual IP are compared for consistency to obtain an IP comparison result, and if the IP comparison result is consistent, the target data message is forwarded to the target switch; wherein the second switch is a switch between the gateway device and the user terminal.

[0014] In one of the embodiments, determining whether the target data message meets the processing condition according to the destination MAC, the virtual MAC and the actual MAC of the gateway device includes:

[0015] If the destination MAC is consistent with any one of the virtual MAC and the actual MAC, it is determined that the target data message meets the processing condition.

[0016] In one embodiment, forwarding the target data message to the target switch includes:

[0017] Obtaining the next hop encapsulation information of the target data message; wherein the next hop encapsulation information at least includes the sending interface information, the virtual local area network VLAN information and the next hop MAC;

[0018] Performing MAC encapsulation on the target data message according to the next hop encapsulation information and the actual MAC;

[0019] The target data message after MAC encapsulation is forwarded to the target switch.

[0020] In one of the embodiments, performing MAC encapsulation on the target data message according to the next hop encapsulation information and the actual MAC includes:

[0021] Using the actual MAC as the new source MAC of the target data message;

[0022] Using the next hop MAC as the new destination MAC of the target data message;

[0023] The target data message is MAC encapsulated according to the new destination MAC, the new source MAC, the sending interface information and the VLAN information.

[0024] In one of the embodiments, after the gateway identity of the gateway device is switched from the active gateway to the standby gateway, the method further includes:

[0025] Stop responding to the Address Resolution Protocol ARP request sent by the user terminal; wherein the destination IP carried in the ARP request is the virtual IP.

[0026] In a second aspect, the present application further provides a message forwarding device, configured in a gateway device in a VRRP group, comprising:

[0027] An identity switching module, used for retaining the virtual media access control address MAC and virtual network address IP configured when the gateway identity of the gateway device is the primary gateway after the gateway identity of the gateway device is switched from the primary gateway to the backup gateway;

[0028] The message forwarding module is used to forward the target data message to the target switch according to the message transmission information, virtual MAC and virtual IP of the target data message after receiving the target data message sent by the source switch; wherein the message transmission information includes the destination MAC and destination IP of the target data message.

[0029] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0030] After the gateway identity of the gateway device is switched from the primary gateway to the backup gateway, retaining the virtual media access control address MAC and the virtual network address IP configured when the gateway identity of the gateway device is the primary gateway;

[0031] After receiving the target data message sent by the source switch, the target data message is forwarded to the target switch according to the message transmission information, virtual MAC and virtual IP of the target data message; wherein the message transmission information includes the destination MAC and destination IP of the target data message.

[0032] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:

[0033] After the gateway identity of the gateway device is switched from the primary gateway to the backup gateway, retaining the virtual media access control address MAC and the virtual network address IP configured when the gateway identity of the gateway device is the primary gateway;

[0034] After receiving the target data message sent by the source switch, the target data message is forwarded to the target switch according to the message transmission information, virtual MAC and virtual IP of the target data message; wherein the message transmission information includes the destination MAC and destination IP of the target data message.

[0035] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0036] After the gateway identity of the gateway device is switched from the primary gateway to the backup gateway, retaining the virtual media access control address MAC and the virtual network address IP configured when the gateway identity of the gateway device is the primary gateway;

[0037] After receiving the target data message sent by the source switch, the target data message is forwarded to the target switch according to the message transmission information, virtual MAC and virtual IP of the target data message; wherein the message transmission information includes the destination MAC and destination IP of the target data message.

[0038] The above-mentioned message forwarding method, device, computer equipment and storage medium retain the virtual media access control address MAC and virtual network address IP configured when the gateway identity of the gateway device is the main gateway after the gateway identity of the gateway device is switched from the main gateway to the backup gateway; after receiving the target data message sent by the source switch, the target data message is forwarded to the target switch according to the message transmission information, virtual MAC and virtual IP of the target data message; wherein the message transmission information includes the destination MAC and destination IP of the target data message. The above-mentioned scheme retains the configured virtual MAC and virtual IP after the main gateway device is switched to the backup gateway device, so that the gateway device can still accept the target data message when it is the backup gateway device; further, by combining the destination MAC and destination IP of the target data message, as well as the virtual MAC and virtual IP, it is ensured that the target data message can be forwarded correctly, thereby avoiding the loss of the target data message to a certain extent. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0040] Figure 1 An application environment diagram of a message forwarding method in an embodiment;

[0041] Figure 2 A schematic diagram of a flow chart of a message forwarding method in an embodiment;

[0042] Figure 3 A schematic diagram of a process of forwarding a target data message to a target switch in one embodiment;

[0043] Figure 4 A schematic diagram of a process of forwarding a target data message to a target switch in another embodiment;

[0044] Figure 5 It is a schematic diagram of a process of performing MAC encapsulation on a target data message in one embodiment;

[0045] Figure 6 A schematic diagram of a flow chart of a message forwarding method in another embodiment;

[0046] Figure 7 is a structural block diagram of a message forwarding device in an embodiment;

[0047] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0048] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0049] The message forwarding method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the gateway device 101 in the VRRP group is the main gateway device, which is the gateway device that actually forwards data packets in the VRRP group; the gateway device 102 is the backup gateway device; the user terminal 1, the user terminal 2 and the user terminal 3 are all user terminals that communicate with the Internet (i.e., the network end); the first switch 103 and the second switch 104 are switches that realize communication between the user end and the network end, wherein the first switch 103 is a switch between the network end and the gateway device, and the second switch 104 is a switch between the gateway device and the user terminal. If the target data message received by the gateway device is forwarded by the first switch, the first switch is the source switch and the second switch is the target switch; correspondingly, if the target data message received by the gateway device is forwarded by the second switch, the second switch is the source switch and the first switch is the target switch.

[0050] Optionally, after the gateway identity of the gateway device 101 is switched from the primary gateway to the backup gateway, the virtual media access control address MAC and the virtual network address IP configured when the gateway identity of the gateway device 101 is the primary gateway are retained; after receiving the target data packet sent by the source switch, the target data packet is forwarded to the target switch 103 according to the message transmission information, virtual MAC and virtual IP of the target data packet; wherein the message transmission information includes the destination MAC and destination IP of the target data packet.

[0051] In one embodiment, Figure 2 As shown, a message forwarding method is provided, which is applied to Figure 1 The following steps are taken as an example to illustrate the gateway device in the VRRP group:

[0052] S201, after the gateway identity of the gateway device is switched from the active gateway to the standby gateway, retain the virtual media access control address MAC and the virtual network address IP configured when the gateway identity of the gateway device is the active gateway.

[0053] The gateway device is a gateway device in a VRRP group, that is, a router in a VRRP group; when the gateway identity of the gateway device is a master gateway, the gateway device is a master gateway (MASTER) device; correspondingly, when the gateway identity of the gateway device is a backup gateway, the gateway device is a backup gateway (BACKUP) device.

[0054] It should be noted that in a VRRP group, there are multiple VRRP routers (gateway devices), which are identified by the same VRID (Virtual Router Identity Document). The virtual media access control address (MAC) is the MAC address generated by the virtual router in the VRRP group according to the VRID. A virtual router has a virtual MAC address. The virtual network address (IP) is the IP address of the virtual router. The virtual IP is actually the user's gateway address.

[0055] Optionally, when the gateway device whose gateway identity is the primary gateway in the VRRP group (i.e., the primary gateway device) fails or needs to be upgraded, the gateway identity needs to be switched to the backup gateway first. At the same time, the virtual MAC and virtual IP configured when the gateway identity of the gateway device is the primary gateway are still retained.

[0056] S202: After receiving the target data message sent by the source switch, forward the target data message to the target switch according to the message transmission information, virtual MAC and virtual IP of the target data message.

[0057] The message transmission information includes the destination MAC and destination IP of the target data message.

[0058] Optionally, after receiving the target data message sent by the source switch, the message transmission information of the target data message, that is, the destination MAC and destination IP of the target data message, is extracted; further, the destination MAC of the target data message can be verified. If the destination MAC of the target data message is a virtual MAC, the target data message is allowed to enter the processing flow of the local machine. In addition, according to the switch type of the source switch, it can be determined whether the destination IP needs to be further authenticated. If verification is not required, the target data message can be directly forwarded to the target switch; if verification is required, the target data message is forwarded to the target switch after the authentication is passed.

[0059] It should be noted that after the active gateway device is switched to the standby gateway device, VRRP will switch the new active gateway device through election. At this time, the virtual MAC and virtual IP will be configured on the new active gateway device. The new active gateway device can process messages normally, and will also use the virtual MAC to respond to the user device's ARP (Address Resolution Protocol) request for the virtual IP and regularly notify GARP (Gratuitous Address Resolution Protocol, free ARP). However, the gateway device whose gateway identity is switched from the active gateway to the standby gateway will stop responding to the Address Resolution Protocol ARP request sent by the user terminal; the destination IP carried in the ARP request is the virtual IP. It can be understood that this ensures that the neighbor table entry of the user device is only updated by the new active gateway device.

[0060] In the above-mentioned message forwarding method, after the gateway identity of the gateway device is switched from the primary gateway to the backup gateway, the virtual media access control address MAC and virtual network address IP configured when the gateway identity of the gateway device is the primary gateway are retained; after receiving the target data message sent by the source switch, the target data message is forwarded to the target switch according to the message transmission information, virtual MAC and virtual IP of the target data message; wherein the message transmission information includes the destination MAC and destination IP of the target data message. The above-mentioned scheme, by retaining the configured virtual MAC and virtual IP after the primary gateway device is switched to the backup gateway device, enables the gateway device to still accept the target data message when it is the backup gateway device; further, by combining the destination MAC and destination IP of the target data message, as well as the virtual MAC and virtual IP, it is ensured that the target data message can be forwarded correctly, thereby avoiding the loss of the target data message to a certain extent.

[0061] Optionally, in one embodiment, Figure 3 As shown, a method for forwarding a target data message to a target switch is provided, which specifically includes the following steps:

[0062] S301, determining whether a target data message meets a processing condition according to a destination MAC, a virtual MAC and an actual MAC of a gateway device.

[0063] The destination MAC is the MAC address of the target device to which the target data message carried in the target data message is to go.

[0064] Optionally, if the destination MAC is consistent with any one of the virtual MAC and the actual MAC, it is determined that the target data message meets the processing condition.

[0065] S302: If it matches, forward the target data message to the target switch according to the switch type and destination IP of the source switch.

[0066] The destination IP is the IP address of the target device to which the target data message carried in the target data message is to go.

[0067] It can be understood that since the gateway device can receive both data packets initiated by the network end and data packets sent by the user terminal, when processing the data packets sent from the network end, there is no need to verify the destination IP carried in the target data packet. Therefore, if the source switch is determined to be the first switch based on the switch type of the source switch, the target data packet is forwarded to the target switch; wherein the first switch is a switch between the network end and the gateway device.

[0068] Correspondingly, if the source switch is determined to be the second switch according to the switch type of the source switch, the destination IP and the virtual IP are compared for consistency to obtain an IP comparison result, and if the IP comparison result is consistent, the target data message is forwarded to the target switch; wherein the second switch is the switch between the gateway device and the user terminal. Specifically, if the IP comparison result is consistent, it is necessary to perform a route search according to the routing table item issued by the configuration, and further, after obtaining the next hop related information of the target data message, the target data message is forwarded to the target switch.

[0069] In this embodiment, by preliminarily verifying whether the target data message meets the message processing conditions based on the destination MAC, virtual MAC, and actual MAC, and further determining different target data message forwarding processes based on the switch type of the source switch, it is equivalent to introducing the judgment logic of the target data message, ensuring that the gateway device whose gateway identity is switched from the main gateway to the backup gateway can process the message with the destination MAC as the virtual MAC.

[0070] Optionally, in one embodiment, Figure 4 As shown, a method for forwarding a target data message to a target switch is provided, which specifically includes the following steps:

[0071] S401, obtaining next hop encapsulation information of a target data message.

[0072] The next hop encapsulation information at least includes the sending interface information, the virtual local area network VLAN information and the next hop MAC.

[0073] Optionally, the next hop related information of the target data message may be searched through relevant commands, and encapsulation information used for MAC encapsulation may be extracted according to the next hop related information as the next hop encapsulation information of the target data message.

[0074] S402: Perform MAC encapsulation on the target data message according to the next hop encapsulation information and the actual MAC.

[0075] Optionally, the target data message may be automatically MAC encapsulated according to the MAC encapsulation process and the next hop encapsulation information and the actual MAC.

[0076] S403: Forward the target data message after MAC encapsulation to the target switch.

[0077] In this embodiment, by introducing the next hop encapsulation information and the actual MAC to perform MAC encapsulation on the target data message, an optional process of MAC encapsulation is provided, thereby ensuring the accuracy of MAC encapsulation on the target data message.

[0078] Optionally, in one embodiment, Figure 5 As shown, a method for performing MAC encapsulation on a target data message is provided, which specifically includes the following steps:

[0079] S501, using the actual MAC as the new source MAC of the target data message.

[0080] The new source MAC is the source MAC of the target data message when the gateway device forwards the target data message.

[0081] Optionally, in order to prevent the forwarding traffic of the gateway device that switches from the primary gateway to the backup gateway from pulling the traffic of the new primary gateway device, the actual MAC can be used as the new source MAC of the target data message. Correspondingly, for the new primary gateway device, the virtual MAC is used as the new source MAC of the target data message.

[0082] S502: Use the next-hop MAC as the new destination MAC of the target data message.

[0083] The new destination MAC is the destination MAC of the target data message when the gateway device forwards the target data message.

[0084] Optionally, the next hop MAC is used as the new destination MAC of the target data message. It can be understood that if the target switch is the second switch, that is, the switch between the gateway device and the user terminal, the new destination MAC is the interface MAC of the user terminal.

[0085] S503, performing MAC encapsulation on the target data message according to the new destination MAC, the new source MAC, the sending interface information and the VLAN information.

[0086] Optionally, according to the MAC encapsulation process, the target data message is automatically MAC encapsulated according to the new destination MAC, the new source MAC, the sending interface information and the VLAN information.

[0087] In this embodiment, for a gateway device whose gateway identity is switched from an active gateway to a standby gateway, the actual MAC of the target data message forwarded by the gateway device is used as the new source MAC, thereby preventing the forwarding traffic of the gateway device from drawing the traffic of the new active gateway device.

[0088] Figure 6 FIG. 2 is a flow chart of a message forwarding method in another embodiment. Based on the above embodiment, this embodiment provides an optional example of a message forwarding method. Figure 6 The specific implementation process is as follows:

[0089] S601, after the gateway identity of the gateway device is switched from the active gateway to the standby gateway, the virtual MAC and virtual IP configured when the gateway identity of the gateway device is the active gateway are retained.

[0090] S602: After receiving the target data message sent by the source switch, obtain the destination MAC and destination IP of the target data message.

[0091] S603, determine whether the destination MAC is the actual MAC of the gateway device; if so, execute S605; if not, execute S604.

[0092] S604, determine whether the destination MAC is a virtual MAC; if so, execute S605; if not, prohibit processing of the target data message.

[0093] S605, determining whether the source switch is the first switch; if so, executing S607; if not, executing S606.

[0094] S606, compare the destination IP and the virtual IP for consistency to obtain an IP comparison result; if the IP comparison result is consistent, execute S607.

[0095] S607: Obtain next hop encapsulation information of the target data message.

[0096] S608: Use the next hop MAC in the next hop encapsulation information as the new destination MAC of the target data message.

[0097] S609: Use the actual MAC as the new source MAC of the target data message.

[0098] S610, perform MAC encapsulation on the target data message according to the new destination MAC, the new source MAC, the outgoing interface information and the VLAN information in the next hop encapsulation information.

[0099] S611, forwarding the target data message after MAC encapsulation to the target switch.

[0100] The specific process of S601-S611 can refer to the description of the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0101] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0102] Based on the same inventive concept, the embodiment of the present application also provides a message forwarding device for implementing the message forwarding method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more message forwarding device embodiments provided below can refer to the limitations on the message forwarding method above, and will not be repeated here.

[0103] In an exemplary embodiment, Figure 7 As shown, a message forwarding device 700 is provided, including: an identity switching module 710 and a message forwarding module 720, wherein:

[0104] The identity switching module 710 is used to retain the virtual media access control address MAC and virtual network address IP configured when the gateway identity of the gateway device is the primary gateway after the gateway identity of the gateway device is switched from the primary gateway to the backup gateway;

[0105] The message forwarding module 720 is used to forward the target data message to the target switch according to the message transmission information, virtual MAC and virtual IP of the target data message after receiving the target data message sent by the source switch; wherein the message transmission information includes the destination MAC and destination IP of the target data message.

[0106] The above-mentioned message forwarding device, after the gateway identity of the gateway device is switched from the primary gateway to the backup gateway, retains the virtual media access control address MAC and virtual network address IP configured when the gateway identity of the gateway device is the primary gateway; after receiving the target data message sent by the source switch, forwards the target data message to the target switch according to the message transmission information, virtual MAC and virtual IP of the target data message; wherein the message transmission information includes the destination MAC and destination IP of the target data message. The above-mentioned scheme, by retaining the configured virtual MAC and virtual IP after the primary gateway device is switched to the backup gateway device, enables the gateway device to still receive the target data message when it is the backup gateway device; further, by combining the destination MAC and destination IP of the target data message, as well as the virtual MAC and virtual IP, it is ensured that the target data message can be forwarded correctly, thereby avoiding the loss of the target data message to a certain extent.

[0107] In one embodiment, the message forwarding module 720 includes:

[0108] The first judgment unit is used to determine whether the target data message meets the processing condition according to the destination MAC, the virtual MAC and the actual MAC of the gateway device.

[0109] The message forwarding unit is used to forward the target data message to the target switch according to the switch type and destination IP of the source switch if it meets the requirements.

[0110] In one embodiment, the message forwarding unit is specifically used for:

[0111] If the source switch is determined to be the first switch according to the switch type of the source switch, the target data message is forwarded to the target switch; wherein the first switch is a switch between the network end and the gateway device; if the source switch is determined to be the second switch according to the switch type of the source switch, the destination IP and the virtual IP are compared for consistency to obtain an IP comparison result, and when the IP comparison result is consistent, the target data message is forwarded to the target switch; wherein the second switch is a switch between the gateway device and the user terminal.

[0112] In one embodiment, the first judgment unit is specifically configured to:

[0113] If the destination MAC is consistent with any one of the virtual MAC and the actual MAC, it is determined whether the target data message meets the processing conditions.

[0114] In one embodiment, the message forwarding unit includes:

[0115] The information acquisition slave unit is used to obtain the next hop encapsulation information of the target data message; wherein the next hop encapsulation information at least includes the sending interface information, the virtual local area network VLAN information and the next hop MAC.

[0116] The encapsulation slave unit is used to perform MAC encapsulation on the target data message according to the next hop encapsulation information and the actual MAC.

[0117] The forwarding slave unit is used to forward the target data message after MAC encapsulation to the target switch.

[0118] In one embodiment, the encapsulation slave unit is specifically used for:

[0119] The actual MAC is used as the new source MAC of the target data message; the next-hop MAC is used as the new destination MAC of the target data message; and the target data message is MAC encapsulated according to the new destination MAC, the new source MAC, the sending interface information and the VLAN information.

[0120] In one embodiment, the identity switching module 710 is further configured to:

[0121] Stop responding to the Address Resolution Protocol ARP request sent by the user terminal; wherein the destination IP carried in the ARP request is a virtual IP.

[0122] Each module in the above-mentioned message forwarding device can be implemented in whole or in part by software, hardware and a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module above.

[0123] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 8 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a message forwarding method is implemented.

[0124] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0125] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0126] After the gateway identity of the gateway device is switched from the primary gateway to the backup gateway, the gateway identity of the gateway device is retained as the virtual media access control address MAC and the virtual network address IP configured when the gateway identity of the gateway device is the primary gateway;

[0127] After receiving the target data message sent by the source switch, the target data message is forwarded to the target switch according to the message transmission information, virtual MAC and virtual IP of the target data message; wherein the message transmission information includes the destination MAC and destination IP of the target data message.

[0128] In one embodiment, when the processor executes the computer program to forward the target data message to the target switch according to the message transmission information, the virtual MAC and the virtual IP of the target data message, the following steps are also implemented:

[0129] According to the destination MAC, virtual MAC and actual MAC of the gateway device, determine whether the target data message meets the processing conditions; if it does, forward the target data message to the target switch according to the switch type and destination IP of the source switch.

[0130] In one embodiment, when the processor executes the computer program to forward the target data message to the target switch according to the switch type and the destination IP of the source switch, the processor further implements the following steps:

[0131] If the source switch is determined to be the first switch according to the switch type of the source switch, the target data message is forwarded to the target switch; wherein the first switch is a switch between the network end and the gateway device; if the source switch is determined to be the second switch according to the switch type of the source switch, the destination IP and the virtual IP are compared for consistency to obtain an IP comparison result, and when the IP comparison result is consistent, the target data message is forwarded to the target switch; wherein the second switch is a switch between the gateway device and the user terminal.

[0132] In one embodiment, when the processor executes the computer program to determine whether the target data message meets the processing condition according to the destination MAC, the virtual MAC and the actual MAC of the gateway device, the following steps are also implemented:

[0133] If the destination MAC is consistent with any one of the virtual MAC and the actual MAC, it is determined that the target data message meets the processing condition.

[0134] In one embodiment, when the processor executes the computer program to forward the target data message to the target switch, the processor further implements the following steps:

[0135] Obtain the next hop encapsulation information of the target data message; wherein the next hop encapsulation information at least includes the sending interface information, the virtual local area network VLAN information and the next hop MAC; perform MAC encapsulation on the target data message according to the next hop encapsulation information and the actual MAC; forward the target data message after MAC encapsulation to the target switch.

[0136] In one embodiment, when the processor executes the computer program to perform MAC encapsulation on the target data message according to the next hop encapsulation information and the actual MAC, the processor further implements the following steps:

[0137] The actual MAC is used as the new source MAC of the target data message; the next-hop MAC is used as the new destination MAC of the target data message; and the target data message is MAC encapsulated according to the new destination MAC, the new source MAC, the sending interface information and the VLAN information.

[0138] In one embodiment, after the processor executes the computer program and the gateway identity of the gateway device is switched from the active gateway to the standby gateway, the following steps are further implemented:

[0139] Stop responding to the Address Resolution Protocol ARP request sent by the user terminal; wherein the destination IP carried in the ARP request is a virtual IP.

[0140] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0141] After the gateway identity of the gateway device is switched from the primary gateway to the backup gateway, the gateway identity of the gateway device is retained as the virtual media access control address MAC and the virtual network address IP configured when the gateway identity is the primary gateway;

[0142] After receiving the target data message sent by the source switch, the target data message is forwarded to the target switch according to the message transmission information, virtual MAC and virtual IP of the target data message; wherein the message transmission information includes the destination MAC and destination IP of the target data message.

[0143] In one embodiment, when the processor executes the computer program to forward the target data message to the target switch according to the message transmission information, the virtual MAC and the virtual IP of the target data message, the following steps are also implemented:

[0144] According to the destination MAC, virtual MAC and actual MAC of the gateway device, determine whether the target data message meets the processing conditions; if it does, forward the target data message to the target switch according to the switch type and destination IP of the source switch.

[0145] In one embodiment, when the processor executes the computer program to forward the target data message to the target switch according to the switch type and the destination IP of the source switch, the processor further implements the following steps:

[0146] If the source switch is determined to be the first switch according to the switch type of the source switch, the target data message is forwarded to the target switch; wherein the first switch is a switch between the network end and the gateway device; if the source switch is determined to be the second switch according to the switch type of the source switch, the destination IP and the virtual IP are compared for consistency to obtain an IP comparison result, and when the IP comparison result is consistent, the target data message is forwarded to the target switch; wherein the second switch is a switch between the gateway device and the user terminal.

[0147] In one embodiment, when the processor executes the computer program to determine whether the target data message meets the processing condition according to the destination MAC, the virtual MAC and the actual MAC of the gateway device, the following steps are also implemented:

[0148] If the destination MAC is consistent with any one of the virtual MAC and the actual MAC, it is determined that the target data message meets the processing condition.

[0149] In one embodiment, when the processor executes the computer program to forward the target data message to the target switch, the processor further implements the following steps:

[0150] Obtain the next hop encapsulation information of the target data message; wherein the next hop encapsulation information at least includes the sending interface information, the virtual local area network VLAN information and the next hop MAC; perform MAC encapsulation on the target data message according to the next hop encapsulation information and the actual MAC; forward the target data message after MAC encapsulation to the target switch.

[0151] In one embodiment, when the processor executes the computer program to perform MAC encapsulation on the target data message according to the next hop encapsulation information and the actual MAC, the processor further implements the following steps:

[0152] The actual MAC is used as the new source MAC of the target data message; the next-hop MAC is used as the new destination MAC of the target data message; and the target data message is MAC encapsulated according to the new destination MAC, the new source MAC, the sending interface information and the VLAN information.

[0153] In one embodiment, after the processor executes the computer program and the gateway identity of the gateway device is switched from the active gateway to the standby gateway, the following steps are further implemented:

[0154] Stop responding to the Address Resolution Protocol ARP request sent by the user terminal; wherein the destination IP carried in the ARP request is a virtual IP.

[0155] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0156] After the gateway identity of the gateway device is switched from the primary gateway to the backup gateway, the gateway identity of the gateway device is retained as the virtual media access control address MAC and the virtual network address IP configured when the gateway identity of the gateway device is the primary gateway;

[0157] After receiving the target data message sent by the source switch, the target data message is forwarded to the target switch according to the message transmission information, virtual MAC and virtual IP of the target data message; wherein the message transmission information includes the destination MAC and destination IP of the target data message.

[0158] In one embodiment, when the processor executes the computer program to forward the target data message to the target switch according to the message transmission information, the virtual MAC and the virtual IP of the target data message, the following steps are also implemented:

[0159] According to the destination MAC, virtual MAC and actual MAC of the gateway device, determine whether the target data message meets the processing conditions; if it does, forward the target data message to the target switch according to the switch type and destination IP of the source switch.

[0160] In one embodiment, when the processor executes the computer program to forward the target data message to the target switch according to the switch type and the destination IP of the source switch, the processor further implements the following steps:

[0161] If the source switch is determined to be the first switch according to the switch type of the source switch, the target data message is forwarded to the target switch; wherein the first switch is a switch between the network end and the gateway device; if the source switch is determined to be the second switch according to the switch type of the source switch, the destination IP and the virtual IP are compared for consistency to obtain an IP comparison result, and when the IP comparison result is consistent, the target data message is forwarded to the target switch; wherein the second switch is a switch between the gateway device and the user terminal.

[0162] In one embodiment, when the processor executes the computer program to determine whether the target data message meets the processing condition according to the destination MAC, the virtual MAC and the actual MAC of the gateway device, the following steps are also implemented:

[0163] If the destination MAC is consistent with any one of the virtual MAC and the actual MAC, it is determined that the target data message meets the processing condition.

[0164] In one embodiment, when the processor executes the computer program to forward the target data message to the target switch, the processor further implements the following steps:

[0165] Obtain the next hop encapsulation information of the target data message; wherein the next hop encapsulation information at least includes the sending interface information, the virtual local area network VLAN information and the next hop MAC; perform MAC encapsulation on the target data message according to the next hop encapsulation information and the actual MAC; forward the target data message after MAC encapsulation to the target switch.

[0166] In one embodiment, when the processor executes the computer program to perform MAC encapsulation on the target data message according to the next hop encapsulation information and the actual MAC, the processor further implements the following steps:

[0167] The actual MAC is used as the new source MAC of the target data message; the next-hop MAC is used as the new destination MAC of the target data message; and the target data message is MAC encapsulated according to the new destination MAC, the new source MAC, the sending interface information and the VLAN information.

[0168] In one embodiment, after the processor executes the computer program and the gateway identity of the gateway device is switched from the active gateway to the standby gateway, the following steps are further implemented:

[0169] Stop responding to the Address Resolution Protocol ARP request sent by the user terminal; wherein the destination IP carried in the ARP request is a virtual IP.

[0170] It should be noted that the data involved in this application (including but not limited to data used for analysis, storage, display, etc.) are all information and data fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0171] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0172] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0173] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A message forwarding method, characterized in that: Applied to a gateway device in a virtual routing redundancy protocol VRRP group, the method comprises: After the gateway identity of the gateway device is switched from the primary gateway to the backup gateway, retaining the virtual media access control address MAC and the virtual network address IP configured when the gateway identity of the gateway device is the primary gateway; After receiving the target data message sent by the source switch, the target data message is forwarded to the target switch according to the message transmission information, virtual MAC and virtual IP of the target data message; wherein the message transmission information includes the destination MAC and destination IP of the target data message.

2. The method according to claim 1, characterized in that The forwarding of the target data message to the target switch according to the message transmission information, the virtual MAC and the virtual IP of the target data message includes: Determine whether the target data message meets the processing condition according to the destination MAC, the virtual MAC and the actual MAC of the gateway device; If they match, the target data message is forwarded to the target switch according to the switch type of the source switch and the destination IP.

3. The method according to claim 2, characterized in that The forwarding the target data message to the target switch according to the switch type of the source switch and the destination IP address includes: If it is determined that the source switch is a first switch according to the switch type of the source switch, the target data message is forwarded to the target switch; wherein the first switch is a switch between the network end and the gateway device; If the source switch is determined to be a second switch according to the switch type of the source switch, the destination IP and the virtual IP are compared for consistency to obtain an IP comparison result, and if the IP comparison result is consistent, the target data message is forwarded to the target switch; wherein the second switch is a switch between the gateway device and the user terminal.

4. The method according to claim 2, characterized in that: The determining whether the target data message meets the processing condition according to the destination MAC, the virtual MAC and the actual MAC of the gateway device includes: If the destination MAC is consistent with any one of the virtual MAC and the actual MAC, it is determined that the target data message meets the processing condition.

5. The method according to claim 2, characterized in that: Forwarding the target data message to the target switch includes: Obtaining the next hop encapsulation information of the target data message; wherein the next hop encapsulation information at least includes the sending interface information, the virtual local area network VLAN information and the next hop MAC; Performing MAC encapsulation on the target data message according to the next hop encapsulation information and the actual MAC; The target data message after MAC encapsulation is forwarded to the target switch.

6. The method according to claim 5, characterized in that The performing MAC encapsulation on the target data message according to the next hop encapsulation information and the actual MAC includes: Using the actual MAC as the new source MAC of the target data message; Using the next hop MAC as the new destination MAC of the target data message; The target data message is MAC encapsulated according to the new destination MAC, the new source MAC, the sending interface information and the VLAN information.

7. The method according to claim 1, characterized in that After the gateway identity of the gateway device is switched from the active gateway to the standby gateway, the method further includes: Stop responding to the Address Resolution Protocol ARP request sent by the user terminal; wherein the destination IP carried in the ARP request is the virtual IP.

8. A message forwarding device, characterized in that: A gateway device configured in a VRRP group, the device comprising: An identity switching module, used for retaining the virtual media access control address MAC and virtual network address IP configured when the gateway identity of the gateway device is the primary gateway after the gateway identity of the gateway device is switched from the primary gateway to the backup gateway; The message forwarding module is used to forward the target data message to the target switch according to the message transmission information, virtual MAC and virtual IP of the target data message after receiving the target data message sent by the source switch; wherein the message transmission information includes the destination MAC and destination IP of the target data message.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Rapid forwarding method for network forwarding device

    CN101938415A

  • Method and device for switching VRRP (Virtual Router Redundancy Protocol) standard mode to load balancing mode

    CN102739544A

  • Data stream switching method and system

    CN105915400A

  • VRRP (Virtual Router Redundancy Protocol) router switching method, router, VRRP master-standby switching system and storage medium

    CN107911291A

  • Message forwarding method and device based on VRRP backup set

    CN107948062A

Cited By

  • FTTR network protection method, electronic device and computer program product

    CN122226132A