Method, apparatus and storage medium for setting priority of virtual router group

By detecting the failure and available status of router devices in the virtual router group and dynamically adjusting their priorities, the traffic instability and data loss caused by frequent master-secure handover in VRRP network is solved, and the stability and reliability of the network are achieved.

CN119316346BActive Publication Date: 2025-07-25ZHEJIANG DAHUA TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411866289.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-18
Publication Date
2025-07-25
Estimated Expiration
2044-12-18

AI Technical Summary

Technical Problem

In VRRP networking, frequent master-stop handover results in unstable traffic forwarding and frequent packet loss, and the existing technology has not effectively solved it.

Method used

By detecting the frequency and available state of the router device, dynamically adjust its priority in the virtual router group, reduce the priority of the failed device to reduce the frequency of master-slip handover, and restore priority when the available state of the device is stable.

Benefits of technology

Reduce the frequency of main and backup switching, improve the stability of traffic forwarding, reduce data packet loss, and ensure the smooth operation of the network environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119316346B_ABST
    Figure CN119316346B_ABST
Patent Text Reader

Abstract

The present application relates to a method, apparatus, and storage medium for setting priorities of a virtual router group. The method for setting priorities of the virtual router group includes: detecting the frequency of occurrence of the fault state of a target router device in a target virtual router group, and when the frequency of occurrence of the fault state of the target router device meets a preset priority adjustment condition, reducing the priority of the target router device in the target virtual router group according to a preset reduction ratio; wherein, the target virtual router group includes at least two router devices; monitoring the available state of the target router device, and when it is detected that the available state of the target router device meets a preset stability condition, restoring the priority of the target router device to a preset priority. It can lower the priority of a faulty router device, thereby reducing the frequency of master-backup switching, ultimately improving the stability of traffic forwarding and reducing data packet loss.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of network communication, and in particular, to a method, apparatus, and storage medium for setting the priority of a virtual router group. Background Art

[0002] In the digital age, in the communication industry, users have higher and higher requirements for the reliability of network transmission. Among them, the Virtual Router Redundancy Protocol (VRRP for short) is a routing protocol designed to solve the single point of failure problem that occurs when configuring a static gateway in a local area network. VRRP can dynamically assign the responsibility of a virtual router to one of the VRRP routers on the local area network. A group of VRRP routers can work together to form a virtual router. These routers are incorporated into the same VRRP group and share the IP address of this virtual router. Routers in the same VRRP group have two mutually exclusive roles: the master router and the backup router. The master router is responsible for Address Resolution Protocol (ARP) resolution and forwarding Internet Protocol (IP) data packets, while the backup router is in a standby state. When the master router fails, the backup router can quickly be upgraded to the master router and take over its work.

[0003] In the networking application of VRRP, there are frequent master-backup switches. For example, when the interface where the backup group is located frequently switches between the available state and the unavailable state, or the network quality of the uplink is relatively low, etc. Since it is impossible to automatically select a router device with the highest priority and the best stability from the backup group for network data forwarding, in the case of network oscillation, the current VRRP networking has problems such as unstable traffic forwarding and a large number of packet losses due to the relatively frequent master-backup switches.

[0004] Regarding the problem of unstable traffic forwarding and a large number of packet losses caused by relatively frequent master-backup switches in the related art, no effective solution has been proposed yet. Summary of the Invention

[0005] In this embodiment, a method, apparatus, and storage medium for setting the priority of a virtual router group are provided to solve the problems of unstable traffic forwarding and a large number of packet losses caused by relatively frequent master-backup switches in the related art.

[0006] In a first aspect, in this embodiment, a method for setting the priority of a virtual router group is provided, including:

[0007] Detect the frequency of occurrence of the fault state of the target router device in the target virtual router group, and when the frequency of occurrence of the fault state of the target router device meets the preset priority adjustment condition, reduce the priority of the target router device in the target virtual router group according to a preset reduction ratio; wherein, at least two router devices are included in the target virtual router group;

[0008] Monitor the available state of the target router device, and when it is detected that the available state of the target router device meets the preset stability condition, restore the priority of the target router device to the preset priority.

[0009] In some embodiments, detecting the frequency of occurrence of the fault state of the target router device in the target virtual router group, and when the frequency of occurrence of the fault state of the target router device meets the preset priority adjustment condition, reducing the priority of the target router device in the target virtual router group according to a preset reduction ratio includes:

