Disclosure of Invention
Based on this, it is necessary to provide a method, an apparatus, a computer device and a storage medium for forwarding a message, which can ensure that a small amount of traffic can be handled in time after the primary gateway device is switched to the standby gateway device, so as to avoid traffic loss.
In a first aspect, the present application provides a method for forwarding a message, which is applied to a gateway device in a VRRP group, including:
after the gateway identity of the gateway equipment is switched from a main gateway to a standby gateway, the virtual media access control address (MAC) and the virtual network address (IP) which are configured when the gateway identity of the gateway equipment is the main gateway are reserved;
and after receiving the target data message sent by the source switch, forwarding the target data message to the target switch according to message transmission information, virtual MAC and virtual IP of the target data message, wherein the message transmission information comprises the target MAC and the target IP of the target data message.
In one embodiment, the 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:
determining whether the target data message accords with a processing condition according to the target MAC, the virtual MAC and the actual MAC of the gateway equipment;
If yes, forwarding the target data message to a target switch according to the switch type of the source switch and the target IP.
In one embodiment, the forwarding the target data packet to a target switch according to the switch type of the source switch and the destination IP includes:
If the source switch is determined to be a first switch according to the switch type of the source switch, forwarding the target data message to a target switch, wherein the first switch is a switch between a network end and the gateway equipment;
And if the source switch is determined to be a second switch according to the switch type of the source switch, comparing the destination IP with the virtual IP to obtain an IP comparison result, and forwarding the target data message to a target switch under the condition that the IP comparison result is consistent, wherein the second switch is the switch between the gateway equipment and the user terminal.
In one embodiment, the determining whether the target data packet meets the processing condition according to the destination MAC, the virtual MAC, and the actual MAC of the gateway device includes:
And if the target MAC is consistent with any one of the virtual MAC and the actual MAC, determining that the target data message meets the processing conditions.
In one embodiment, forwarding the target data packet to a target switch includes:
Acquiring next hop encapsulation information of the target data message, wherein the next hop encapsulation information at least comprises sent interface information, virtual local area network VLAN information and next hop MAC;
Performing MAC encapsulation on the target data message according to the next hop encapsulation information and the actual MAC;
and forwarding the target data message subjected to MAC encapsulation to a target switch.
In one embodiment, the performing MAC encapsulation on the target data packet according to the next hop encapsulation information and the actual MAC includes:
The actual MAC is used as a new source MAC of the target data message;
Taking the next hop MAC as a new destination MAC of the target data message;
and 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.
In one embodiment, after the gateway identity of the gateway device is switched from the primary gateway to the standby gateway, the method further includes:
Stopping responding to an Address Resolution Protocol (ARP) request sent by the user terminal, wherein the destination IP carried in the ARP request is the virtual IP.
In a second aspect, the present application further provides a packet forwarding device, configured in a gateway device in a VRRP group, including:
the identity switching module is used for reserving a virtual media access control address (MAC) and a virtual network address (IP) which are configured when the gateway identity of the gateway equipment is the main gateway after the gateway identity of the gateway equipment is switched from the main gateway to the standby gateway;
And the message forwarding module is used for forwarding 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 after receiving the target data message sent by the source switch, wherein the message transmission information comprises the target MAC and the target IP of the target data message.
In a third aspect, the present application also provides a computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
after the gateway identity of the gateway equipment is switched from a main gateway to a standby gateway, the virtual media access control address (MAC) and the virtual network address (IP) which are configured when the gateway identity of the gateway equipment is the main gateway are reserved;
and after receiving the target data message sent by the source switch, forwarding the target data message to the target switch according to message transmission information, virtual MAC and virtual IP of the target data message, wherein the message transmission information comprises the target MAC and the target IP of the target data message.
In a fourth aspect, the present application also provides a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
after the gateway identity of the gateway equipment is switched from a main gateway to a standby gateway, the virtual media access control address (MAC) and the virtual network address (IP) which are configured when the gateway identity of the gateway equipment is the main gateway are reserved;
and after receiving the target data message sent by the source switch, forwarding the target data message to the target switch according to message transmission information, virtual MAC and virtual IP of the target data message, wherein the message transmission information comprises the target MAC and the target IP of the target data message.
In a fifth aspect, the application also provides a computer program product comprising a computer program which, when executed by a processor, performs the steps of:
after the gateway identity of the gateway equipment is switched from a main gateway to a standby gateway, the virtual media access control address (MAC) and the virtual network address (IP) which are configured when the gateway identity of the gateway equipment is the main gateway are reserved;
and after receiving the target data message sent by the source switch, forwarding the target data message to the target switch according to message transmission information, virtual MAC and virtual IP of the target data message, wherein the message transmission information comprises the target MAC and the target IP of the target data message.
The message forwarding method, the message forwarding device, the computer equipment and the storage medium are characterized in that after the gateway identity of the gateway equipment is switched from the main gateway to the standby gateway, the virtual media access control address MAC and the virtual network address IP configured when the gateway identity of the gateway equipment is the main gateway are reserved, after the target data message sent by the source switch is received, the target data message is forwarded to the target switch according to the message transmission information, the virtual MAC and the virtual IP of the target data message, wherein the message transmission information comprises the target MAC and the target IP of the target data message. According to the scheme, the configured virtual MAC and virtual IP are still reserved after the primary gateway equipment is switched to the standby gateway equipment, so that the gateway equipment can still accept the target data message for the standby gateway equipment, and further, the target data message can be ensured to be forwarded correctly by combining the target MAC and the target IP of the target data message and the virtual MAC and the virtual IP, so that the loss of the target data message is avoided to a certain extent.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
The message forwarding method provided by the embodiment of the application can be applied to an application environment shown in fig. 1. The gateway device 101 in the VRRP group is a main gateway device, is a gateway device for actually forwarding a data packet in the VRRP group, the gateway device 102 is a standby gateway device, the user terminal 1, the user terminal 2 and the user terminal 3 are all user terminals for communicating with the Internet (i.e. network terminals), the first switch 103 and the second switch 104 are switches for realizing communication between the user terminal and the network terminal, wherein the first switch 103 is a switch between the network terminal and the gateway device, and the second switch 104 is a switch between the gateway device and the user terminal. And correspondingly, if the target data message received by the gateway equipment is forwarded by the second switch, the second switch is the source switch, and the first switch is the target switch.
Optionally, after the gateway identity of the gateway device 101 is switched from the primary gateway to the standby 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 reserved, after the target data message sent by the source switch is received, the target data message is forwarded to the target switch 103 according to the message transmission information, the virtual MAC and the virtual IP of the target data message, where the message transmission information includes the destination MAC and the destination IP of the target data message.
In one embodiment, as shown in fig. 2, a method for forwarding a message is provided, which is illustrated by taking a gateway device in the VRRP group in fig. 1 as an example, and specifically includes the following steps:
S201, after the gateway identity of the gateway device is switched from the main gateway to the standby gateway, the virtual media access control address MAC and the virtual network address IP configured when the gateway identity of the gateway device is the main gateway are reserved.
The gateway equipment is a MASTER gateway (MASTER) equipment when the gateway identity of the gateway equipment is the MASTER gateway, and is a standby gateway (BACKUP) equipment when the gateway identity of the gateway equipment is the standby gateway.
It should be noted that a plurality of VRRP routers (gateway devices) are included in one VRRP group, and the same VRID (Virtual Router Identity Document, virtual router identifier) is used for identification. The virtual media access Control Address (MEDIA ACCESS Control Address, MAC) is a MAC Address generated by a virtual router in the VRRP group according to the VRID, and one virtual router has one virtual MAC Address. The virtual network address (Internet Protocol Address, IP) is the IP address of the virtual router, which is in fact the gateway address of the user.
Optionally, when a gateway device (i.e., a primary gateway device) with a gateway identity of a primary gateway in the VRRP group fails or needs to perform an upgrade test, the gateway identity needs to be switched to a standby gateway. Meanwhile, the virtual MAC and the virtual IP configured when the gateway identity of the gateway equipment is the main gateway are still reserved.
S202, after receiving the target data message sent by the source switch, forwarding 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 message transmission information comprises a destination MAC and a destination IP of the target data message.
Optionally, after receiving the target data message sent by the source switch, extracting message transmission information of the target data message, namely a target MAC and a target IP of the target data message, further, verifying the target MAC of the target data message, if the target MAC of the target data message is a virtual MAC, allowing the target data message to enter a local processing flow, judging whether further authentication is required for the target IP according to the switch type of the source switch, if not, directly forwarding the target data message to the target switch, and if so, forwarding the target data message to the target switch after the authentication is passed.
After the primary gateway device is switched to the standby gateway device, the VRRP switches to a new primary gateway device through the election, and at this time, the virtual MAC and the virtual IP are configured to the new primary gateway device, and the new primary gateway device may process the message normally, and also respond to the ARP (Address Resolution Protocol ) request of the user device for the virtual IP by using the virtual MAC and periodically notify GARP (Gratuitous Address Resolution Protocol, gratuitous ARP). However, the gateway device switching the gateway identity from the primary gateway to the standby gateway stops responding to the address resolution protocol ARP request sent by the user terminal, where the destination IP carried in the ARP request is a virtual IP. It will be appreciated that this ensures that the neighbour entries of the user equipment are updated only by the new active gateway device.
In the message forwarding method, after the gateway identity of the gateway equipment is switched from the main gateway to the standby gateway, the virtual media access control address (MAC) and the virtual network address (IP) which are configured when the gateway identity of the gateway equipment is the main gateway are reserved, after the target data message sent by the source switch is received, the target data message is forwarded to the target switch according to the message transmission information, the virtual MAC and the virtual IP of the target data message, wherein the message transmission information comprises the target MAC and the target IP of the target data message. According to the scheme, the configured virtual MAC and virtual IP are still reserved after the primary gateway equipment is switched to the standby gateway equipment, so that the gateway equipment can still accept the target data message for the standby gateway equipment, and further, the target data message can be ensured to be forwarded correctly by combining the target MAC and the target IP of the target data message and the virtual MAC and the virtual IP, so that the loss of the target data message is avoided to a certain extent.
Optionally, in one embodiment, as shown in fig. 3, there is provided a method for forwarding a target data packet to a target switch, specifically including the following steps:
S301, determining whether the target data message meets the processing conditions according to the target MAC, the virtual MAC and the actual MAC of the gateway equipment.
The destination MAC is the MAC address of the target device to which the target data packet carried in the target data packet arrives.
Optionally, if the destination MAC is consistent with any one of the virtual MAC and the actual MAC, determining that the target data packet meets the processing condition.
S302, if the data packet is in accordance with the switch type and the destination IP of the source switch, forwarding the target data packet to the target switch.
The destination IP is an IP address of a destination device to which the destination data packet carried in the destination data packet arrives.
It can be understood that, because the gateway device can not only receive the data message initiated by the network end, but also receive the data message sent by the user terminal, and when processing the data message sent from the network end, it is not necessary to verify the destination IP carried in the destination data message, so if the source switch is determined to be the first switch according to the switch type of the source switch, the destination data message is forwarded to the destination switch, where the first switch is the switch between the network end and the gateway device.
Correspondingly, 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 subjected to consistency comparison to obtain an IP comparison result, and the target data message is forwarded to the target switch under the condition that the IP comparison result is consistent, wherein the second switch is a switch between gateway equipment and a user terminal. Specifically, if the IP comparison result is consistent, route searching is required according to the routing table entry issued by the configuration, and further, after obtaining the information about the next hop of the target data packet, the target data packet is forwarded to the target switch.
In this embodiment, by preliminarily verifying whether the target data packet meets the processing conditions of the packet according to the destination MAC, the virtual MAC, and the actual MAC, and further determining different forwarding flows of the target data packet according to the switch type of the source switch, the method is equivalent to introducing the judgment logic of the target data packet, and ensures that the gateway device with the gateway identity switched from the primary gateway to the standby gateway can process the packet with the destination MAC being the virtual MAC.
Optionally, in one embodiment, as shown in fig. 4, there is provided a method for forwarding a target data packet to a target switch, specifically including the following steps:
s401, obtaining the next hop packaging information of the target data message.
The next hop encapsulation information at least comprises sending interface information, virtual local area network VLAN information and next hop MAC.
Alternatively, the next hop related information of the target data packet can be searched through the related command, and the packaging information for MAC packaging is extracted according to the next hop related information and used as the next hop packaging information of the target data packet.
S402, according to the next hop packaging information and the actual MAC, the target data message is subjected to MAC packaging.
Optionally, according to the next hop encapsulation information and the actual MAC, the MAC encapsulation may be automatically performed on the target data packet according to the MAC encapsulation procedure.
S403, forwarding the target data message subjected to MAC encapsulation to a target switch.
In this embodiment, the next hop encapsulation information and the actual MAC are introduced to perform MAC encapsulation on the target data packet, which provides an optional flow of MAC encapsulation, and ensures the accuracy of MAC encapsulation on the target data packet.
Optionally, in an embodiment, as shown in fig. 5, a method for MAC encapsulating a target data packet is provided, which specifically includes the following steps:
S501, taking the actual MAC as a new source MAC of the target data message.
The new source MAC is the source MAC of the target data message when the gateway equipment forwards the target data message.
Optionally, in order to avoid that the forwarding traffic of the gateway device, in which the gateway identity is switched from the primary gateway to the standby gateway, pulls the traffic of the new primary gateway device, the actual MAC may be used as the new source MAC of the target data packet. Correspondingly, aiming at the new main gateway equipment, the virtual MAC is used as the new source MAC of the target data message.
S502, taking the next hop MAC as a new destination MAC of the target data message.
The new destination MAC is the destination MAC of the target data message when the gateway equipment forwards the target data message.
Optionally, the next hop MAC is used as the new destination MAC of the target data packet. It will be appreciated that if the destination switch is the second switch, i.e. the switch between the gateway device and the user terminal, the new destination MAC is the interface MAC of the user terminal.
S503, according to the new destination MAC, the new source MAC, the sent interface information and the VLAN information, the target data message is subjected to MAC encapsulation.
Optionally, according to the MAC encapsulation flow, the MAC encapsulation is automatically performed on the target data packet according to the new destination MAC, the new source MAC, the outgoing interface information, and the VLAN information.
In this embodiment, for the gateway device in which the gateway identity is switched from the primary gateway to the standby gateway, by using the actual MAC of the target data packet forwarded by the gateway device as the new source MAC, the forwarding flow of the gateway device is prevented from pulling the flow of the new primary gateway device.
Fig. 6 is a flow chart of a message forwarding method in another embodiment, and on the basis of the foregoing embodiment, this embodiment provides an alternative example of the message forwarding method. With reference to fig. 6, the specific implementation procedure is as follows:
S601, after the gateway identity of the gateway device is switched from the main gateway to the standby gateway, the virtual MAC and the virtual IP configured when the gateway identity of the gateway device is the main gateway are reserved.
S602, after receiving a target data message sent by a source switch, acquiring a target MAC and a target IP of the target data message.
S603, judging whether the target MAC is the actual MAC of the gateway equipment, if so, executing S605, and if not, executing S604.
S604, judging whether the target MAC is a virtual MAC, if so, executing S605, and if not, prohibiting processing of the target data message.
S605, judging whether the source switch is a first switch, if so, executing S607, and if not, executing S606.
And S606, carrying out consistency comparison on the target IP and the virtual IP to obtain an IP comparison result, and executing S607 if the IP comparison result is consistent.
S607, obtaining the next hop packaging information of the target data message.
And S608, taking the next hop MAC in the next hop encapsulation information as a new destination MAC of the target data message.
S609, taking the actual MAC as a new source MAC of the target data message.
And S610, performing MAC encapsulation on the target data message according to the sent interface information and VLAN information in the new destination MAC, the new source MAC and the next hop encapsulation information.
S611, forwarding the target data message subjected to MAC encapsulation to a target switch.
The specific process of S601-S611 may refer to the description of the method embodiment, and its implementation principle and technical effect are similar, and are not repeated here.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a message forwarding device for realizing the above related message forwarding method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in one or more embodiments of the message forwarding device provided below may refer to the limitation of the message forwarding method hereinabove, and will not be described herein.
In an exemplary embodiment, as shown in fig. 7, there is provided a message forwarding apparatus 700, including an identity switching module 710 and a message forwarding module 720, wherein:
An identity switching module 710, configured to, after the gateway identity of the gateway device is switched from the primary gateway to the standby gateway, reserve a virtual media access control address MAC and a virtual network address IP configured when the gateway identity of the gateway device is the primary gateway;
And the message forwarding module 720 is configured 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 after receiving the target data message sent by the source switch, where the message transmission information includes the destination MAC and the destination IP of the target data message.
The message forwarding device reserves 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 the gateway identity of the gateway equipment is switched from the main gateway to the standby gateway, and forwards the target data message to the target switch according to message transmission information, the virtual MAC and the virtual IP of the target data message after receiving the target data message sent by the source switch, wherein the message transmission information comprises the target MAC and the target IP of the target data message. According to the scheme, the configured virtual MAC and virtual IP are still reserved after the primary gateway equipment is switched to the standby gateway equipment, so that the gateway equipment can still accept the target data message for the standby gateway equipment, and further, the target data message can be ensured to be forwarded correctly by combining the target MAC and the target IP of the target data message and the virtual MAC and the virtual IP, so that the loss of the target data message is avoided to a certain extent.
In one embodiment, the message forwarding module 720 includes:
And the first judging unit is used for determining whether the target data message accords with the processing conditions according to the target MAC, the virtual MAC and the actual MAC of the gateway equipment.
And the message forwarding unit is used for forwarding the target data message to the target switch according to the switch type and the target IP of the source switch if the message is in accordance with the message type and the target IP of the source switch.
In one embodiment, the message forwarding unit is specifically configured to:
If the source switch is determined to be a first switch according to the switch type of the source switch, forwarding the target data message to the target switch, wherein the first switch is a switch between the network terminal and the gateway equipment, if the source switch is determined to be a second switch according to the switch type of the source switch, performing consistency comparison on the target IP and the virtual IP to obtain an IP comparison result, and forwarding the target data message to the target switch under the condition that the IP comparison result is consistent, wherein the second switch is a switch between the gateway equipment and the user terminal.
In one embodiment, the first judging unit is specifically configured to:
if the target MAC is consistent with any one of the virtual MAC and the actual MAC, determining whether the target data message meets the processing conditions.
In one embodiment, the message forwarding unit includes:
The information acquisition slave unit is used for acquiring next hop encapsulation information of the target data message, wherein the next hop encapsulation information at least comprises sending interface information, virtual local area network VLAN information and next hop MAC.
And the encapsulation slave unit is used for carrying out MAC encapsulation on the target data message according to the next hop encapsulation information and the actual MAC.
And the forwarding slave unit is used for forwarding the target data message subjected to the MAC encapsulation to the target switch.
In one embodiment, the encapsulation slave unit is specifically configured to:
The method comprises the steps of taking the actual MAC as a new source MAC of a target data message, taking the next hop MAC as a new destination MAC of the target data message, and carrying out MAC encapsulation on the target data message according to the new destination MAC, the new source MAC, the sent interface information and VLAN information.
In one embodiment, identity switching module 710 is further configured to:
And stopping 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.
All or part of the modules in the message forwarding device can be realized by software, hardware and a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one exemplary embodiment, a computer device is provided, which may be a server, and the internal structure thereof may be as shown in fig. 8. The computer device includes a processor, a memory, an Input/Output interface (I/O) and a communication interface. 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. Wherein the processor of the computer device is configured 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, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a message forwarding method.
It will be appreciated by those skilled in the art that the structure shown in FIG. 8 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In one exemplary embodiment, a computer device is provided comprising a memory and a processor, the memory having stored therein a computer program, the processor when executing the computer program performing the steps of:
After the gateway identity of the gateway equipment is switched from the main gateway to the standby gateway, the virtual media access control address MAC and the virtual network address IP which are configured when the gateway identity of the gateway equipment is the main gateway are reserved;
and after receiving the target data message sent by the source switch, forwarding the target data message to the target switch according to message transmission information, virtual MAC and virtual IP of the target data message, wherein the message transmission information comprises the target MAC and the target IP of the target data message.
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 further implemented:
and if so, forwarding the target data message to the target switch according to the switch type and the target IP of the source switch.
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 target IP of the source switch, the following steps are further implemented:
If the source switch is determined to be a first switch according to the switch type of the source switch, forwarding the target data message to the target switch, wherein the first switch is a switch between the network terminal and the gateway equipment, if the source switch is determined to be a second switch according to the switch type of the source switch, performing consistency comparison on the target IP and the virtual IP to obtain an IP comparison result, and forwarding the target data message to the target switch under the condition that the IP comparison result is consistent, wherein the second switch is a switch between the gateway equipment and the user terminal.
In one embodiment, when the processor executes the computer program to determine whether the target data packet meets the processing condition according to the target MAC, the virtual MAC and the actual MAC of the gateway device, the following steps are further implemented:
And if the target MAC is consistent with any one of the virtual MAC and the actual MAC, determining that the target data message meets the processing conditions.
In one embodiment, when the processor executes the computer program to forward the target data message to the target switch, the following steps are further implemented:
The method comprises the steps of obtaining next hop encapsulation information of a target data message, wherein the next hop encapsulation information at least comprises sending interface information, virtual local area network VLAN information and next hop MAC, carrying out MAC encapsulation on the target data message according to the next hop encapsulation information and actual MAC, and forwarding the target data message subjected to MAC encapsulation to a target switch.
In one embodiment, when the processor executes the computer program to perform MAC encapsulation on the target data packet according to the next hop encapsulation information and the actual MAC, the following steps are further implemented:
The method comprises the steps of taking the actual MAC as a new source MAC of a target data message, taking the next hop MAC as a new destination MAC of the target data message, and carrying out MAC encapsulation on the target data message according to the new destination MAC, the new source MAC, the sent interface information and VLAN information.
In one embodiment, after the processor performs the switching of the gateway identity of the computer program gateway device from the primary gateway to the backup gateway, the following steps are further implemented:
And stopping 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.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of:
After the gateway identity of the gateway equipment is switched from the main gateway to the standby gateway, the virtual media access control address MAC and the virtual network address IP which are configured when the gateway identity of the gateway equipment is the main gateway are reserved;
and after receiving the target data message sent by the source switch, forwarding the target data message to the target switch according to message transmission information, virtual MAC and virtual IP of the target data message, wherein the message transmission information comprises the target MAC and the target IP of the target data message.
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 further implemented:
and if so, forwarding the target data message to the target switch according to the switch type and the target IP of the source switch.
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 target IP of the source switch, the following steps are further implemented:
If the source switch is determined to be a first switch according to the switch type of the source switch, forwarding the target data message to the target switch, wherein the first switch is a switch between the network terminal and the gateway equipment, if the source switch is determined to be a second switch according to the switch type of the source switch, performing consistency comparison on the target IP and the virtual IP to obtain an IP comparison result, and forwarding the target data message to the target switch under the condition that the IP comparison result is consistent, wherein the second switch is a switch between the gateway equipment and the user terminal.
In one embodiment, when the processor executes the computer program to determine whether the target data packet meets the processing condition according to the target MAC, the virtual MAC and the actual MAC of the gateway device, the following steps are further implemented:
If the target MAC is consistent with any one of the virtual MAC and the actual MAC, determining that the target data message is a combined processing condition.
In one embodiment, when the processor executes the computer program to forward the target data message to the target switch, the following steps are further implemented:
The method comprises the steps of obtaining next hop encapsulation information of a target data message, wherein the next hop encapsulation information at least comprises sending interface information, virtual local area network VLAN information and next hop MAC, carrying out MAC encapsulation on the target data message according to the next hop encapsulation information and actual MAC, and forwarding the target data message subjected to MAC encapsulation to a target switch.
In one embodiment, when the processor executes the computer program to perform MAC encapsulation on the target data packet according to the next hop encapsulation information and the actual MAC, the following steps are further implemented:
The method comprises the steps of taking the actual MAC as a new source MAC of a target data message, taking the next hop MAC as a new destination MAC of the target data message, and carrying out MAC encapsulation on the target data message according to the new destination MAC, the new source MAC, the sent interface information and VLAN information.
In one embodiment, after the processor performs the switching of the gateway identity of the computer program gateway device from the primary gateway to the backup gateway, the following steps are further implemented:
And stopping 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.
In one embodiment, a computer program product is provided comprising a computer program which, when executed by a processor, performs the steps of:
After the gateway identity of the gateway equipment is switched from the main gateway to the standby gateway, the virtual media access control address MAC and the virtual network address IP which are configured when the gateway identity of the gateway equipment is the main gateway are reserved;
and after receiving the target data message sent by the source switch, forwarding the target data message to the target switch according to message transmission information, virtual MAC and virtual IP of the target data message, wherein the message transmission information comprises the target MAC and the target IP of the target data message.
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 further implemented:
and if so, forwarding the target data message to the target switch according to the switch type and the target IP of the source switch.
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 target IP of the source switch, the following steps are further implemented:
If the source switch is determined to be a first switch according to the switch type of the source switch, forwarding the target data message to the target switch, wherein the first switch is a switch between the network terminal and the gateway equipment, if the source switch is determined to be a second switch according to the switch type of the source switch, performing consistency comparison on the target IP and the virtual IP to obtain an IP comparison result, and forwarding the target data message to the target switch under the condition that the IP comparison result is consistent, wherein the second switch is a switch between the gateway equipment and the user terminal.
In one embodiment, when the processor executes the computer program to determine whether the target data packet meets the processing condition according to the target MAC, the virtual MAC and the actual MAC of the gateway device, the following steps are further implemented:
And if the target MAC is consistent with any one of the virtual MAC and the actual MAC, determining that the target data message meets the processing conditions.
In one embodiment, when the processor executes the computer program to forward the target data message to the target switch, the following steps are further implemented:
The method comprises the steps of obtaining next hop encapsulation information of a target data message, wherein the next hop encapsulation information at least comprises sending interface information, virtual local area network VLAN information and next hop MAC, carrying out MAC encapsulation on the target data message according to the next hop encapsulation information and actual MAC, and forwarding the target data message subjected to MAC encapsulation to a target switch.
In one embodiment, when the processor executes the computer program to perform MAC encapsulation on the target data packet according to the next hop encapsulation information and the actual MAC, the following steps are further implemented:
The method comprises the steps of taking the actual MAC as a new source MAC of a target data message, taking the next hop MAC as a new destination MAC of the target data message, and carrying out MAC encapsulation on the target data message according to the new destination MAC, the new source MAC, the sent interface information and VLAN information.
In one embodiment, after the processor performs the switching of the gateway identity of the computer program gateway device from the primary gateway to the backup gateway, the following steps are further implemented:
And stopping 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.
It should be noted that, the data (including, but not limited to, data for analysis, data stored, data displayed, etc.) related to the present application are information and data fully authorized by each party, and the collection, use and processing of the related data are required to meet the related regulations.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magneto-resistive random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (PHASE CHANGE Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in various forms such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), etc. The databases referred to in the embodiments provided herein may include at least one of a relational database and a non-relational database. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processor referred to in the embodiments provided in the present application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, or the like, but is not limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the application and are described in detail herein without thereby limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of the application should be assessed as that of the appended claims.