Method and application of router active / standby backup based on VARP
By creating DTMP and VARP modules in the loop network, electing Master devices and Backup devices, and replying to ARP requests based on the Source IP parity judgment of ARP request, the problems of poor switching performance and complex VIP configuration are solved, and the existing VRRP protocols are implemented. The rapid switching and load sharing of router devices are improved, and network stability and reliability are improved.
Patent Information
- Application Number
- CN202211700622.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-28
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2042-12-28
AI Technical Summary
The existing VRRP protocol has poor switching performance when the gateway device fails, making it difficult to meet the needs of complex ring network environments, and the VIP configuration is complex in the load sharing scenario, affecting network stability and reliability.
Create DTMP modules and VARP modules in the loop network, create and update the device information table by iteratively sending DTMP protocol messages, selecting Master devices and Backup devices, and replying to ARP requests based on the Source IP parity judgment of the ARP request, realizing router devices primary backup and load sharing.
It realizes rapid switching and load sharing in the event of gateway equipment failure, reduces the equipment failure rate, and improves network stability and reliability.
Smart Images

Figure CN116016327B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of network communication, and in particular to a method and application for realizing router master-slave backup based on VARP. Background Art
[0002] In a general network environment, all host devices in the same subnet will set the same default route, pointing to the same gateway. When all hosts send out messages whose destination addresses are not within the local network segment, they will match the default route and send them to the gateway, which will then send them to the external network, thus enabling communication between the host devices in the internal network and the external network.
[0003] However, in the above network deployment, once the gateway device fails, all host devices under the gateway device will be unable to communicate with the external network. With the rapid development of the network, the stability and reliability of the network environment are becoming more and more important. After the gateway device inevitably fails, whether it can be quickly restored or whether there are other devices that can quickly replace the failed device to assume the forwarding task is an important indicator to measure the stability and reliability of the network.
[0004] In the prior art, whether the backup device in the VRRP protocol (Virtual Router Redundancy Protocol) switches to the master device depends on whether the notification message sent by the master device times out, that is, when the backup device does not receive the notification message from the master device within a certain period of time, the backup device will think that the master device has failed and then switch to the master device. The switching time is long, the switching performance is also poor, and in a more complex ring network, the switching performance is even more difficult to meet the requirements. In the load sharing scenario, two sessions are configured with different VIPs, and different host devices need to be configured with different VIPs, which makes the configuration more complicated.
[0005] The information disclosed in this background technology section is only intended to enhance the understanding of the overall background of the invention and should not be regarded as an acknowledgment or any form of suggestion that the information constitutes the prior art already known to a person skilled in the art. Summary of the invention
[0006] The object of the present invention is to provide a method and application for realizing router active-standby backup based on VARP, which can realize the communication between the host device in the intranet and the external network under active-standby backup.
[0007] To achieve the above object, an embodiment of the present invention provides a method for implementing router active / standby backup based on VARP.
[0008] In one or more embodiments of the present invention, the method includes: in a loop network, creating a DTMP module and a VARP module in multiple router devices, wherein the DTMP protocol is a device topology management protocol for managing topology information for connecting multiple router devices when the network is established, and the topology information includes router device MAC, router device status, each port status and adjacent router device information; by iteratively sending DTMP protocol messages between the multiple router devices, creating and updating a device information table, and each router device notifies the VARP module in each router device of a message that the device information table is updated; the VARP modules of the multiple router devices select a Master device and a Backup device according to an election rule; and when communicating with an external network, the multiple router devices in the loop network determine whether the Master device or the Backup device replies to the ARP request based on the Source IP parity of the ARP request message received from the host device, and the determined router device returns its own MAC address to the host device after the determination.
[0009] In one or more embodiments of the present invention, the device information table is created and updated by iteratively sending DTMP protocol messages between the multiple router devices, including: the DTMP module of the router device periodically sends DTMP protocol messages to the adjacent router devices; after receiving the DTMP protocol message, the adjacent router device creates a device information table, and encapsulates the router device information and the adjacent router device information into a new DTMP protocol message, and continues to send it to the adjacent router device; and the DTMP module of each router device receives the new DTMP protocol message to complete the update of the device information table.
[0010] In one or more embodiments of the present invention, the election rules include: among router devices, selecting the router device with the largest route-mac as the Master device, and the router device with the second largest route-mac as the Backup device; if the Backup device cannot be selected, the Master device and the Backup device are the same device; the Master device occupies the VMAC1 address, and the Backup device occupies the VMAC2 address; and if the Master device and the Backup device are the same device, the devices occupy both the VMAC1 and VMAC2 addresses, wherein VMAC1 is configured by the administrator, and VMAC2 is automatically generated by the system based on the configured VMAC1.
[0011] In one or more embodiments of the present invention, the method of determining whether the Master device or the Backup device replies to the ARP request based on the parity of the Source IP of the ARP request message includes: if the Source IP is an odd number, the Master device uses VMAC1 to reply to the ARP request; if the Source IP is an even number, the Backup device uses VMAC2 to reply to the ARP request; and if the Master device and the Backup device are the same device, the device replies to the ARP request, wherein when the Source IP is an odd number, VMAC1 is used to reply, and when the Source IP is an even number, VMAC2 is used to reply.
[0012] In one or more embodiments of the present invention, the method further includes: the determined router device receives the message encapsulated by the host device, and sends the message to an external network to complete communication with the external network, wherein the message is encapsulated by the host device using the MAC address of the determined router device.
[0013] In one or more embodiments of the present invention, the method further includes: in the load sharing working mode, when the Master device and the Backup device exist and are not the same router device, the Master device and the Backup device respectively undertake traffic forwarding tasks of different hosts.
[0014] In one or more embodiments of the present invention, the method further includes: when a gateway device fails, the DTMP module of the gateway device updates the device information and sends a DTMP update message to other router devices, and the other router devices receive and parse the DTMP update message to complete the update of the device information table; after the update is completed, the DTMP module notifies the VARP module, and the VARP module selects a new Master device and Backup device from the router devices according to the election rules; each router device determines whether it is the Master device, and if not, returns; if so, when the Backup device does not exist, the Master device occupies the VMAC1 and VMAC2 addresses; when the Backup device exists, the Master device occupies the VMAC1 and VMAC2 addresses; er device occupies the VMAC1 address; the Master device sends a VARP update message to other router devices, other router devices receive and parse the update message, and compare the MAC address of the Master device with the MAC address of the router device. If the Master device has a higher priority, the update message is trusted; if it is determined that the router device is a Backup device, the router device is set to the Backup state, occupies the VMAC2 address, and clears the VMAC1 address; if it is determined that the router device is not a Backup device, the processing is terminated and the occupied VMAC address is cleared; and the router device is updated, and the host device communicates with the external network through the new Master device and Backup device.
[0015] In one or more embodiments of the present invention, the method further includes: when the gateway device failure is recovered, the recovered gateway device updates the device information table and sends a DTMP update message to the adjacent router device, and the adjacent router device updates the device information table after receiving the message; after each router device completes the update of the device information table, it notifies the VARP module and completes the process of electing a new device and notifying other devices; and if the faulty device was a Master device or a Backup device before the failure occurred, traffic forwarding is restored.
[0016] In another aspect of the present invention, a device for implementing active / standby backup of routers based on VARP is provided, which includes a creation module, an update module, an election module and a communication module.
[0017] A creation module is used to create DTMP modules and VARP modules in multiple router devices in a loop network, wherein the DTMP protocol is a device topology management protocol, which is used to manage the topology information of multiple router devices connected when the network is established, and the topology information includes the router device MAC, router device status, each port status and adjacent router device information.
[0018] The updating module is used to create and update the device information table by iteratively sending DTMP protocol messages between the multiple router devices, and each router device notifies the VARP module in each router device of the message that the device information table is updated.
[0019] The election module is used for the VARP modules of the multiple router devices to select the Master device and the Backup device according to the election rules.
[0020] The communication module is used for multiple router devices in the loop network to determine whether the Master device or the Backup device will reply to the ARP request according to the Source IP parity of the ARP request message received from the host device when communicating with the external network. After the determination, the determined router device returns its own MAC address to the host device.
[0021] In one or more embodiments of the present invention, the update module is also used for: the DTMP module of the router device periodically sends DTMP protocol messages to the adjacent router devices; after receiving the DTMP protocol messages, the adjacent router devices create a device information table, and encapsulate the router device information and the adjacent router device information into a new DTMP protocol message, and continue to send it to the adjacent router devices; and the DTMP module of each router device receives the new DTMP protocol message to complete the update of the device information table.
[0022] In one or more embodiments of the present invention, the election module is also used to: among the router devices, select the router device with the largest route-mac as the Master device, and the router device with the second largest route-mac as the Backup device; if the Backup device cannot be selected, the Master device and the Backup device are the same device; the Master device occupies the VMAC1 address, and the Backup device occupies the VMAC2 address; and if the Master device and the Backup device are the same device, the devices simultaneously occupy the VMAC1 and VMAC2 addresses, wherein VMAC1 is configured by the administrator, and VMAC2 is automatically generated by the system based on the configured VMAC1.
[0023] In one or more embodiments of the present invention, the communication module is further used for: if the Source IP is an odd number, the Master device uses VMAC1 to reply to the ARP request; if the Source IP is an even number, the Backup device uses VMAC2 to reply to the ARP request; and if the Master device and the Backup device are the same device, the device replies to the ARP request, wherein VMAC1 is used to reply when the Source IP is an odd number, and VMAC2 is used to reply when the Source IP is an even number.
[0024] In one or more embodiments of the present invention, the communication module is also used for: the determined router device receives the message encapsulated by the host device, and sends the message to the external network to complete the communication with the external network, wherein the message is encapsulated by the host device using the mac address of the determined router device.
[0025] In one or more embodiments of the present invention, the communication module is also used for: in the load sharing working mode, when the Master device and the Backup device exist and are not the same router device, the Master device and the Backup device respectively undertake the traffic forwarding tasks of different hosts.
[0026] In one or more embodiments of the present invention, the communication module is also used for: when a gateway device fails, the DTMP module of the gateway device updates the device information and sends a DTMP update message to other router devices, and the other router devices receive and parse the DTMP update message to complete the update of the device information table; after the update is completed, the DTMP module notifies the VARP module, and the VARP module selects a new Master device and Backup device from the router devices according to the election rules; each router device determines whether it is the Master device, and if not, returns; if so, when the Backup device does not exist, the Master device occupies the VMAC1 and VMAC2 addresses; when the Backup device exists, the Mas ter device occupies the VMAC1 address; the Master device sends a VARP update message to other router devices, the other router devices receive and parse the update message, and compare the MAC address of the Master device with the MAC address of the router device. If the Master device has a higher priority, the update message is trusted; if it is determined that the router device is a Backup device, the router device is set to the Backup state, occupies the VMAC2 address, and clears the VMAC1 address; if it is determined that the router device is not a Backup device, the processing is terminated and the occupied VMAC address is cleared; and the router device is updated, and the host device communicates with the external network through the new Master device and Backup device.
[0027] In one or more embodiments of the present invention, the communication module is also used for: when a gateway device failure is recovered, the recovered gateway device updates the device information table and sends a DTMP update message to an adjacent router device, and the adjacent router device updates the device information table after receiving the message; after each router device completes the update of the device information table, it notifies the VARP module and completes the process of electing a new device and notifying other devices; and if the failed device was a Master device or a Backup device before the failure occurred, traffic forwarding is restored.
[0028] In another aspect of the present invention, an electronic device is provided, comprising: at least one processor; and a memory, wherein the memory stores instructions, and when the instructions are executed by the at least one processor, the at least one processor executes the method for implementing router active-standby backup based on VARP as described above.
[0029] In another aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for implementing router active-standby backup based on VARP are implemented.
[0030] Compared with the prior art, the method and application of realizing router active-standby backup based on VARP according to the embodiment of the present invention can provide a communication between host devices in the intranet and the external network under active-standby backup in a loop network in an Ethernet environment with high requirements for network stability; in the case of a gateway device failure, a active-standby election algorithm and a status update algorithm are used to realize fast switching after the failure of the primary device; the function of routing load sharing can be realized, and in the case of an overloaded router device, the pressure on the primary router device is reduced, thereby reducing the device failure rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 is a flow chart of a method for implementing router active / standby backup based on VARP according to an embodiment of the present invention;
[0032] Figure 2 1. It is a network structure diagram of a method for implementing router active / standby backup based on VARP according to an embodiment of the present invention;
[0033] Figure 3 It is a flow chart of a failure scenario of a method for implementing router active / standby backup based on VARP according to an embodiment of the present invention;
[0034] Figure 4 It is a logic flow chart of device update of a method for implementing router active / standby backup based on VARP according to an embodiment of the present invention;
[0035] Figure 5 It is a logic flow chart of a device receiving an update message in a method for implementing a router active / standby backup based on VARP according to an embodiment of the present invention;
[0036] Figure 6 It is a flowchart of a fault recovery scenario of a method for implementing router active / standby backup based on VARP according to an embodiment of the present invention;
[0037] Figure 7 It is a structural diagram of a device for implementing router active / standby backup based on VARP according to an embodiment of the present invention;
[0038] Figure 8 The hardware structure diagram of a computing device for implementing router active / standby backup based on VARP according to an embodiment of the present invention. DETAILED DESCRIPTION
[0039] The specific implementation modes of the present invention are described in detail below in conjunction with the accompanying drawings, but it should be understood that the protection scope of the present invention is not limited by the specific implementation modes.
[0040] Unless explicitly stated otherwise, throughout the specification and claims, the term “comprise” or variations such as “include” or “comprising”, etc., will be understood to include the stated elements or components but not to exclude other elements or components.
[0041] The technical solutions provided by various embodiments of the present invention are described in detail below in conjunction with the accompanying drawings.
[0042] Example 1
[0043] like Figure 1 to Figure 2 As shown, a method for realizing router active / standby backup based on VARP of the present invention is introduced, and the method comprises the following steps.
[0044] This embodiment is implemented when the router device is normal.
[0045] In step S101, in a loop network, a DTMP module and a VARP module are created in multiple router devices, wherein the DTMP protocol is a device topology management protocol, which is used to manage the topology information of multiple router devices connected when the network is established, and the topology information includes the router device MAC, the router device status, the status of each port and the adjacent router device information;
[0046] In this embodiment, VARP stands for Virtual-ARP. The main function of the Address Resolution Protocol ARP (Address Resolution Protocol) is to realize the mapping between the IP address and the physical address recognized by the local network, that is, the Ethernet MAC address. A VIP and a VMAC are configured in the VARP module. VIP is the gateway address of the default route of the host device, which is used for communication between the host device and the external network. VMAC is a virtual mac address. When the host device communicates with the external network, if the gateway address is known, it is necessary to obtain the mac address corresponding to the gateway address to encapsulate the Ethernet header. The host device sends an ARP request message to the gateway device, and the gateway device uses VMAC to reply to the ARP request message. After receiving the ARP reply message, the host device parses the VMAC replied by the gateway device, and can use the VMAC to encapsulate the Ethernet header and send the message outward to realize communication with the external network.
[0047] The DTMP module maintains a stable state through regular message updates. If the router device information in the loop network changes, the DTMP module will notify other modules, and each module will perform corresponding processing, such as the VARP module in the present invention.
[0048] refer to Figure 2As shown, this embodiment provides a commonly used ring network structure, there are n router devices such as R1, R2, R3, R4, etc., the MAC addresses are MAC1, MAC2, MAC3, MAC4, etc., and the MAC addresses are different. Host devices such as H11, H12, H13, H21 are hung under the router devices, and the uplink ports of the router devices are connected to the external network. Each router device is configured with the same VIP and VMAC. The host device communicates with the external network through the router device, and the router devices in the ring network topology can realize load sharing and redundant backup.
[0049] In step S102, the device information table is created and updated by iteratively sending DTMP protocol messages between the multiple router devices, and each router device notifies the VARP module in each router device of a message that the device information table is updated.
[0050] In this embodiment, the DTMP module of the router device periodically sends DTMP protocol messages to the adjacent router devices; after receiving the DTMP protocol messages, the adjacent router devices create a device information table, and encapsulate the router device information and the adjacent router device information into a new DTMP protocol message, and continue to send it to the adjacent router devices; and the DTMP module of each router device receives the new DTMP protocol message to complete the update of the device information table.
[0051] Specifically, the DTMP protocol message contains information such as the router device MAC, router device status, and uplink port status. The router device encapsulates its own device information into the DTMP message and sends the DTMP message to the adjacent device. When the adjacent router device receives the DTMP protocol message, it parses the DTMP protocol message and uses the device information in the message as the key to create a device information table. After updating its own device information table, the DTMP module of each router device notifies the VARP module in the same device of the information. Through the interaction of DTMP protocol messages, each router device maintains the information of all devices in the network.
[0052] In step S103, the VARP modules of the multiple router devices select a Master device and a Backup device according to an election rule.
[0053] In this embodiment, the election rules used are as follows: Among the router devices, the router device with the largest route-mac is selected as the Master device, and the router device with the second largest route-mac is selected as the Backup device. If the Backup device cannot be selected, the Master device and the Backup device are the same device; the Master device occupies the VMAC1 address, and the Backup device occupies the VMAC2 address; and if the Master device and the Backup device are the same device, the device occupies both the VMAC1 and VMAC2 addresses, wherein VMAC1 is configured by the administrator, and VMAC2 is automatically generated by the system based on the configured VMAC1.
[0054] When the router device calculates that it is the Master device, it needs to send a VARP update message to other network devices to inform other network devices of the information of the Master and Backup devices. The data fields of the VARP update message include M-mac, M-status, B-mac and B-status. M-mac is the mac address of the Master device; M-status is the uplink status of the Master device, 0 is down, 1 is up; B-mac is the mac address of the Backup device; B-status is the uplink status of the Backup device, 0 is down, 1 is up.
[0055] In step S104, when communicating with the external network, multiple router devices in the loop network determine whether the Master device or the Backup device will reply to the ARP request based on the Source IP parity of the ARP request message received from the host device. After the determination, the determined router device returns its own MAC address to the host device.
[0056] In this embodiment, the determined router device receives the message encapsulated by the host device and sends the message to the external network to complete the communication with the external network, wherein the message is encapsulated by the host device using the MAC address of the determined router device.
[0057] Specifically, when the host device in this loop network wants to communicate with the external network, it sends a broadcast ARP request to request the VMAC address corresponding to the VIP. The router devices in the network will receive the ARP request, and only the Master and Backup devices with the VMAC address can reply to the ARP response. If the Source IP is an odd number, the Master device uses VMAC1 to reply to the ARP request; if the Source IP is an even number, the Backup device uses VMAC2 to reply to the ARP request; and if the Master device and the Backup device are the same device, the device replies to the ARP request, wherein when the Source IP is an odd number, VMAC1 is used to reply, and when the Source IP is an even number, VMAC2 is used to reply.
[0058] When the host device receives the ARP reply, it uses the MAC address in the ARP reply to encapsulate the Ethernet header and send the data message to the gateway device, which forwards it. The destination MAC of the message received by the gateway device matches its own VMAC, so it can perform routing forwarding and send the message to the external network environment, thus realizing communication between the host device and the external network.
[0059] In this embodiment, in the load balancing working mode, when the Master device and the Backup device exist and are not the same router device, the Master device and the Backup device respectively assume the traffic forwarding tasks of different hosts.
[0060] Example 2
[0061] like Figures 3 to 5 As shown, a method for realizing router active / standby backup based on VARP of the present invention is introduced, and the method comprises the following steps.
[0062] This embodiment is implemented when a router device fails.
[0063] In step S301, the DTMP module in the router device updates the device information and sends a DTMP update message to other router devices. The other router devices receive and parse the DTMP update message to complete the update of the device information table.
[0064] Specifically, when the uplink port of a router device in a loop network is in a down state, that is, it is disconnected from the external network, the DTMP module of the router device updates its own device information table and sends a DTMP update message to other router devices. After receiving the DTMP update message, each router device parses the message and updates the device information table.
[0065] In step S302, after the update is completed, the DTMP module notifies the VARP module, and the VARP module selects a new Master device and Backup device from the router devices according to the election rules.
[0066] In this embodiment, in order to avoid multiple packets in the network, the switch of the router device requires the new Master device to send a VARP update message to notify each device.
[0067] In step S303, each router device determines whether it is a Master device, and if so, sends an update message to other router devices. Other router devices receive and parse the update message to determine whether they are Backup devices.
[0068] refer to Figure 4 ,The processing logic when the router device in the loop network is updated is as follows. Each router device determines whether it is the Master device. If not, it returns a VARP update message; if so, when the Backup device does not exist, the Master device occupies the VMAC1 and VMAC2 addresses; when the Backup device exists, the Master device clears its existing VMAC and occupies the VMAC1 address; encapsulates the update message and sends it to other routers.
[0069] refer to Figure 5 , the processing logic of the router device after receiving the update message is as follows. After other router devices receive the VARP update message, they parse the update message and compare the mac address of the master device with the mac address of the router device. If the master device has a higher priority, the update message is trusted; if it is determined that the router device is a backup device, the router device is set to the backup state, occupies the VMAC2 address, and clears the VMAC1 address; if it is determined that the router device is not a backup device, the processing is terminated and the occupied VMAC address is cleared.
[0070] In step S304, the router device is updated, and the host device communicates with the external network through the new Master device and Backup device.
[0071] In this embodiment, the Master device and the Backup device in the loop network are all updated, and each host device will communicate with the external network through the new Master device and the Backup device, thereby realizing the redundant backup function.
[0072] Example 3
[0073] like Figure 6As shown, a method for realizing router active / standby backup based on VARP of the present invention is introduced, and the method comprises the following steps.
[0074] This embodiment is implemented when a router device fails and recovers.
[0075] In step S601, the gateway device that has recovered from the fault updates the device information table and sends a DTMP update message to an adjacent router device. After receiving the message, the adjacent router device updates the device information table.
[0076] In this embodiment, if the uplink of the faulty router device returns to normal, the DTMP module of the router device updates its own device information table and sends a DTMP update message to other router devices. After receiving the DTMP update message, each router device parses the message and updates the device information table.
[0077] In step S602, after each router device completes updating the device information table, it notifies the VARP module and completes the process of electing a new device and notifying other devices.
[0078] In this embodiment, the VARP module selects a new Master device and Backup device from the current router device according to the election rule. The elected Master device sends a VARP update message to other network devices to inform other devices of the information of the Master device and Backup device.
[0079] In step S603, if the faulty device is a master device or a backup device before the fault occurs, traffic forwarding is restored.
[0080] In this embodiment, through the above-mentioned operation after the router device fails and recovers, if the failed router device is a primary gateway device or a backup gateway device, rapid switching of traffic can be achieved.
[0081] According to the method and application of realizing router active-standby backup based on VARP in the embodiment of the present invention, it can provide a communication between host devices in the intranet and the external network under active-standby backup in a loop network in an Ethernet environment with high requirements on network stability; in the case of a gateway device failure, a active-standby election algorithm and a status update algorithm are used to realize fast switching after the failure of the primary device; the function of routing load sharing can be realized, and in the case of an overloaded router device, the pressure on the primary router device is reduced, thereby reducing the device failure rate.
[0082] Example 4
[0083] like Figure 7 As shown, a device for implementing router active / standby backup based on VARP according to a specific implementation of the present invention is introduced.
[0084] In the embodiment of the present invention, the apparatus for implementing router active / standby backup based on VARP includes a creation module 701 , an update module 702 , an election module 703 and a communication module 704 .
[0085] The creation module 701 is used to create a DTMP module and a VARP module in multiple router devices in a loop network, wherein the DTMP protocol is a device topology management protocol, which is used to manage the topology information of multiple router devices connected when the network is established, and the topology information includes the router device MAC, the router device status, the status of each port and the adjacent router device information.
[0086] The updating module 702 is used to create and update the device information table by iteratively sending DTMP protocol messages between the multiple router devices, and each router device notifies the VARP module in each router device of the message that the device information table is updated.
[0087] The election module 703 is used for the VARP modules of the multiple router devices to select a Master device and a Backup device according to an election rule.
[0088] Communication module 704 is used for multiple router devices in the loop network to determine whether the Master device or the Backup device replies to the ARP request according to the Source IP parity of the ARP request message received from the host device when communicating with the external network. After the determination, the determined router device returns its own MAC address to the host device.
[0089] The update module 702 is also used for: the DTMP module of the router device sends DTMP protocol messages to the adjacent router devices at regular intervals; after receiving the DTMP protocol messages, the adjacent router devices create a device information table, and encapsulate the router device information and the adjacent router device information into a new DTMP protocol message, and continue to send it to the adjacent router devices; and the DTMP module of each router device receives the new DTMP protocol message to complete the update of the device information table.
[0090] The election module 703 is also used for: among the router devices, selecting the router device with the largest route-mac as the Master device, and the router device with the second largest route-mac as the Backup device; if the Backup device cannot be selected, the Master device and the Backup device are the same device; the Master device occupies the VMAC1 address, and the Backup device occupies the VMAC2 address; and if the Master device and the Backup device are the same device, the devices simultaneously occupy the VMAC1 and VMAC2 addresses, wherein VMAC1 is configured by the administrator, and VMAC2 is automatically generated by the system based on the configured VMAC1.
[0091] The communication module 704 is also used for: if the Source IP is an odd number, the Master device uses VMAC1 to reply to the ARP request; if the Source IP is an even number, the Backup device uses VMAC2 to reply to the ARP request; and if the Master device and the Backup device are the same device, the device replies to the ARP request, wherein VMAC1 is used to reply when the Source IP is an odd number, and VMAC2 is used to reply when the Source IP is an even number.
[0092] The communication module 704 is also used for: the determined router device receives the message encapsulated by the host device and sends the message to the external network to complete the communication with the external network, wherein the message is encapsulated by the host device using the mac address of the determined router device.
[0093] The communication module 704 is also used for: in the load sharing working mode, when the Master device and the Backup device exist and are not the same router device, the Master device and the Backup device respectively undertake the traffic forwarding tasks of different hosts.
[0094] The communication module 704 is also used for: when a gateway device fails, the DTMP module of the gateway device updates the device information and sends a DTMP update message to other router devices, which receive and parse the DTMP update message to complete the update of the device information table; after the update is completed, the DTMP module notifies the VARP module, and the VARP module selects a new Master device and Backup device from the router devices according to the election rules; each router device determines whether it is the Master device, and if not, returns; if so, when the Backup device does not exist, the Master device occupies the VMAC1 and VMAC2 addresses; when the Backup device exists, the Master device occupies the VMAC1 and VMAC2 addresses. MAC1 address; the Master device sends a VARP update message to other router devices, which receive and parse the update message and compare the MAC address of the Master device with the MAC address of the router device. If the Master device has a higher priority, the update message is trusted; if it is determined that the router device is a Backup device, the router device is set to the Backup state, occupies the VMAC2 address, and clears the VMAC1 address; if it is determined that the router device is not a Backup device, the processing is terminated and the occupied VMAC address is cleared; and after the router device is updated, the host device communicates with the external network through the new Master device and Backup device.
[0095] The communication module 704 is also used for: when the gateway device fails and recovers, the recovered gateway device updates the device information table and sends a DTMP update message to the adjacent router device, and the adjacent router device updates the device information table after receiving the message; after each router device completes the update of the device information table, it notifies the VARP module and completes the process of electing a new device and notifying other devices; and if the failed device was a Master device or a Backup device before the failure occurred, traffic forwarding is restored.
[0096] Figure 8 FIG. 8 shows a hardware structure diagram of a computing device 80 for queue message persistent storage scheduling according to an embodiment of the present specification. Figure 8 As shown, the computing device 80 may include at least one processor 801, a memory 802 (e.g., a non-volatile memory), a memory 803, and a communication interface 804, and the at least one processor 801, the memory 802, the memory 803, and the communication interface 804 are connected together via a bus 805. The at least one processor 801 executes at least one computer-readable instruction stored or encoded in the memory 802.
[0097] It should be understood that the computer executable instructions stored in the memory 802, when executed, cause at least one processor 801 to perform the above combined operations in various embodiments of this specification. Figure 1-8 Describes the various operations and functions.
[0098] In the embodiments of the present specification, the computing device 80 may include, but is not limited to, a personal computer, a server computer, a workstation, a desktop computer, a laptop computer, a notebook computer, a mobile computing device, a smart phone, a tablet computer, a cellular phone, a personal digital assistant (PDA), a handheld device, a messaging device, a wearable computing device, a consumer electronic device, and the like.
[0099] According to one embodiment, a program product such as a machine-readable medium is provided. The machine-readable medium may have instructions (i.e., the above-mentioned elements implemented in the form of software), which, when executed by a machine, causes the machine to perform the above-mentioned combination of various embodiments of this specification. Figure 1-8 Specifically, a system or device equipped with a readable storage medium may be provided, on which a software program code implementing the functions of any of the above-mentioned embodiments is stored, and a computer or processor of the system or device reads and executes the instructions stored in the readable storage medium.
[0100] According to the method and application of realizing router active-standby backup based on VARP in the embodiment of the present invention, it can provide a communication between host devices in the intranet and the external network under active-standby backup in a loop network in an Ethernet environment with high requirements on network stability; in the case of a gateway device failure, a active-standby election algorithm and a status update algorithm are used to realize fast switching after the failure of the primary device; the function of routing load sharing can be realized, and in the case of an overloaded router device, the pressure on the primary router device is reduced, thereby reducing the device failure rate.
[0101] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0102] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0103] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0104] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0105] The foregoing description of specific exemplary embodiments of the present invention is for the purpose of illustration and demonstration. These descriptions are not intended to limit the present invention to the precise form disclosed, and it is clear that many changes and variations can be made based on the above teachings. The purpose of selecting and describing the exemplary embodiments is to explain the specific principles of the present invention and its practical application, so that those skilled in the art can realize and utilize various different exemplary embodiments of the present invention and various different selections and changes. The scope of the present invention is intended to be limited by the claims and their equivalents.
Claims
1. A method for implementing router active / standby backup based on VARP, characterized in that: The method comprises: In a loop network, a DTMP module and a VARP module are created in multiple router devices, wherein the DTMP protocol is a device topology management protocol, which is used to manage the topology information of multiple router devices connected when the network is established, and the topology information includes the router device MAC, the router device status, the status of each port and the adjacent router device information; By iteratively sending DTMP protocol messages between the multiple router devices, a device information table is created and updated, and each router device notifies a VARP module in each router device of a message that the device information table is updated; The VARP modules of the multiple router devices select a Master device and a Backup device according to an election rule; and When communicating with the external network, multiple router devices in the loop network determine whether the Master device or the Backup device should reply to the ARP request based on the Source IP parity of the ARP request message received from the host device. After the determination, the determined router device returns its own MAC address to the host device; wherein, If the Source IP is an odd number, the Master device uses VMAC1 to reply to the ARP request. VMAC1 is configured by the administrator. If the Source IP is an even number, the Backup device uses VMAC2 to reply to the ARP request. VMAC2 is automatically generated by the system based on the configured VMAC1; and If the Master device and the Backup device are the same device, the device replies to the ARP request, wherein VMAC1 is used to respond when the Source IP is an odd number, and VMAC2 is used to respond when the Source IP is an even number.
2. The method for implementing router active / standby backup based on VARP as claimed in claim 1, characterized in that: The device information table is created and updated by iteratively sending DTMP protocol messages between the multiple router devices, including: The DTMP module of the router device periodically sends DTMP protocol messages to adjacent router devices; After receiving the DTMP protocol message, the adjacent router device creates a device information table, and encapsulates the router device information and the adjacent router device information into a new DTMP protocol message, and continues to send it to the adjacent router device; and The DTMP module of each router device receives the new DTMP protocol message and completes the update of the device information table.
3. The method for implementing router active / standby backup based on VARP as claimed in claim 1, characterized in that: The election rules include: Among the routers, select the router with the largest route-mac as the master device, and the router with the second largest route-mac as the backup device. If the backup device cannot be selected, the master device and the backup device are the same device. The Master device occupies the VMAC1 address, and the Backup device occupies the VMAC2 address; and If the Master device and the Backup device are the same device, the device occupies both the VMAC1 and VMAC2 addresses.
4. The method for implementing router active / standby backup based on VARP as claimed in claim 1, characterized in that: The method further comprises: The determined router device receives the message encapsulated by the host device and sends the message to the external network to complete the communication with the external network, wherein the message is encapsulated by the host device using the MAC address of the determined router device.
5. The method for implementing router active / standby backup based on VARP as claimed in claim 1, characterized in that: The method further comprises: In load balancing mode, when the master and backup devices exist and are not the same router, the master and backup devices are responsible for forwarding traffic from different hosts.
6. The method for implementing router active / standby backup based on VARP as claimed in claim 1, characterized in that: The method further comprises: When a gateway device fails, the DTMP module of the gateway device updates the device information and sends a DTMP update message to other router devices. Other router devices receive and parse the DTMP update message to complete the update of the device information table. After the update is completed, the DTMP module notifies the VARP module, and the VARP module selects a new Master device and Backup device from the router devices according to the election rules; Each router device determines whether it is the Master device. If not, it returns; If yes, when the Backup device does not exist, the Master device occupies the VMAC1 and VMAC2 addresses; when the Backup device exists, the Master device occupies the VMAC1 address; The master device sends a VARP update message to other router devices. Other router devices receive and parse the update message and compare the MAC address of the master device with the MAC address of the local router device. If the master device has a higher priority, the update message is trusted. If it is determined that the router device is a backup device, the router device is set to the backup state, occupies the VMAC2 address, and clears the VMAC1 address; If it is determined that the router device is not a backup device, the processing ends and the occupied VMAC address is cleared; and The router device is updated, and the host device communicates with the external network through the new Master device and Backup device.
7. The method for implementing router active / standby backup based on VARP as claimed in claim 1, characterized in that: The method further comprises: When the gateway device fails, the recovered gateway device updates the device information table and sends a DTMP update message to the adjacent router device. The adjacent router device updates the device information table after receiving the message. After each router device completes updating the device information table, it notifies the VARP module and completes the process of electing a new device and notifying other devices; and If the faulty device was a master or backup device before the fault occurred, traffic forwarding is restored.
8. A device for implementing router master-slave backup based on VARP, characterized in that: The device comprises: A creation module is used to create a DTMP module and a VARP module in multiple router devices in a loop network, wherein the DTMP protocol is a device topology management protocol, which is used to manage the topology information of multiple router devices connected when the network is established, and the topology information includes the router device MAC, the router device status, the status of each port and the adjacent router device information; An updating module, configured to create and update a device information table by iteratively sending DTMP protocol messages between the plurality of router devices, and each router device notifies a VARP module in each router device of a message that the device information table is updated; An election module, used for the VARP modules of the plurality of router devices to select a Master device and a Backup device according to an election rule; and The communication module is used for, when communicating with the external network, multiple router devices in the loop network, according to the Source IP parity of the ARP request message received from the host device, to determine whether the Master device or the Backup device should reply to the ARP request, and the determined router device returns its own MAC address to the host device after the judgment; wherein, If the Source IP is an odd number, the Master device uses VMAC1 to reply to the ARP request. VMAC1 is configured by the administrator. If the Source IP is an even number, the Backup device uses VMAC2 to reply to the ARP request. VMAC2 is automatically generated by the system based on the configured VMAC1; and If the Master device and the Backup device are the same device, the device replies to the ARP request, wherein VMAC1 is used to respond when the Source IP is an odd number, and VMAC2 is used to respond when the Source IP is an even number.
9. An electronic device, characterized in that: include: at least one processor; as well as A memory storing instructions, which, when executed by the at least one processor, enable the at least one processor to execute the architectural design of the method for implementing router active-standby backup based on VARP as described in any one of claims 1 to 7.