[0010] Detect the number of times the target router device switches from the master device state to the non-master device state within a preset first time period in the target virtual router group, and when the number of times is higher than a preset number threshold, reduce the priority of the target router device in the target virtual router group according to a preset reduction ratio.

[0011] In some embodiments, the method further includes:

[0012] In the case where the priority of the target router device has been adjusted, when it is detected that the frequency of occurrence of the fault state of the target router device meets the priority adjustment condition again, reduce the priority on the basis of the current priority of the target router device according to the preset reduction ratio.

[0013] In some embodiments, monitoring the available state of the target router device, and when it is detected that the available state of the target router device meets the preset stability condition, restoring the priority of the target router device to the preset priority includes:

[0014] After adjusting the priority of the target router device, time the fault event of the target router device, and when it is determined according to the timing result of the fault event that the available state of the target router device is stably maintained for a preset second time period, restore the priority of the target router device to the preset priority.

[0015] In some of these embodiments, after adjusting the priority of the target router device, a timer is started for the fault event of the target router device, and after determining that the available state of the target router device is stably maintained for a preset second period according to the timing result of the fault event, the priority of the target router device is restored to the preset priority, including:

[0016] After adjusting the priority of the target router device, a fault event timer for the fault event of the target router device is triggered; after being triggered, the fault event timer starts counting down with a preset second period, and refreshes the countdown when a fault event occurs to the target router device;

[0017] After the fault event timer reaches zero, the priority of the target router device is restored to the preset priority.

[0018] In some of these embodiments, the preset priority is the priority pre-configured by the user.

[0019] In some of these embodiments, the target router device is the router device that is switched to the master device in the virtual router group.

[0020] In a second aspect, in this embodiment, a priority setting device for a virtual router group is provided, including: an adjustment module and a restoration module; where:

[0021] The adjustment module is configured to detect the frequency of occurrence of the fault state of the target router device in the target virtual router group, and when the frequency of occurrence of the fault state of the target router device meets the preset priority adjustment condition, reduce the priority of the target router device in the target virtual router group according to a preset reduction ratio; where at least two router devices are included in the target virtual router group;

[0022] The restoration module is configured to monitor the available state of the target router device, and when it is detected that the available state of the target router device meets the preset stable condition, restore the priority of the target router device to the preset priority.

[0023] In a third aspect, in this embodiment, an electronic device is provided, including a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, it implements the priority setting method for the virtual router group described in the first aspect above.

[0024] Fourthly, in this embodiment, a storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the method for setting the priority of the virtual router group described in the first aspect above is implemented.

[0025] Compared with the related art, in this embodiment, a method, a device, and a storage medium for setting the priority of a virtual router group are provided. In the method for setting the priority of the virtual router group, the occurrence frequency of the failure state of the target router device in the target virtual router group is detected, and when the occurrence frequency of the failure state of the target router device meets the preset priority adjustment condition, the priority of the target router device in the target virtual router group is reduced according to the preset reduction ratio; wherein, the target virtual router group includes at least two router devices; the available state of the target router device is monitored, and when it is detected that the available state of the target router device meets the preset stability condition, the priority of the target router device is restored to the preset priority. It can lower the priority of the faulty router device, thereby reducing the frequency of master-backup switching, and ultimately improving the stability of traffic forwarding and reducing data packet loss.

[0026] Details of one or more embodiments of the present application are set forth in the following drawings and description, so that other features, objects, and advantages of the present application will become more concise and understandable. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative 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:

[0028] Figure 1 is a hardware structure block diagram of a terminal of the method for setting the priority of a virtual router group according to an embodiment of the present application;

[0029] Figure 2 is a flowchart of the method for setting the priority of a virtual router group according to an embodiment of the present application;

[0030] Figure 3 is a schematic diagram of a network networking scenario based on VRRP according to an embodiment of the present application;

[0031] Figure 4 is a schematic diagram of the data flow of the priority adjustment of the VRRP router device in some embodiments of the present application;

[0032] Figure 5 is a flowchart of the method for setting the priority of a virtual router group in some embodiments of the present application;

[0033] Figure 6 is a structure block diagram of the device for setting the priority of a virtual router group according to an embodiment of the present application. Detailed implementation manners

