Method and equipment for selecting VRRP (Virtual Router Redundancy Protocol) backup group
By detecting the interface transmission data of the main router and judging the overload status, based on the interface load and backup group association relationship, the candidate backup group is determined and the target backup group is selected, which solves the problem that the VRRP protocol is difficult to automatically elect a target backup group in complex scenarios, and realizes the automatic election of the main router and the flexible determination of the backup group.
Patent Information
- Application Number
- CN202510290270.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-12
- Publication Date
- 2025-06-20
AI Technical Summary
The existing VRRP protocol is mainly suitable for single backup group scenarios, and it is difficult to flexibly apply to complex scenarios of single backup group and multiple backup groups, making it difficult to automatically elect target backup groups in complex application scenarios.
By detecting the interface transmission data of the main router, we determine whether the main router is in an overload state. Based on the interface load degree and the relationship between the backup group and the interface, we determine the candidate backup group, and select the target backup group from the candidate backup group to replace the main router.
It realizes flexible determination of backup groups in single and multi-backup group scenarios, reduces the operation of technicians, improves the efficiency of determining target backup groups in complex scenarios, and realizes automatic election of the main router.
Smart Images

Figure CN120186069A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical fields of network protocol basics and VRRP master router election, and particularly relates to a method and device for selecting a VRRP backup group. Background Art
[0002] With the development of the digital and intelligent era, the communication industry's requirements for network transmission reliability are increasing day by day. To ensure network reliability, the Virtual Router Redundancy Protocol (VRRP) was introduced accordingly.
[0003] However, currently the VRRP protocol is usually applied to simple scenarios of a single backup group, and how to flexibly apply the VRRP protocol in scenarios of single backup groups and multiple backup groups is a challenge that urgently needs to be solved currently. Summary of the Invention
[0004] The purpose of this application is to provide a method and device for selecting a VRRP backup group, so as to provide a solution for flexibly determining a backup group in scenarios of single backup groups and multiple backup groups.
[0005] In a first aspect, this application provides a method for selecting a VRRP backup group, which is applied to a master router. The master router belongs to at least one backup group, and each backup group includes a master router and at least one standby router. The method includes:
[0006] Detect data transmitted through an interface in the master router; wherein, there is an association relationship between the backup group and the interface, and the master router included in each backup group transmits data through the interface associated with the backup group;
[0007] When it is determined that the master router is in an overloaded state, based on the load levels of the interfaces and the association relationship between the backup group and the interface, determine a candidate backup group from the backup groups to which the master router belongs, and the load level of the interface associated with the candidate backup group in the master router meets a preset adjustment condition;
[0008] In the candidate backup group, determine a target backup group for replacing the master router.
[0009] In a second aspect, this application provides a device for selecting a VRRP backup group, which is applied to a master router. The master router belongs to at least one backup group, and each backup group includes a master router and at least one standby router, including:
[0010] A detection module, configured to detect data transmitted through an interface in the master router; wherein, there is an association relationship between the backup group and the interface, and the master routers included in each backup group transmit data through the interface associated with the backup group;
[0011] A first determination module, configured to, when it is determined that the master router is in an overloaded state, determine a candidate backup group from the backup groups to which the master router belongs based on the load levels of the interfaces and the association relationship between the backup group and the interface, and the load level of the interface in the master router associated with the candidate backup group meets a preset adjustment condition;
[0012] A second determination module, configured to determine a target backup group for replacing the master router in the candidate backup group.
[0013] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory. Wherein, the memory stores program codes, and when the program codes are executed by the processor, the processor is caused to execute the steps of any method in the first aspect.
[0014] In a fourth aspect, an embodiment of the present application provides a computer storage medium, which stores computer instructions, and when the computer instructions run on a computer, the computer is caused to execute the steps of any method in the first aspect.
[0015] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes a computer program stored in a computer-readable storage medium; when a processor of an electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, so that the electronic device executes the steps of any method in the first aspect.
[0016] The technical solutions provided by the embodiments of the present application at least bring the following beneficial effects:
[0017] The master router in the present application can belong to at least one backup group. When it is determined that the master router is in an overloaded state, according to the load levels of the interfaces of the master router, the backup group associated with the interface whose load level meets the preset adjustment condition is used as the candidate backup group, and the target backup group is determined in the candidate backup group, which can enable the present solution to flexibly determine the target backup group that needs to replace the master router for different application scenarios, facilitate reducing the operations of technical personnel, improve the efficiency of determining the target backup group in complex application scenarios, and enable the target backup group to realize the automatic election of the master router. Description of the Drawings
[0018] The accompanying drawings described herein are used to provide a further understanding of the present application and form a part of the present application. The schematic embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation of the present application. In the drawings:
[0019] Figure 1 It is an application scenario of an optional method for selecting a VRRP backup group in an embodiment of the present application;
[0020] Figure 2 It is a schematic diagram of a router in an embodiment of the present application;
[0021] Figure 3 It is a flowchart of a method for selecting a VRRP backup group in an embodiment of the present application;
[0022] Figure 4 It is a flowchart of a method for determining an overload state in an embodiment of the present application;
[0023] Figure 5 It is a flowchart of a method for determining candidate backup groups in an embodiment of the present application;
[0024] Figure 6 It is a flowchart of a method for determining a target backup group in an embodiment of the present application;
[0025] Figure 7 It is an overall flowchart in an embodiment of the present application;
[0026] Figure 8 It is a schematic diagram of a monitoring system in an embodiment of the present application;
[0027] Figure 9 It is a schematic diagram of determining load adjustment in an embodiment of the present application;
[0028] Figure 10 It is a schematic diagram of an electronic device in an embodiment of the present application;
[0029] Figure 11 It is a schematic diagram of a device in an embodiment of the present application. Detailed implementation manners
[0030] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Among them, the described embodiments are some but not all of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts belong to the scope of protection of the present application.
[0031] Moreover, in the description of the embodiments of the present application, unless otherwise specified, " / " means "or". For example, A / B may represent A or B; "and / or" in the text is merely a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of the present application, "a plurality of" means two or more than two.
[0032] Hereinafter, the terms "first" and "second" are only used for descriptive purposes and cannot be construed as implying or suggesting relative importance or implicitly indicating the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of the embodiments of the present application, unless otherwise specified, the meaning of "a plurality of" is two or more.
[0033] To facilitate the understanding of a method and device for selecting a VRRP backup group provided by the embodiments of the present application, some terms in the embodiments of the present application are explained below to facilitate the understanding of those skilled in the art.
[0034] The Virtual Router Redundancy Protocol (VRRP for short) is a routing protocol proposed by the IETF to solve the problem of single point of failure in configuring static gateways in a local area network. VRRP is a selection protocol that can dynamically assign the responsibility of a virtual router to one of the VRRP routers on the local area network. The VRRP router that controls the IP address of the virtual router is called the master router, which is responsible for forwarding data packets to these virtual IP addresses. Once the master router becomes unavailable, this selection process provides a dynamic failover mechanism, which allows the IP address of the virtual router to be used as the default first-hop router for the terminal host. Routers in the same VRRP group have two mutually exclusive roles: the master router and the backup router. There is exactly one router in a VRRP group in the master role, and there can be one or more routers in the backup role. The VRRP protocol selects one as the master router from the backup group to be responsible for ARP resolution and forwarding IP data packets. The other routers in the group act as backup roles and are in a standby state. When the master router fails for some reason, one of the backup routers can be upgraded to the master router instantaneously after a short delay. Since this switch is very fast and does not change the IP address and MAC address, it is transparent to the terminal user system.
[0035] The application scenario of a method for selecting a VRRP backup group provided by the embodiments of the present application is introduced below with reference to the accompanying drawings.
[0036] In the application scenario of the method for selecting a VRRP backup group according to an embodiment of the present application, it includes a first electronic device 10, a second electronic device 11, and at least one backup group 12. The at least one backup group 12 can be used for data forwarding between the first electronic device 10 and the second electronic device 11.
[0037] In an alternative embodiment, the forwarding scenario in the embodiment of the present application can be data forwarding between a user-side device and a server. Then, the first electronic device 10 can be the user-side device, and the second electronic device 11 can be the server.
[0038] In another alternative embodiment, the forwarding scenario in the embodiment of the present application can be data forwarding between user-side devices. Then, both the first electronic device 10 and the second electronic device 11 are user-side devices.
[0039] In the embodiment of the present application, each electronic device can be associated with at least one backup group. Then, the electronic device transmits data to other electronic devices through the master router in the at least one associated backup group. Among them, each router may belong to multiple backup groups. Each electronic device group includes at least one electronic device, and each backup group includes a master router and at least one standby router.
[0040] It should be noted that VRRP defines three states: the initial state (Initialize), the backup state (Backup), and the master state (Master).
[0041] Among them, the master router is in the Master state, and the standby router is in the Backup state.
[0042] As Figure 1 shown, an application scenario of an alternative method for selecting a VRRP backup group according to an embodiment of the present application includes a first electronic device 10: electronic device group 1 and electronic device group 2, a second electronic device 11: electronic device group 3 and electronic device group 4, and at least one backup group 12: backup group 1 and backup group 2.
[0043] Among them, there is a path between each electronic device in the electronic device group and each router in the backup group associated with the electronic device group. In implementation, the electronic device group can be connected to the backup group through a router or directly connected. The embodiment of the present application does not limit the connection method between the electronic device group and the backup group.
[0044] For example Figure 1 shown, each electronic device group can include three electronic devices. Backup group 1 and backup group 2 can each include five routers. Among them, one router belongs to both backup group 1 and backup group 2.
[0045] In the embodiments of the present application, Backup Group 1 is associated with Electronic Device Group 1 and Electronic Device Group 3 and is used to transmit data of Electronic Device Group 1 and Electronic Device Group 3. Backup Group 2 is associated with Electronic Device Group 2 and Electronic Device Group 4 and is used to transmit data of Electronic Device Group 2 and Electronic Device Group 4.
[0046] Optionally, Figure 1 This is only an application scenario of the example of the present application. In actual applications, each electronic device group may also be associated with multiple backup groups.
[0047] In implementation, each router includes multiple interfaces, and an electronic device can transmit data to / from a router through an interface. Among them, each interface of the router can establish a connection with at least one electronic device group.
[0048] As Figure 2 shown, it is a schematic diagram of a router in the embodiments of the present application. If this router is the master router and there are communication paths with Electronic Device Group 1 and Electronic Device Group 2 through Interface 1, then Interface 1 has an association relationship with Electronic Device Group 1 and Electronic Device Group 2 respectively. This router belongs to the backup group corresponding to Electronic Device Group 1 and also belongs to the backup group corresponding to Electronic Device Group 2. Then, the data of these two electronic device groups is transmitted through Interface 1.
[0049] If this router is also connected to an electronic device group through Interface 2, then Interface 2 has an association relationship with Electronic Device Group 5, and this router belongs to the backup group corresponding to Electronic Device Group 2. Then, the data of Electronic Device Group 5 is transmitted through Interface 2.
[0050] Among them, the user-side device is a device that needs to transmit data, such as a mobile phone, a computer, a smart home device, a vehicle-mounted terminal, a switch, etc.
[0051] As Figure 3 shown, it is a flowchart of a method for selecting a VRRP backup group provided by the embodiments of the present application, which is applied to a master router. The master router belongs to at least one backup group, and each backup group includes a master router and at least one standby router. The specific steps are as follows:
[0052] Step S301: Detect the data transmitted through the interface in the master router.
[0053] Among them, there is an association relationship between the backup group and the interface, and the master router included in each backup group transmits data through the interface associated with the backup group.
[0054] In the present application, Figure 2 taking [example] as an example, the two backup groups connected to Interface 1 have an association relationship with this Interface 1, and the one backup group connected to Interface 2 has an association relationship with this Interface 2.
[0055] Step S302: When it is determined that the master router is in an overloaded state, based on the load levels of each interface and the association relationship between the backup groups and the interfaces, determine a candidate backup group from the backup groups to which the master router belongs.
[0056] Among them, the load level of the interface in the master router associated with the candidate backup group meets the preset adjustment conditions.
[0057] Optionally, in the embodiments of the present application, the master router is determined to be in an overloaded state through at least one of the following methods:
[0058] Method 1: Determine the CPU usage rate of the master router based on the CPU idle time of the master router. If the CPU usage rate is greater than the CPU threshold, it is determined that the master router is in an overloaded state.
[0059] Among them, the CPU threshold can be preset according to empirical values. For example, the CPU threshold can be set to 80%.
[0060] Method 2: Determine the bandwidth utilization rate of each interface based on the data volume transmitted by the interfaces in the master router. If the bandwidth utilization rate of any interface among the interfaces is greater than the bandwidth threshold, it is determined that the master router is in an overloaded state.
[0061] Among them, the bandwidth threshold can be preset according to empirical values. For example, the bandwidth threshold can be set to 80%.
[0062] Refer to Figure 4 As shown, a flowchart for determining the overloaded state in the embodiments of the present application is as follows:
[0063] Step S401: Determine the CPU idle time of the CPU in the master router, and determine the CPU usage rate based on the CPU idle time.
[0064] Among them, in the embodiments of the present application, the total time of the CPU is also determined, then the CPU usage rate = (CPU total time - CPU idle time) / CPU total time * 100%.
[0065] Step S402: When the CPU usage rate is greater than the CPU threshold, determine that the master router is in an overloaded state.
[0066] Step S403: Determine the bandwidth utilization rate of each interface based on the data volume transmitted by the interfaces in the master router.
[0067] Step S404: When the bandwidth utilization rate of any interface among the interfaces is greater than the bandwidth threshold, determine that the master router is in an overloaded state.
[0068] As Figure 5 shown, a flowchart for determining the candidate backup group in the embodiments of the present application is as follows:
[0069] Step S501: Based on the load level of each interface, use the interfaces that meet the adjustment conditions among the interfaces of the master router as target interfaces.
[0070] Optionally, the load level in the embodiments of the present application is the data volume or the bandwidth utilization rate.
[0071] In an optional implementation manner, when the CPU usage rate of the master router is greater than the CPU threshold, determine the order of each interface based on the data volume corresponding to each interface in the master router, and use the interface in the preset order as the target interface.
[0072] Among them, the preset order in the embodiments of the present application can be one order or multiple orders. The determined target interfaces can be one or more, and the present application does not limit this.
[0073] Exemplarily, if the embodiments of the present application determine the order of each interface in the order from largest to smallest of the data volume corresponding to each interface, the interface with the order of 1 can be used as the target interface.
[0074] Optionally, the load level in the embodiments of the present application can also be the traffic value. Then, when the CPU usage rate of the master router is greater than the CPU threshold, determine the order of each interface based on the traffic value corresponding to each interface in the master router, and use the interface in the preset order as the target interface.
[0075] In another optional implementation manner, when the bandwidth utilization rate of any interface in the master router is greater than the bandwidth threshold, determine the target interface among the any interface.
[0076] Optionally, the embodiments of the present application can use the interface with the bandwidth utilization rate greater than the bandwidth threshold as the target interface. Or, if there are multiple interfaces with the bandwidth utilization rate greater than the bandwidth threshold, for the convenience of introduction, the interfaces with the bandwidth utilization rate greater than the bandwidth threshold are called the first interfaces. Then, based on the bandwidth utilization rate of the first interfaces, sort the first interfaces in the order from largest to smallest of the bandwidth utilization rate, and select the interfaces in the preset order as the target interfaces.
[0077] For example, the embodiments of the present application can sort the first interfaces in the order from largest to smallest of the bandwidth utilization rate, and use the interface with the preset order of 1 as the target interface.
[0078] It should be noted that the preset order in the embodiments of the present application can be one order or multiple orders. The determined target interfaces can be one or more, and the present application does not limit this.
[0079] Step S502: Based on the association relationship between the backup group and the interface, use the backup group associated with the target interface as the candidate backup group.
[0080] It should be noted that by pre-storing the association relationship between the backup group and the interface, after determining the target interface, the backup group associated with the target interface can be used as the candidate backup group based on the association relationship between the backup group and the interface.
[0081] Take Figure 1 as an example. If the current master router is the leftmost router in backup group 1, then when this master router is in an overloaded state, the candidate backup group associated with this master router is Figure 1 the backup group 1 shown.
[0082] If the current master router is the rightmost router in backup group 1 and this router also belongs to backup group 2. Then when this master router is in an overloaded state, if the interface associated with backup group 1 and backup group 2 in this master router is interface 1, then when the target interface is interface 1, the candidate backup groups are backup group 1 and backup group 2. If the interface associated with backup group 1 in this master router is interface 1 and the interface associated with backup group 2 is interface 2, then when the target interface is interface 1, the candidate backup group is backup group 1.
[0083] Step S303, determine the target backup group for replacing the master router among the candidate backup groups.
[0084] Among them, each backup group is used to transmit data of the electronic devices associated with the backup group.
[0085] In an optional implementation manner, if there is one candidate backup group, then this candidate backup group is used as the target backup group.
[0086] In another optional implementation manner, if there are multiple candidate backup groups, then based on the traffic values of the multiple candidate backup groups respectively, determine the target backup group for replacing the master router among the multiple candidate backup groups.
[0087] As Figure 6 shown, a flowchart for determining the target backup group in an embodiment of the present application is as follows:
[0088] Step S601, respectively determine the traffic values corresponding to the multiple candidate backup groups based on the data volumes of the electronic devices associated with the multiple candidate backup groups respectively.
[0089] It should be noted that the traffic value corresponding to each candidate backup group is determined according to the data volume of the electronic devices associated with this candidate backup group transmitted by the master router.
[0090] Take Figure 1 as an example. For example, the traffic value corresponding to backup group 1 is determined according to the data volumes of electronic device group 1 and electronic device group 3 associated with router 1. The traffic value corresponding to backup group 2 is determined according to the data volumes of electronic device group 2 and electronic device group 4 associated with the router.
[0091] Step S602: Determine the order of multiple candidate backup groups based on the traffic values of each candidate backup group, and use the candidate backup group in the preset order as the target backup group.
[0092] Exemplarily, in the embodiment of the present application, the order of multiple candidate backup groups can be determined in descending order of traffic values, and the candidate backup group with the preset order of 1 is used as the target backup group.
[0093] It should be noted that the preset order in the embodiment of the present application can be one order or multiple orders. The determined target backup group can be one group or multiple groups, and the present application does not limit this.
[0094] In the embodiment of the present application, by determining the target backup group, the target backup group is used to replace the primary router.
[0095] Among them, when the primary router is working, the primary router periodically sends an advertisement message to the standby routers in the affiliated backup group to notify that the primary router is in an active state.
[0096] Then, after determining the target backup group for replacing the primary router, the embodiment of the present application further includes steps A1 - A2:
[0097] Step A1: Stop sending advertisement messages to the standby routers in the target backup group, so that after the standby routers in the target backup group do not receive the advertisement message within the preset first duration, they perform the operation of replacing the primary router.
[0098] Exemplarily, if the target backup group includes one primary router and two standby routers, then when the two standby routers do not receive the advertisement message sent by the primary router within the preset first duration, the two standby routers send messages carrying their own priorities to each other. Then each standby router compares its own priority with the priorities of other standby routers in the target backup group. If its own priority is greater than the priorities of other standby routers, then this standby router adjusts itself to be the primary router and sends an advertisement message to other routers in the target backup group.
[0099] Step A2: If receiving the advertisement message sent by other routers in the target backup group, then adjust itself to be a standby router.
[0100] Optionally, after receiving the advertisement message sent by the new primary router in the target backup group, the primary router in the embodiment of the present application reduces its own priority based on the priority carried in the advertisement message.
[0101] Exemplarily, in the embodiment of the present application, the priority of the primary router can be adjusted to half of the value of the priority carried in the advertisement message.
[0102] For example, if the priority carried in the advertisement message is 100, the embodiment of the present application can adjust the priority of the master router to 50.
[0103] It should be noted that in the backup group, the election of a new master router is achieved by comparing the priorities of each standby router.
[0104] Among them, if a standby router in the target backup group fails, it may cause the standby router in the target backup group to fail to be successfully adjusted to the master router. Then the master router cannot receive the advertisement messages sent by other routers in the target backup group.
[0105] For this situation, the embodiment of the present application needs to re-determine the target backup group, and the specific re-determination method is as follows:
[0106] In an optional implementation manner, if the master router does not receive an advertisement message within a preset second duration and there are multiple candidate backup groups, a new target backup group is determined from other candidate backup groups except the target backup group.
[0107] Among them, the traffic value corresponding to the new target backup group is not greater than the traffic value corresponding to the target backup group.
[0108] The embodiment of the present application, based on the order of multiple candidate backup groups, uses the candidate backup group with the next order after the current target backup group as the new target backup group; among them, the order of multiple candidate backup groups is determined according to the respective traffic values of multiple candidate backup groups in descending order of traffic value.
[0109] For example, if the order of the target backup group among candidate backup groups is 1, the candidate backup group with the order of 2 can be determined as the new target backup group. Thus, an operation of replacing the master router for the new target backup group is performed.
[0110] In another optional implementation manner, if an advertisement message is not received within the preset second duration and there is only one candidate backup group, a new candidate backup group is determined based on the load level of other interfaces of the master router except the interface associated with the candidate backup group and the association relationship between the backup group and the interface, and a new target backup group is determined in the new candidate backup group.
[0111] Among them, the load level of the interface associated with the new candidate backup group is not greater than the load level of the interface associated with the candidate backup group.
[0112] The embodiment of the present application, based on the order of each interface, uses the interface with the next order after the interface associated with the candidate backup group as the target interface, and based on the association relationship between the backup group and the interface, determines the backup group associated with the target interface as the new candidate backup group.
[0113] Among them, the order of each interface is determined according to the load level of each of the said interfaces, in the order from the largest to the smallest load level.
[0114] For example, the order of each interface is determined according to the data volume of each interface, in the order from the largest to the smallest data volume. Alternatively, the order of each interface is determined according to the bandwidth utilization rate corresponding to each interface, in the order from the largest to the smallest bandwidth utilization rate.
[0115] In the embodiments of the present application, if a new candidate backup group is determined, the determined new candidate backup group is determined as the target backup group. If multiple new candidate backup groups are determined, they are sorted based on their respective traffic values in the order from the largest to the smallest traffic value to obtain the order of the multiple new candidate backup groups, and the candidate backup group with the largest traffic value among the multiple new candidate backup groups is used as the target backup group.
[0116] The embodiments of the present application are based on Figure 5 the method principle of the flowchart shown to determine a new candidate backup group, and the process of determining a new target backup group among the new candidate backup groups can refer to the method principle of determining the target backup group from the candidate backup groups as described above, which will not be elaborated herein.
[0117] Exemplarily, in the embodiments of the present application, based on the sorting of each interface in the order from the largest to the smallest traffic value, the interface at the next order of the target interface can be determined as the new target interface.
[0118] For example, if the order of the target interface among all interfaces is 1, the interface with the order of 2 can be determined as the new target interface. Thus, a new target backup group for replacing the main router is determined according to the new target interface.
[0119] In the networking environment, the embodiments of the present application can multiplex each network device, so as to automatically adjust the priority of the Master device (main router) in the backup group when the forwarding pressure in the backup group of the entire network is too high.
[0120] As Figure 7 shown, an overall flowchart of the embodiments of the present application is applied to the main router, and the specific steps are as follows:
[0121] Step S701, detect the data transmitted through the interfaces in the main router.
[0122] Step S702, determine the CPU usage rate of the main router based on the CPU idle time of the CPU in the main router.
[0123] Step S703, determine whether the CPU usage rate is greater than the CPU threshold. If so, execute step S704; if not, execute step S701.
[0124] Step S704: Determine the order of each interface based on the data volume corresponding to each interface, and use the interface in the preset order as the target interface.
[0125] Step S705: Determine the bandwidth utilization rate of each interface based on the data volume transmitted by the interface in the main router.
[0126] Step S706: Determine whether the bandwidth utilization rate of any interface is greater than the bandwidth threshold. If so, execute Step S707; if not, execute Step S701.
[0127] Step S707: Determine the target interface among the interfaces with a bandwidth utilization rate greater than the bandwidth threshold.
[0128] Step S708: Based on the association relationship between the backup group and the interface, use the backup group associated with the target interface as the candidate backup group.
[0129] Step S709: If there is one candidate backup group, use this candidate backup group as the target backup group.
[0130] Step S7010: If there are multiple candidate backup groups, determine the traffic values corresponding to each of the multiple candidate backup groups based on the data volume of the electronic devices associated with each of the multiple candidate backup groups.
[0131] Step S7011: Based on the traffic values of each of the multiple candidate backup groups, sort them in descending order of traffic value to obtain the order of the multiple candidate backup groups, and use the candidate backup group with the largest traffic value among the multiple candidate backup groups as the target backup group.
[0132] Step S7012: Stop sending advertisement messages to the standby router in the target backup group.
[0133] Step S7013: Determine whether an advertisement message sent by other routers in the target backup group is received within the preset second time period. If so, execute Step S7014; if not, execute Step S7015.
[0134] Step S7014: After receiving the advertisement message sent by other routers in the target backup group, lower its own priority based on the priority carried in the advertisement message, and adjust itself to be the standby router.
[0135] Step S7015: Based on the order of the multiple candidate backup groups, determine whether there is a candidate backup group after the current target backup group order. If so, execute Step S7016; if not, execute Step S7017.
[0136] Step S7016: Use the next candidate backup group after the current target backup group order as the new target backup group.
[0137] Step S7017: Based on the interfaces of the master router, in the order of the traffic values of the interfaces from largest to smallest, determine whether there is an interface after the current target interface order. If so, execute Step S7018; if not, execute Step S7019.
[0138] Step S7018: Take the next interface in the current target interface order as the new target interface.
[0139] Step S7019: Send an alarm notification to the electronic device associated with the target router.
[0140] The alarm notification in the embodiments of this application is used to prompt the user that the load adjustment fails.
[0141] The embodiments of this application can be implemented by running the monitoring system in the master router. The monitoring system includes: an alarm monitoring module, a CPU analysis module, an interface bandwidth analysis module, a backup group traffic analysis module, a backup group priority pre-adjustment module, a message processing module, and an alarm notification module.
[0142] The master router starts the monitoring system (which can also be called the VRRP traffic monitoring system), and real-time detects the CPU usage rate and the interface bandwidth utilization rate. When it detects that the master router is in an overloaded state, it triggers the forwarding pressure adjustment mechanism.
[0143] The alarm monitoring module analyzes the reported events. If the interface bandwidth utilization rate triggers an alarm, it enters the interface bandwidth analysis module, and the interface bandwidth analysis module notifies the backup group traffic analysis module to analyze. If the alarm is triggered by the CPU usage rate, it enters the CPU analysis module, sorts according to the CPU usage rate of each interface, selects the interface with the largest traffic, and notifies the traffic analysis module.
[0144] After receiving the interface information of the target interface, the backup group traffic analysis module queries the candidate backup groups associated with the target interface, sorts them, selects the candidate backup group with the largest traffic value for adjustment, and at the same time triggers a new Master election timer. The selected target backup group is notified to the backup group priority pre-adjustment module, and this module controls the Master device (master router) to stop sending advertisement messages, but continues to maintain the traffic forwarding function. If there are other standby routers in the backup group that do not receive the advertisement message within the waiting time, they will default that the Mater device has failed, re-elect a new Master device, and the new Master device re-sends the advertisement message. At this time, the master router adjusts the backup group priority to half of the priority of the new Master device to achieve a smooth Master switch.
[0145] After the successful switch of the Master device, the new Master election timer will be deleted, the traffic analysis and pre-adjustment module will be exited, and the alarm monitoring module will be re-entered. If no new announcement message is received when the new Master election timer is cleared, it is considered that there is no other available standby router in the backup group, and it will continue to act as the Master of the backup group. Continue to use the next sequential candidate backup group as the target backup group in the backup group traffic analysis module, perform the operation of replacing the master router for the target backup group, and reset the new Master election timer.
[0146] When the backup group traffic analysis module has traversed all candidate backup groups under all interfaces and the new Master election timer still exists (i.e., the adjustment fails and all candidate backup groups under the interface cannot exit the Mater state), the CPU analysis module / interface bandwidth analysis module will be notified of the adjustment failure.
[0147] After receiving the adjustment failure event, the interface bandwidth analysis module triggers the alarm notification module to notify the user that "the current bandwidth utilization rate is too high, and the automatic adjustment of the backup group priority fails. Please check the environment and configuration."
[0148] After receiving the adjustment failure event, the CPU analysis module continues to elect the next sequential interface in the backup group traffic analysis module and determines a new target router for the interface. If all interfaces have been traversed and the new Master election timer still exists, the alarm notification module will be triggered to notify the user that "the current CPU utilization rate is too high, and the automatic adjustment of the backup group priority fails. Please check the environment and configuration."
[0149] As Figure 8 shown, it is a schematic diagram of a monitoring system according to an embodiment of the present application. Among them, in the embodiment of the present application, each module is managed through the VRRP process.
[0150] Among them, the alarm detection module 81: When the alarm detection module 81 detects that the CPU utilization rate of the master router is greater than the CPU threshold, step 1 is executed: an alarm is sent to the CPU analysis module 82. Alternatively, when the alarm detection module 81 detects that the bandwidth utilization rate of an interface in the master router is greater than the bandwidth threshold, step 2 is executed: an alarm is sent to the interface bandwidth analysis module 83.
[0151] The CPU analysis module 82 determines the order of each interface according to the data volume corresponding to each interface from largest to smallest. Determine the target interface among each interface, and execute step 3: Notify the backup group traffic analysis module 84 to perform traffic analysis on the target interface. Among them, first, use the interface with the largest data volume as the target interface. Notify the interface information of the target interface to the backup group traffic analysis module 84. If receiving the notification of adjustment failure sent by the backup group traffic analysis module 84, execute step 12: Re-determine the target interface. For example, according to the order of each interface, use the interface of the next order as the target interface, and notify the interface information of the target interface to the backup group traffic analysis module 84. If there is no interface in the next order, execute step 13: Notify the alarm notification module 87 that the adjustment of the candidate backup groups associated with all interfaces fails.
[0152] The interface bandwidth analysis module 83 uses the interface with a bandwidth utilization rate greater than the bandwidth threshold as the target interface, and executes step 4: Notify the backup group traffic analysis module 84 to perform traffic analysis on the target interface. Among them, notify the interface information of the target interface to the backup group traffic analysis module 84. If it is determined that the adjustment of each interface fails, execute step 13: Notify the alarm notification module 87 that the adjustment of the candidate backup groups associated with all interfaces fails.
[0153] After receiving the interface information, the backup group traffic analysis module 84 determines the traffic value of the candidate backup groups associated with this interface, and sorts each candidate backup group in descending order of the traffic value. Determine the target backup group among each candidate backup group, and execute step 5: Notify to elect a new master router for the target backup group and start the election timer. Among them, first, use the candidate backup group with the largest current traffic value as the target backup group. If the counter exists and the timer expires, execute step 10: Based on the order of each candidate backup group, use the candidate backup group of the next order as the target backup group, and then return to execute step 5. For example, use the candidate backup group with the second largest traffic value as the target backup group, start the election new Master timer, and notify the backup group priority pre-adjustment module 85 to perform a new master router election. And so on until there are no other candidate backup groups for this interface. If the timer of the last candidate backup group in this interface exists and the timer expires, execute step 11: Notify the CPU analysis module 82 and / or the interface bandwidth analysis module 83 that the adjustment fails. Among them, if the backup group traffic analysis module 84 receives the notification sent by the CPU analysis module 82, after determining the adjustment fails, notify the CPU analysis module 82 that the adjustment fails. If the backup group traffic analysis module 84 receives the notification sent by the interface bandwidth analysis module 83, after determining the adjustment fails, notify the interface bandwidth analysis module 83 that the adjustment fails.
[0154] The backup group priority pre - adjustment module 85 executes step 6: Stop sending advertisement messages to the standby routers in the target backup group. After receiving the advertisement messages sent by other routers in the target backup group, execute step 8: Based on the priority carried in the advertisement message, lower its own priority to half of the value of this priority, and execute step 9: Notify the backup group traffic analysis module 84 to cancel the timer, and exit the backup group priority pre - adjustment module 85 and the backup group traffic analysis module 84.
[0155] The message processing module 86 is used to receive the advertisement messages sent by other routers in the target backup group, and execute step 7: After receiving the advertisement messages sent by other routers in the target backup group, notify the backup group priority pre - adjustment module 85.
[0156] The alarm notification module 87 is used to execute step 14: Send an alarm to the user. Specifically, it can prompt the user: "The current bandwidth usage rate is too high / the CPU usage rate is too high, and the automatic adjustment of the backup group priority fails. Please check the environment and configuration."
[0157] As Figure 9 shown, it is a schematic diagram of determining load adjustment in an embodiment of this application. Among them, taking router 1 as the master router in backup group 1 and router 5 as the master router in backup group 2 as an example. If router 1 is in an overloaded state, the determined target backup group is backup group 1. If the priority of router 5 is higher, then router 5 is adjusted to be the master router of backup group 1.
[0158] Another example of an application scenario, taking the Figure 1 application scenario shown as an example. If router 5 is the master router in both backup group 1 and backup group 2, and both backup group 1 and backup group 2 have an association relationship with interface 1 in router 5, then when router 5 is in an overloaded state, if interface 1 is the target interface, the candidate backup groups are determined to be backup group 1 and backup group 2. If the traffic value corresponding to backup group 1 is greater than the traffic value corresponding to backup group 2, then the target backup group is determined to be backup group 1, and then backup group 1 performs the operation of replacing the master router.
[0159] This application comprehensively evaluates the overall performance of a router by real-time detecting the interface bandwidth rate and CPU usage rate, and is applicable to various VRRP scenarios such as single backup groups and multiple backup groups. When the forwarding pressure of the router is too high, the Master permission is reasonably transferred to a router with stronger performance to share the forwarding pressure of the router, reduce network packet loss and lag, so as to maintain the stability of network traffic forwarding, and effectively solve the problems of packet loss and slow processing speed. When it is detected that the forwarding pressure of the current master router is too high, the system will stop sending advertisement messages. This can not only maintain the forwarding ability of the original router to avoid packet loss, but also share the pressure by electing a new forwarding device. After successfully electing a new forwarding device, the system will quickly reduce the priority of the original router to a reasonable range.
[0160] The technical advantages of this application are reflected in the following two aspects: First, when the forwarding pressure is within the capabilities of the router, unnecessary master-backup switches are reduced to lower the risk of packet loss; second, load sharing is reasonably combined with the performance of the router itself to avoid allocating traffic to a router with poor performance but small traffic, so as to ensure that traffic beyond its forwarding capacity will not be allocated to this router.
[0161] The following introduces the devices or apparatuses provided in the embodiments of this application. For the explanations or examples of the same or corresponding technical features as those described in the above method, they will not be repeated hereinafter.
[0162] As Figure 10 shown, the electronic device 1000 provided in the embodiment of this application includes a processor 1001 and a memory 1002; the memory 1002 is used to store computer programs; the processor 1001 is used to read the computer programs in the memory 1002 and perform the following operations:
[0163] Detect data transmitted through the interfaces in the master router; wherein, there is an association relationship between the backup group and the interface, and the master router included in each backup group transmits data through the interface associated with the backup group;
[0164] When it is determined that the master router is in an overloaded state, based on the load levels of the interfaces and the association relationship between the backup group and the interface, determine a candidate backup group from the backup groups to which the master router belongs, and the load level of the interface in the master router associated with the candidate backup group meets a preset adjustment condition;
[0165] In the candidate backup group, determine a target backup group for replacing the master router.
[0166] It should be noted here that the above device provided by the embodiments of the present invention can implement all the method steps implemented by the above method embodiments, and can achieve the same technical effects. The same parts and beneficial effects as those in the method embodiments will not be specifically described herein again.
[0167] See Figure 11 , a VRRP backup group selection device provided by an embodiment of the present application, characterized in that it is applied to a master router, the master router belongs to at least one backup group, and each backup group includes a master router and at least one standby router, and includes:
[0168] A detection module 1101, configured to detect data transmitted through an interface in the master router; wherein, there is an association relationship between the backup group and the interface, and the master router included in each backup group transmits data through the interface associated with the backup group;
[0169] A first determination module 1102, configured to, when it is determined that the master router is in an overloaded state, determine a candidate backup group from the backup groups to which the master router belongs based on the load levels of the interfaces and the association relationship between the backup group and the interface, and the load level of the interface associated with the candidate backup group in the master router meets a preset adjustment condition;
[0170] A second determination module 1103, configured to determine a target backup group for replacing the master router in the candidate backup group.
[0171] An embodiment of the present application also provides a computer program product or a computer program. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes any one of the methods in the above embodiments. The program product may adopt any combination of one or more readable media. The readable media may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0172] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can 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.) that contain computer-usable program code.
[0173] The present application is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram, as well as the combination of flows 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 the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices produce a means for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0174] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory produce a manufactured article including an instruction means that implements the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0175] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0176] Obviously, those skilled in the art can make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application is also intended to include these modifications and variations.
Claims
1. A method for selecting a VRRP backup group, characterized in that: Applied to a main router, the main router belongs to at least one backup group, each of the backup groups includes a main router and at least one backup router, the method includes: Detecting data transmitted through an interface in the primary router; wherein the backup group and the interface are associated with each other, and the primary router included in each backup group transmits data through the interface associated with the backup group; When it is determined that the main router is in an overloaded state, based on the load degree of each of the interfaces and the association relationship between the backup group and the interface, a candidate backup group is determined from the backup group to which the main router belongs, and the load degree of the interface associated with the candidate backup group in the main router meets the preset adjustment condition; Among the candidate backup groups, a target backup group for replacing the master router is determined.
2. The method according to claim 1, characterized in that Determine whether the primary router is in an overload state by the following method: Determine the CPU usage of the master router based on the CPU idle time of the master router, and if the CPU usage is greater than a CPU threshold, determine that the master router is in an overloaded state; and / or The bandwidth utilization of each interface in the main router is determined based on the amount of data transmitted by the interface. If the bandwidth utilization of any interface in the interfaces is greater than a bandwidth threshold, it is determined that the main router is in an overloaded state.
3. The method according to claim 1, characterized in that The determining of a candidate backup group from the backup group to which the primary router belongs based on the load level of each of the interfaces and the association relationship between the backup group and the interface comprises: Based on the load level of each of the interfaces, taking the interface of the main router that meets the adjustment condition as the target interface; Based on the association relationship between the backup group and the interface, the backup group associated with the target interface is used as a candidate backup group.
4. The method according to claim 3, characterized in that The load level is data volume or bandwidth utilization; based on the load level of each interface, taking the interface of the main router that meets the adjustment condition as the target interface, including: When the CPU usage of the master router is greater than the CPU threshold, determining the order of the interfaces in the master router based on the amount of data corresponding to each interface, and using the interfaces in the preset order as target interfaces; or, When the bandwidth utilization rate of any interface in the main router is greater than the bandwidth threshold, a target interface is determined in the any interface.
5. The method according to claim 1, characterized in that Each backup group is used to transmit data of an electronic device associated with the backup group. If there are multiple candidate backup groups, determining a target backup group for replacing a primary router from among the candidate backup groups includes: Based on the data volume of the electronic devices respectively associated with the plurality of candidate backup groups, respectively determine the flow value corresponding to each of the plurality of candidate backup groups; The order of the plurality of candidate backup groups is determined based on the respective flow values of the plurality of candidate backup groups, and the candidate backup groups in a preset order are used as target backup groups.
6. The method according to claim 1, characterized in that The method further comprises: The master router periodically sends a notification message to the backup routers in the backup group to which it belongs, to notify that the master router is in an active state; After the target backup group for replacing the main router is determined, the method further includes: Stop sending notification messages to the standby routers in the target backup group, so that the standby routers in the target backup group perform an operation of replacing the main router after not receiving the notification message within a preset first time length; If a notification message sent by other routers in the target backup group is received, the router itself is adjusted to be a backup router.
7. The method according to claim 6, characterized in that The method further comprises: If no notification message is received within the preset second time period, and there are multiple candidate backup groups, a new target backup group is determined from other candidate backup groups except the target backup group, wherein the flow value corresponding to the new target backup group is not greater than the flow value corresponding to the target backup group; If no notification message is received within the preset second time period, and there is a candidate backup group, a new candidate backup group is determined based on the load levels of other interfaces of the main router except the interface associated with the candidate backup group, and the association relationship between the backup group and the interface, and a new target backup group is determined in the new candidate backup group; wherein the load level of the interface associated with the new candidate backup group is not greater than the load level of the interface associated with the candidate backup group.
8. The method according to claim 7, characterized in that The determining a new target backup group from other candidate backup groups except the target backup group includes: Based on the order of the multiple candidate backup groups, the candidate backup group located in the next order of the target backup group is used as a new target backup group; wherein the order of the multiple candidate backup groups is determined according to the flow values of the multiple candidate backup groups, in descending order of flow values.
9. The method according to claim 7, characterized in that The determining of a new candidate backup group based on the load levels of other interfaces of the primary router except the interface associated with the candidate backup group, and the association relationship between the backup group and the interface, comprises: Based on the order of each of the interfaces, the interface located in the next order of the interface associated with the candidate backup group is used as the target interface, and based on the association relationship between the backup group and the interface, the backup group associated with the target interface is used as a new candidate backup group; wherein the order of each of the interfaces is determined according to the load level of each of the interfaces, in order from large to small.
10. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores program codes, and when the program codes are executed by the processor, the processor performs the steps of any method described in claims 1 to 9.