[0034] To understand the purpose, technical solution and advantages of the present application more clearly, the present application will be described and illustrated below with reference to the accompanying drawings and embodiments.

[0035] Unless otherwise defined, the technical terms or scientific terms involved in the present application shall have the general meanings understood by those with ordinary skills in the technical field to which the present application belongs. In the present application, words such as "a", "one", "a kind of", "the", "these" and the like do not indicate a limitation in quantity, and they can be singular or plural. The terms "include", "comprise", "have" and any variants thereof involved in the present application are intended to cover non-exclusive inclusion; for example, a process, method, system, product or device including a series of steps or modules (units) is not limited to the listed steps or modules (units), but may include unlisted steps or modules (units), or may include other steps or modules (units) inherent in these processes, methods, products or devices. The terms "connect", "be connected", "couple" and the like involved in the present application are not limited to physical or mechanical connections, but may include electrical connections, whether directly or indirectly. The "plurality" involved in the present application means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" may represent: A exists alone, A and B exist simultaneously, and B exists alone. Usually, the character " / " indicates that the associated objects before and after are in an "or" relationship. The terms "first", "second", "third" and the like involved in the present application are only used to distinguish similar objects and do not represent a specific sorting of the objects.

[0036] The method embodiment provided in this embodiment can be executed on a terminal, a computer or a similar computing device. For example, it runs on a terminal. Figure 1 is the hardware structure block diagram of the terminal for the method of setting the priority of the virtual router group in this embodiment. As Figure 1 shown, the terminal may include one or more ( Figure 1 only one is shown in Figure 1 processors 102 for storing data and a memory 104. Among them, the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA. The above terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those of ordinary skill in the art can understand that Figure 1 the structure shown is only schematic and does not limit the structure of the above terminal. For example, the terminal may further include more or fewer components than Figure 1 shown in

[0037] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for setting the priority of the virtual router group in this embodiment. The processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, that is, implements the above-mentioned method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memories. In some instances, the memory 104 may further include a memory remotely set relative to the processor 102, and these remote memories can be connected to the terminal through a network. Examples of the above-mentioned network include but are not limited to the Internet, enterprise intranet, local area network, mobile communication network, and their combinations.

[0038] The transmission device 106 is used to receive or send data via a network. The above-mentioned network includes the wireless network provided by the communication provider of the terminal. In one instance, the transmission device 106 includes a network adapter (abbreviated as NIC), which can be connected to other network devices through a base station and thus communicate with the Internet. In one instance, the transmission device 106 can be a radio frequency (abbreviated as RF) module, which is used to communicate with the Internet wirelessly.

[0039] In this embodiment, a method for setting the priority of a virtual router group is provided. Figure 2 It is a flowchart of the method for setting the priority of the virtual router group in this embodiment, as Figure 2 shown, and this process includes the following steps:

[0040] Step S210, detect the frequency of occurrence of the failure state of the target router device in the target virtual router group, and when the frequency of occurrence of the failure state of the target router device meets the preset priority adjustment condition, reduce the priority of the target router device in the target virtual router group according to the preset reduction ratio; wherein, the target virtual router group includes at least two router devices.

[0041] The target router device is a router device that supports the VRRP protocol and forms a VRRP virtual router group (also known as a VRRP backup group) with other router devices under the VRRP protocol. The target router device is the router device that becomes the master device in this virtual router group. The target virtual router group is the virtual router group in which the target router device being monitored becomes the master device. Among them, a virtual router group consists of a master device and multiple standby devices and serves as the default gateway for hosts within a shared local area network. Each device can correspond to multiple virtual router groups, and the status of each virtual router group is independent. For example, device A can belong to 10 virtual router groups. For example, it can form the first group with device B and device C; it can also form the second group with device C and device D, and so on. Device A can be the master device in some of the 10 virtual router groups to which it belongs and the standby device in other groups. For example, device A can be the master device in the first group, the second group, and the third group, and the standby device in the remaining 7 groups.

[0042] In this step, on the premise of having the permission to adjust the priority of a certain router device, after this router device becomes the master device of a certain virtual router group, the occurrence frequency detection of the fault state is enabled in units of this virtual router group, the virtual router group in which the target router device is the master device is monitored, and the priority of the target router device in this virtual router group is adjusted. Among them, the occurrence frequency of the fault state can specifically be represented by the interface unavailable events that occur within a preset first time period. The priority adjustment condition can be set according to the requirements for network stability and packet loss in the actual application scenario. The above-mentioned preset reduction ratio can be set according to the actual application scenario. Exemplarily, it can be set to 1 / 2, that is, each time the priority of the target router device needs to be reduced, the new priority is set to 1 / 2 of the priority before the reduction.

[0043] Figure 3 This is a schematic diagram of a network networking scenario based on VRRP for this embodiment. As Figure 3 shown, Figure 3 the backup group within the solid line frame is the above-mentioned virtual router group, which can include multiple router devices that support VRRP. The router device within the dotted line frame is the one with the highest priority and that frequently fails in this backup group. In addition, Figure 3 the other devices except the backup group in this can be any device that can be connected to a switch, including but not limited to computers, switches, and Internet Protocol Cameras (abbreviated as IPC).

[0044] In a virtual router group, the redundancy backup solution can provide two modes, one is the preemptive mode and the other is the non-preemptive mode. In the preemptive mode, the router device with the highest priority will preempt to become the master device. For example, when there is already a master device in the virtual router group, if another router device in the group modifies its own priority to be higher than that of the master device, the router device with the highest current priority will preempt to become the new master device; or if a new router device with a priority higher than the current master device is added to the group, the new router device will preempt to become the new master device. In a virtual router group, when a router device with a high priority frequently experiences interface up events and down events, that is, a certain interface of the router device frequently switches between the unavailable state and the available state, a phenomenon where the router device with a high priority frequently joins and exits the virtual router group will occur, and then the master device in the virtual router group will frequently switch. In a network, as long as there is a master device switch, packet loss will occur.

[0045] For this, in this step, the occurrence frequency of the fault state of the target router device with a relatively high priority itself is detected. When the occurrence frequency of the fault state meets the preset priority adjustment condition, it indicates that the network link quality of the target router device is poor, and it is necessary to avoid the target router device from becoming the master router in the target virtual router group again in a way of reducing the priority, so as to prevent network oscillation and packet loss.

[0046] Step S220, monitor the available state of the target router device. When it is detected that the available state of the target router device meets the preset stable condition, restore the priority of the target router device to the preset priority.

[0047] After adjusting the priority of the target router device, the target router device can be marked to indicate that the target router device has become the adjusted state. When the adjusted state of the target router device is activated, the monitoring of the available state of the target router device is triggered. The available state can specifically be the occurrence state of the interface fault event of the target router. The interface fault event of the target router can specifically be the interface up event in which the router interface changes from the unavailable state to the available state, or the down event in which it changes from the available state to the unavailable state. The interface can specifically be a routing port, an aggregated port, or a Layer 3 virtual interface, etc. When the available state of the target router device meets the preset stable condition, the priority of the target router can be restored to the priority set before the adjustment. The preset priority can be the priority pre-configured by the user for the target router device. The above-mentioned stable condition can specifically be that no interface fault event occurs within the preset second time period.

[0048] In the related art, there are situations where master-backup switching occurs frequently. For example, when the interfaces of a virtual router group frequently switch between available and unavailable states, or the network quality of the uplink is low, etc. Since it is impossible to automatically elect a router device with the highest priority and the best stability from the virtual router group for network data forwarding, in the case of network oscillation, the current VRRP networking has problems such as unstable traffic forwarding and a large number of packet losses due to the relatively frequent master-backup switching.

[0049] Based on the above steps S210 and S220, this embodiment identifies the network oscillation situation by counting the occurrence frequency of the failure state of the master device, so as to evaluate the quality of the network link. When it is detected that the link quality of the current master device is poor, the priority is automatically reduced to avoid becoming the master device again and causing network oscillation, reducing packet loss, and restoring the priority in the virtual router group after the available state of the router device is stable. By dynamically adjusting the priority according to the failure frequency of the router device, it is avoided that the faulty device frequently switches between high and low priorities, resulting in network oscillation. This embodiment can reduce master-backup switching, avoid traffic switching, and save the time for the router devices in the VRRP virtual router group to re-compete and the traffic recovery time. Finally, this embodiment can reduce the probability of network oscillation, ensure the stable operation of the network environment, realize the dynamic adjustment of the priorities of the router devices in the network, and thus elect a most reliable router device as the master router device for traffic forwarding based on the dynamic adjustment of the priorities.

[0050] Through the above steps S210 to S220, the occurrence frequency of the failure state of the target router device in the target virtual router group is detected, and when the occurrence frequency of the failure state of the target router device meets the preset priority adjustment condition, the priority of the target router device in the target virtual router group is reduced according to the preset reduction ratio; wherein, the target virtual router group includes at least two router devices; the available state of the target router device is monitored, and when it is detected that the available state of the target router device meets the preset stability condition, the priority of the target router device is restored to the preset priority. It can lower the priority of the faulty router device, thereby reducing the master-backup switching frequency, and finally improving the stability of traffic forwarding and reducing data packet loss.

[0051] In one embodiment, based on the above step S210, detecting the occurrence frequency of the failure state of the target router device in the target virtual router group, and when the occurrence frequency of the failure state of the target router device meets the preset priority adjustment condition, reducing the priority of the target router device in the target virtual router group according to the preset reduction ratio may include:

[0052] Detect the number of times the target router device switches from the master device state to the non-master device state within a preset first period in the target virtual router group, and when the number of switches is higher than the preset number threshold, reduce the priority of the target router device in the target virtual router group according to a preset reduction ratio.

[0053] VRRP assigns three states to router devices, including the master device state, the standby device state, and the initial state. Among them, the non-master device state can include the standby device state (backup) and the initial state (init). Only when the router device becomes the master device can it have the traffic forwarding ability, and when the router device switches to the standby device state or the initial state, a master device switch will occur, resulting in traffic loss. Therefore, the number of times the target router device switches from the master device state to the standby device state and the initial state within a preset first period can be detected as the frequency of the fault state occurrence. It can be understood that this first period can be adjusted according to the requirements of the actual application scenario.

[0054] Particularly, each time the above state switch of the master device is detected, the detected information is reported to the state switch counter preset in the virtual router group. When the count of the state switch counter reaches the preset number threshold within the first period, the priority of the target router device in the target virtual router group is reduced according to a preset ratio. For example, the priority is reduced to 1 / 2 of the current priority. In this embodiment, by detecting the number of state switches and reducing the priority of the router device with frequent state switches, the probability of the target router device becoming the master device can be reduced, thereby avoiding network oscillations and reducing packet loss caused by the target router device becoming the master device.

[0055] In one embodiment, the above method for setting the priority of the virtual router group may further include:

[0056] In the case where the priority of the target router device has been adjusted, when it is detected that the frequency of the fault state of the target router device meets the priority adjustment condition again, the priority is reduced on the basis of the current priority of the target router device according to a preset reduction ratio.

[0057] After the priority of the target router device has been reduced, when the target router device triggers a priority reduction again, the priority is reduced again according to a preset ratio on the basis of the latest priority that has been reduced previously. In this way, it is possible to achieve a gradual reduction adjustment of the priority of the target router device with a high fault frequency, so as to improve the flexibility and rationality of setting the priority of each router device in the virtual router group.

[0058] In addition, in one embodiment, based on the above step S220, the available state of the target router device is monitored. When it is monitored that the available state of the target router device meets the preset stable conditions, the priority of the target router device is restored to the preset priority, which may specifically include:

[0059] After adjusting the priority of the target router device, the fault event of the target router device is timed. And after determining that the available state of the target router device is stably maintained for a preset second period according to the timing result of the fault event, the priority of the target router device is restored to the preset priority.

[0060] After reducing the priority of the target router device, the target virtual router group is marked as the adjusted state. When the adjusted state of the target virtual router group is activated, the corresponding fault event timing is triggered to determine whether a fault event has occurred within the preset second period. If not, it is confirmed that the available state of the target router device meets the preset stable conditions, and the priority of the target router device is restored to the priority corresponding before the reduction.

[0061] This embodiment can timely restore the priority of the target router device with a stable available state, thereby further improving the rationality and flexibility of priority setting.

[0062] Among them, in one embodiment, after adjusting the priority of the target router device, the fault event of the target router device is timed. And after determining that the available state of the target router device is stably maintained for a preset second period according to the timing result of the fault event, the priority of the target router device is restored to the preset priority, which may include:

[0063] After adjusting the priority of the target router device, a fault event timer for the fault event of the target router device is triggered; after the fault event timer is triggered, it starts counting down with a preset second period and refreshes the countdown when a fault event occurs in the target router device; after the fault event timer reaches zero, the priority of the target router device is restored to the preset priority.

[0064] After reducing the priority of the target router device, a corresponding fault event timer is triggered to detect the stability of the available state of the target router device after the priority reduction. Specifically, the fault event timer is set to count down starting from a preset second period. During the countdown, when a fault event occurs on the interface of the target router device, the countdown is refreshed and restarted. If the fault event timer reaches zero, it indicates that no fault event has occurred on the target router device within the preset second period. In this case, a priority restoration event can be triggered to restore the priority of the target router device, specifically to the priority configured by the user before the reduction, so as to restore the healthy state of the target router in the virtual router group.

[0065] Figure 4 is a data flow diagram of the priority adjustment of the VRRP router device in some embodiments. As Figure 4 shown, a monitoring system 40 can be set for the target router device; the monitoring system 40 can specifically include a detection module 42, an adjustment module 44, and a restoration module 46. Among them, in a virtual router group, after a certain router device becomes the master device, the monitoring system 40 is triggered. The monitoring system 40 detects in units of virtual router groups. Among them, the detection module 42 detects the number of times that the monitored target router device switches from the master device state to the standby device state or the initial state within a preset first period, and reports the detection information to the state transition counter. When the count of the state transition counter reaches a preset number threshold, the adjustment module 44 is triggered to perform priority adjustment, actively reducing the priority of the target router device to half of the current priority. After triggering the adjustment mechanism of the adjustment module 44, the target virtual router group is marked, and a fault event timer is triggered to count down for a preset second period. When a fault event occurs on the interface, the fault event timer is triggered to update and restart the timing. When the fault event timer reaches zero, it notifies the restoration module 46 in the form of an event notification, informing that the target router device has restored its healthy state. After receiving the notification that the fault event timer has reached zero, the restoration module 46 triggers a priority restoration event, notifying the adjustment module 44 to restore the priority of the target router device. After receiving the priority restoration event, the adjustment module 44 restores the priority of the target router device to the priority configured by the user. Figure 4 The detection module 42, the adjustment module 44, and the restoration module 46 in

[0066] Figure 5 is a flowchart of the priority setting method for a virtual router group in some embodiments. As Figure 5 shown, the priority setting method for the virtual router group includes the following steps:

[0067] Step S501: Determine whether the router device becomes the master device. If so, execute Step S502; otherwise, execute Step S518.

[0068] Step S502: Trigger the monitoring system. Among them, the router device that becomes the master device is used as the target router device. The monitoring system includes a detection module, an adjustment module, and a recovery module.

[0069] Step S503: Detect the frequency of occurrence of the fault status of the target router device based on the detection module.

[0070] Step S504: Determine whether the target router device switches to the standby device state or the initial state. If so, execute Step S505; otherwise, return to execute Step S503.

[0071] Step S505: Increment the count of the status switch counter by 1.

[0072] Step S506: Determine whether the count of the status switch counter reaches the preset number threshold. If so, execute Step S507; otherwise, return to execute Step S504.

[0073] Step S507: Notify the adjustment module to lower the priority of the target router device.

[0074] Step S508: The adjustment module lowers the priority of the target router device.

[0075] Step S509: Determine whether a priority recovery notification is received. If so, execute Step S511; otherwise, execute Step S510.

[0076] Step S510: Lower the priority to 1 / 2 of the current priority.

[0077] Step S511: Lower the priority after the priority adjustment is re-triggered.

[0078] Step S512: Trigger or refresh the fault event timer.

[0079] Step S513: Determine whether a fault event occurs. If so, execute Step S512; otherwise, execute Step S514.

[0080] Step S514: Decrement the fault event timer by 1.

[0081] Step S515: Determine whether the fault event timer reaches zero. If so, execute Step S516; otherwise, return to execute Step S513.

[0082] Step S516, let the recovery module restore the priority of the target router device to the priority configured by the user.

[0083] Step S517, notify the adjustment module that the priority has been restored; return to execute step S508.

[0084] Step S518, shut down the monitoring system.

[0085] The above steps S501 to S518 can lower the priority of the faulty router device, thereby reducing the frequency of master-slave switching, and ultimately improving the stability of traffic forwarding and reducing data packet loss. It can be understood that the method for setting the priority of the virtual router group in this embodiment is applicable to network networking scenarios of different scales with high requirements for network stability. In the network networking scenario, each router device can be reused, so as to automatically adjust the priority of the master device in the virtual router group when the master device in the virtual router group has frequent failures, and automatically restore the priority after the available state is stable.

[0086] In this embodiment, a device for setting the priority of a virtual router group is also provided. This device is used to implement the above embodiments and preferred implementation manners, and those that have been described will not be repeated. The following terms such as "module", "unit", "sub-unit", etc. can be a combination of software and / or hardware that can achieve a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware is also possible and contemplated.

[0087] Figure 6 It is a structural block diagram of the device 60 for setting the priority of the virtual router group in this embodiment. As Figure 6 shown, the device 60 for setting the priority of the virtual router group includes: an adjustment module 62 and a recovery module 64; wherein:

[0088] The adjustment module 62 is used to detect the frequency of occurrence of the fault state of the target router device in the target virtual router group, and when the frequency of occurrence of the fault state of the target router device meets the preset priority adjustment condition, reduce the priority of the target router device in the target virtual router group according to the preset reduction ratio; wherein, the target virtual router group includes at least two router devices; the recovery module 64 is used to monitor the available state of the target router device, and when it is detected that the available state of the target router device meets the preset stable condition, restore the priority of the target router device to the preset priority.

[0089] It should be noted that each of the above modules can be a functional module or a program module, and can be implemented either by software or by hardware. For the modules implemented by hardware, each of the above modules can be located in the same processor; or each of the above modules can also be located in different processors in any combined form.

[0090] In this embodiment, an electronic device is further provided, including a memory and a processor. A computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0091] Optionally, the above electronic device may further include a transmission device and an input / output device. Among them, the transmission device is connected to the above processor, and the input / output device is connected to the above processor.

[0092] Optionally, in this embodiment, the above processor may be configured to execute the following steps through a computer program:

[0093] S1. Detect the frequency of occurrence of the fault state of the target router device in the target virtual router group, and when the frequency of occurrence of the fault state of the target router device meets the preset priority adjustment condition, reduce the priority of the target router device in the target virtual router group according to the preset reduction ratio; wherein, the target virtual router group includes at least two router devices;

[0094] S2. Monitor the available state of the target router device, and when it is detected that the available state of the target router device meets the preset stability condition, restore the priority of the target router device to the preset priority.

[0095] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiment and the optional implementation manners, and will not be elaborated in this embodiment.

[0096] In addition, in combination with the method for setting the priority of the virtual router group provided in the above embodiment, a storage medium can also be provided to implement it in this embodiment. A computer program is stored on the storage medium; when the computer program is executed by a processor, it implements any one of the methods for setting the priority of the virtual router group in the above embodiment.

[0097] It should be understood that the specific embodiments described here are only used to explain this application, rather than to limit it. According to the embodiments provided in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the protection scope of the present application.

[0098] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0099] Obviously, the accompanying drawings are only some examples or embodiments of this application. For those of ordinary skill in the art, this application can also be applied to other similar situations based on these drawings without creative efforts. Additionally, it can be understood that although the work done during this development process may be complex and time-consuming, for those of ordinary skill in the art, certain design, manufacturing, or production changes based on the technical content disclosed in this application are only conventional technical means and should not be regarded as insufficient disclosure of this application.

[0100] The term "embodiment" in this application means that the specific features, structures, or characteristics described in connection with the embodiments may be included in at least one embodiment of this application. The phrase appears in various positions in the specification and does not necessarily mean the same embodiment, nor does it mean being independent or alternative to other embodiments and mutually exclusive. Those of ordinary skill in the art can clearly or implicitly understand that the embodiments described in this application can be combined with other embodiments without conflict.

[0101] The above-described embodiments merely represent several implementation manners of this application, and their descriptions are relatively specific and detailed. However, it should not be construed as a limitation on the scope of patent protection. It should be noted that for those of ordinary skill in the art, without departing from the concept of this application, several modifications and improvements can still be made, and these all fall within the protection scope of this application. Therefore, the protection scope of this application shall be subject to the appended claims.

Claims

1. A method for setting the priority of a virtual router group, characterized in that Including: Detect the frequency of occurrence of the failure state of the target router device in the target virtual router group, and when the frequency of occurrence of the failure state of the target router device meets the preset priority adjustment condition, reduce the priority of the target router device in the target virtual router group according to a preset reduction ratio, including: Detect the number of times the target router device in the target virtual router group switches from the master device state to the non-master device state within a preset first period, and when the number of switches is higher than a preset number threshold, reduce the priority of the target router device in the target virtual router group according to a preset reduction ratio; wherein, at least two router devices are included in the target virtual router group; the number of times the detected target router device switches from the master device state to the standby device state and the initial state within the preset first period is the frequency of occurrence of the failure state; After adjusting the priority of the target router device, mark the target router device as the adjusted state; when the adjusted state of the target router device is activated, trigger the monitoring of the available state of the target router device, and when it is detected that the available state of the target router device meets the preset stability condition, restore the priority of the target router device to the preset priority, including: After adjusting the priority of the target router device, time the failure event of the target router device, and when it is determined according to the timing result of the failure event that the available state of the target router device is stably maintained for a preset second period, restore the priority of the target router device to the preset priority; The stability condition is that no interface failure event occurs within a preset second period; In the case where the priority of the target router device has been adjusted, when it is detected that the frequency of occurrence of the failure state of the target router device meets the priority adjustment condition again, reduce the priority on the basis of the current priority of the target router device according to the preset reduction ratio.

2. The method for setting the priority of the virtual router group according to claim 1, wherein After adjusting the priority of the target router device, time the failure event of the target router device, and when it is determined according to the timing result of the failure event that the available state of the target router device is stably maintained for a preset second period, restore the priority of the target router device to the preset priority, including: After adjusting the priority of the target router device, trigger a failure event timer for the failure event of the target router device; after the failure event timer is triggered, start counting down with a preset second period, and refresh the countdown when a failure event occurs for the target router device; After the failure event timer reaches zero, restore the priority of the target router device to the preset priority.

3. The method for setting the priority of the virtual router group according to claim 1, characterized in that, The preset priority is the priority pre-configured by the user.

4. The method for setting the priority of a virtual router group according to any one of claims 1 to 3, characterized in that, The target router device is the router device that switches to the master device in the virtual router group.

5. A priority setting device for a virtual router group, characterized in that, Including: An adjustment module and a recovery module; wherein: The adjustment module is used to detect the frequency of occurrence of the failure state of the target router device in the target virtual router group, and when the frequency of occurrence of the failure state of the target router device meets the preset priority adjustment condition, reduce the priority of the target router device in the target virtual router group according to a preset reduction ratio; wherein, at least two router devices are included in the target virtual router group; the number of times that the detected target router device switches from the master device state to the standby device state and the initial state within a preset first period is the frequency of occurrence of the failure state. The adjustment module is further used to detect the number of times the target router device switches from the master device state to a non-master device state within a preset first period in the target virtual router group, and when the number of switches is higher than a preset number threshold, reduce the priority of the target router device in the target virtual router group according to a preset reduction ratio. The recovery module is used to mark the target router device as an adjusted state after adjusting the priority of the target router device; when the adjusted state of the target router device is activated, it triggers the monitoring of the available state of the target router device, and when it is detected that the available state of the target router device meets the preset stability condition, restore the priority of the target router device to the preset priority; the stability condition is that no interface failure event occurs within a preset second period. The recovery module is further used to start timing for the failure event of the target router device after adjusting the priority of the target router device, and when it is determined according to the timing result of the failure event that the available state of the target router device is stably maintained for a preset second period, restore the priority of the target router device to the preset priority. The adjustment module is further used to, when it has adjusted the priority of the target router device and detects that the frequency of occurrence of the failure state of the target router device meets the priority adjustment condition again, reduce the priority on the basis of the current priority of the target router device according to the preset reduction ratio.

6. An electronic device, comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to execute the method for setting the priority of the virtual router group according to any one of claims 1 to 4.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the method for setting the priority of the virtual router group according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Method for shortening switching time of master / spare routers

    CN104683233A

  • Main and standby equipment switching method and device

    CN111030877A

  • Method and system for switching monitoring flow forwarding path

    CN111683007A

  • Method for avoiding route equipment frequent switchover state and one type route equipment

    CN1913493A