Priority setting method and device of virtual router group and storage medium

By detecting and adjusting the fault status and availability of router devices in virtual router groups and dynamically adjusting their priorities, the traffic forwarding problems caused by frequent master-subsidiary switching in VRRP network are solved, and network stability and reliability.

CN119316346AActive Publication Date: 2025-01-14ZHEJIANG DAHUA TECH CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In VRRP networking, since the router device with the highest priority and the best stability cannot be automatically elected, the number of master and backup switching is frequent, resulting in unstable traffic forwarding and frequent packet loss.

Method used

By detecting the frequency and available state of the target router device, adjust its priority according to preset conditions, reduce the priority of the fault router device, thereby reducing the frequency of main and backup switching and improving traffic forwarding stability.

Benefits of technology

It effectively reduces the frequency of master-slip switching, reduces data packet loss, improves the smooth operation of the network environment, realizes dynamic adjustment of the priority of router equipment in the network, and selects the most reliable router equipment for traffic forwarding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119316346A_ABST
    Figure CN119316346A_ABST
Patent Text Reader

Abstract

The invention relates to a priority setting method and device for a virtual router group and a storage medium, and the method comprises the steps: detecting the fault state occurrence frequency of target router equipment in a target virtual router group, and determining the fault state occurrence frequency of the target router equipment in the target virtual router group; when the fault state occurrence frequency of the target router equipment meets a preset priority adjustment condition, reducing the priority of the target router equipment in the target virtual router group according to a preset reduction proportion; wherein the target virtual router group comprises at least two router devices; and monitoring the available state of the target router equipment, and when it is monitored that the available state of the target router equipment meets a preset stable condition, recovering the priority of the target router equipment to a preset priority. According to the method, the priority of the fault router equipment can be lowered, so that the main and standby switching frequency is reduced, the flow forwarding stability is finally improved, and data packet loss is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network communications, and in particular to a method, device and storage medium for setting the priority of a virtual router group. Background Art

[0002] In the digital era, users in the communications industry have increasingly higher requirements for the reliability of network transmission. Among them, the Virtual Router Redundancy Protocol (VRRP) is a routing protocol designed to solve the single point failure problem of configuring static gateways 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 included in the same VRRP group and share the IP address of this virtual router. Routers in the same VRRP group have two mutually exclusive roles: master router (Master) and backup router (Backup). The master router is responsible for the Address Resolution Protocol (ARP) to parse and forward Internet Protocol (IP) packets, while the backup router is on standby. When the master router fails, the backup router can quickly upgrade to the master router and take over its work.

[0003] In the networking using VRRP, there are frequent active and standby switching, for example, when the interface of the backup group frequently switches 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 backup group to forward network data, in the case of network oscillation, the current VRRP networking has problems such as unstable traffic forwarding and high data packet loss due to the frequent active and standby switching.

[0004] There is no effective solution to the problem of unstable traffic forwarding and high data packet loss caused by frequent master-slave switching in related technologies. Summary of the invention

[0005] In this embodiment, a method, device and storage medium for setting the priority of a virtual router group are provided to solve the problems of unstable traffic forwarding and high data packet loss caused by frequent master-slave switching in the related art.

[0006] In a first aspect, a method for setting a priority of a virtual router group is provided in this embodiment, comprising: 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; 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 monitored that the available state of the target router device meets a preset stability condition, the priority of the target router device is restored to a preset priority.

[0007] In some embodiments, the frequency of occurrence of a fault state of a target router device in a target virtual router group is detected, and when the frequency of occurrence of the fault state of the target router device meets a preset priority adjustment condition, the priority of the target router device in the target virtual router group is reduced according to a preset reduction ratio, including: The number of switchings of the target router device from the master device state to the non-master device state within a preset first time period in the target virtual router group is detected, and when the number of switchings is higher than a preset number threshold, the priority of the target router device in the target virtual router group is reduced according to a preset reduction ratio.

[0008] In some embodiments, the method further comprises: 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 of the target router device is reduced based on the current priority of the target router device according to the preset reduction ratio.

[0009] 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 a preset stability condition, restoring the priority of the target router device to a preset priority, includes: After the priority of the target router device is adjusted, a fault event of the target router device is timed, and after it is determined, based on the timing result of the fault event, that the available state of the target router device is stably maintained for a preset second period of time, the priority of the target router device is restored to a preset priority.

[0010] In some embodiments, after adjusting the priority of the target router device, timing the fault event of the target router device, and after determining that the available state of the target router device is stable for a preset second period of time according to the timing result of the fault event, restoring the priority of the target router device to the preset priority, includes: After adjusting the priority of the target router device, triggering a fault event timer for the fault event of the target router device; after the fault event timer is triggered, the countdown starts at a preset second time period, and the countdown is refreshed when a fault event occurs in the target router device; After the fault event timer is reset to zero, the priority of the target router device is restored to a preset priority.

[0011] In some of the embodiments, the preset priority is a priority preconfigured by a user.

[0012] In some of the embodiments, the target router device is a router device switched to a master device in the virtual router group.

[0013] In a second aspect, a priority setting device for a virtual router group is provided in this embodiment, including: an adjustment module and a recovery module; wherein: The adjustment module 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 a preset reduction ratio; wherein the target virtual router group includes at least two router devices; The recovery module is used to monitor the available state of the target router device, and when it is monitored 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.

[0014] In a third aspect, an electronic device is provided in this embodiment, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for setting the priority of the virtual router group described in the first aspect is implemented.

[0015] In a fourth aspect, a storage medium is provided in this embodiment, on which a computer program is stored, and when the program is executed by a processor, the method for setting the priority of a virtual router group described in the first aspect is implemented.

[0016] Compared with the related art, a priority setting method, device and storage medium for a virtual router group are provided in this embodiment. The priority setting method for a virtual router group detects the frequency of occurrence of the fault state of a 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, the priority of the target router device in the target virtual router group is reduced according to a 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-slave switching, and ultimately improve the stability of traffic forwarding and reduce data packet loss.

[0017] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] 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 on the present application. In the drawings: Figure 1 It is a hardware structure block diagram of a terminal of the method for setting the priority of a virtual router group in an embodiment of the present application; Figure 2 is a flow chart of a method for setting the priority of a virtual router group according to an embodiment of the present application; Figure 3 This is a schematic diagram of a network networking scenario based on VRRP in an embodiment of the present application; Figure 4 It is a data flow diagram of priority adjustment of VRRP router devices in some embodiments of the present application; Figure 5 is a flowchart of a method for setting the priority of a virtual router group in some embodiments of the present application; Figure 6 It is a structural block diagram of a priority setting device for a virtual router group according to an embodiment of the present application. DETAILED DESCRIPTION

[0019] In order to more clearly understand the purpose, technical solutions and advantages of the present application, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments.

[0020] Unless otherwise defined, the technical terms or scientific terms involved in this application shall have the general meaning understood by people with general skills in the technical field to which this application belongs. The words "one", "a", "the", "these" and the like in this application do not indicate a quantitative limitation, and they may be singular or plural. The terms "include", "comprise", "have" and any variants thereof involved in this application are intended to cover non-exclusive inclusions; for example, a process, method and system, product or device comprising 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 to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" may mean: A exists alone, A and B exist at the same time, and B exists alone. Generally, the character " / " indicates that the objects associated with each other are in an "or" relationship. The terms "first", "second", "third", etc. in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.

[0021] The method embodiment provided in this embodiment can be executed in a terminal, a computer or a similar computing device. For example, running on a terminal, Figure 1 FIG. 4 is a hardware structure diagram of a terminal of the method for setting the priority of a virtual router group of this embodiment. Figure 1 As shown, the terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 and a memory 104 for storing data, wherein 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 also include a transmission device 106 and an input and output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.

[0022] 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 priority setting method of the virtual router group in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the terminal via a network. Examples of the above network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0023] The transmission device 106 is used to receive or send data via a network. The above network includes a wireless network provided by a communication provider of the terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (Radio Frequency, referred to as RF) module, which is used to communicate with the Internet wirelessly.

[0024] In this embodiment, a method for setting the priority of a virtual router group is provided. Figure 2 Flowchart of the method for setting the priority of the virtual router group of this embodiment. Figure 2 As shown, the process includes the following steps: Step S210, 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; wherein the target virtual router group includes at least two router devices.

[0025] 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 the virtual router group. The target virtual router group is a virtual router group in which the currently monitored target router device becomes the master device. Among them, the virtual router group consists of a master device and multiple backup devices, serving as the default gateway of the host in a shared LAN. There can be multiple virtual router groups corresponding to each device, and the status of each virtual router group is independent. For example, device A can belong to 10 virtual router groups, for example, forming the first group with device B and device C; forming 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 it belongs to, and the backup 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 backup device in the remaining 7 groups.

[0026] In this step, under the premise of having the priority adjustment authority for a certain router device, after the router device becomes the master device of a certain group of virtual router groups, the frequency detection of the occurrence of the fault state is enabled with the virtual router group as a unit, the virtual router group with the target router device as the master device is monitored, and the priority of the target router device in the virtual router group is adjusted. Among them, the frequency of occurrence of the fault state can be specifically represented by the interface unavailable event occurring within the 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. For example, 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 before the reduction.

[0027] Figure 3 FIG. 1 is a schematic diagram of a network configuration scenario based on VRRP in this embodiment. Figure 3 As shown, Figure 3 The backup group in the solid line box is the virtual router group mentioned above, which may include multiple router devices supporting VRRP. The dashed line box is the router device in the backup group that frequently fails and has the highest priority. Figure 3 The other devices except the backup group can be any device that can be connected to the switch, including but not limited to computers, switches and Internet Protocol Cameras (IPCs).

[0028] In a virtual router group, the redundant 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. For example, when there is already a master in the virtual router group, if another router device in the group modifies its own priority to be higher than the master, the router device with the highest current priority will preempt to become the new master; or if a router device with a higher priority than the current master is newly added to the group, the new router device will preempt to become the new master. When a high-priority router device in the virtual router group frequently performs interface up and down events, that is, a certain interface of the router device frequently switches between unavailable and available states, a high-priority router device will frequently join and exit the virtual router group, and the master device in the virtual router group will frequently switch. In networking, as long as there is a master device switch, message loss will occur.

[0029] In this regard, this step detects the frequency of occurrence of the fault state of the target router device with a higher priority. When the frequency of occurrence 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 reduce the priority to prevent the target router device from becoming the main router in the target virtual router group again, which causes network oscillation and packet loss.

[0030] Step S220, monitoring the available state of the target router device, and when it is monitored 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.

[0031] After the priority of the target router device is adjusted, the target router device can be marked to indicate that the target router device has become in 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 failure event of the target router. The interface failure event of the target router can specifically be an interface up event in which the router interface changes from an unavailable state to an available state, or a down event in which the router interface changes from an available state to an unavailable state. The interface can specifically be a routing port, an aggregation port, or a three-layer virtual interface, etc. When the available state of the target router device meets the preset stability conditions, the priority of the target router can be restored to the set priority before the adjustment begins. The preset priority can be the priority pre-configured by the user for the target router device. The above-mentioned stability condition can specifically be that no interface failure event occurs within the preset second time period.

[0032] In the related art, there are situations where active / standby switching is frequently performed, for example, when the interface of the virtual router group frequently switches between available and unavailable states, or the network quality of the uplink is low, etc. Since it is impossible to automatically select a router device with the highest priority and the best stability from the virtual router group to forward network data, in the case of network oscillation, the current VRRP networking has problems such as unstable traffic forwarding and high data packet loss due to the frequent active / standby switching.

[0033] Based on the above steps S210 and S220, this embodiment identifies network oscillation by counting the frequency of occurrence of the fault state of the master device, thereby evaluating 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 lowered to avoid becoming the master device again and causing network oscillation, reduce packet loss, and restore the priority of the router device 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, causing network oscillation. This embodiment can reduce the master-slave switching, avoid traffic switching, and save the time for router devices in the VRRP virtual router group to re-election and traffic recovery time. Finally, this embodiment can reduce the probability of network oscillation, ensure the smooth operation of the network environment, and realize the dynamic adjustment of the priority of router devices in the network, so as to select a most reliable router device as the master router device for traffic forwarding based on the dynamic adjustment of the priority.

[0034] Through the above steps S210 to S220, the frequency of the fault state of the target router device in the target virtual router group is detected, and when the frequency of the fault 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 the master-slave switching, and ultimately improve the stability of traffic forwarding and reduce data packet loss.

[0035] In one embodiment, based on the above step S210, the frequency of occurrence of the fault state of the target router device in the target virtual router group is detected, and when the frequency of occurrence of the fault 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, which may include: The number of switchings of the target router device from the master device state to the non-master device state within a preset first time period in the target virtual router group is detected, and when the number of switchings is higher than a preset number threshold, the priority of the target router device in the target virtual router group is reduced according to a preset reduction ratio.

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

[0037] In particular, each time the state switching of the master device is detected, the detected information is reported to the state switching counter preset by the virtual router group. When the count of the state switching counter reaches the preset number threshold in the first time period, the priority of the target router device in the target virtual router group is reduced according to the preset ratio, for example, the priority is reduced to 1 / 2 of the current priority. In this embodiment, by detecting the number of state switching, the priority of the router device that frequently switches states can be reduced, which can reduce the probability of the target router device becoming the master device, thereby avoiding network shock caused by the target router device becoming the master device and reducing packet loss.

[0038] In one embodiment, the above method for setting the priority of the virtual router group may further include: 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 conditions again, the priority of the target router device is reduced based on the current priority of the target router device according to a preset reduction ratio.

[0039] After the target router device has been prioritized, when the target router device triggers priority reduction again, it will be prioritized again according to the preset ratio based on the latest priority that has been prioritized previously. In this way, the priority of the target router device with a higher failure frequency can be gradually reduced to improve the flexibility and rationality of the priority setting of each router device in the virtual router group.

[0040] In addition, in one embodiment, based on the above step S220, the available state of the target router device is monitored, and when it is monitored 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, which may specifically include: After the priority of the target router device is adjusted, the fault event of the target router device is timed, and after determining that the available state of the target router device is stable for a preset second period of time based on the timing result of the fault event, the priority of the target router device is restored to the preset priority.

[0041] After the priority of the target router device is lowered, the target virtual router group is marked as being in an 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 a preset second time period. If not, it is confirmed that the available state of the target router device meets the preset stable condition, and the priority of the target router device is restored to the corresponding priority before it was lowered.

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

[0043] In one embodiment, after adjusting the priority of the target router device, timing the fault event of the target router device, and after determining that the available state of the target router device is stable for a preset second period of time according to the timing result of the fault event, restoring the priority of the target router device to the preset priority may include: After the priority of the target router device is adjusted, a fault event timer for the fault event of the target router device is triggered; after the fault event timer is triggered, the countdown starts from a preset second period, and the countdown is refreshed when a fault event occurs in the target router device; after the fault event timer returns to zero, the priority of the target router device is restored to the preset priority.

[0044] After the priority of the target router device is lowered, the corresponding fault event timer is triggered to detect the stability of the available state of the target router device after the priority is lowered. Specifically, the fault event timer is set to count down with the preset second time period as the starting time. 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 returns to zero, it indicates that no fault event occurs to the target router device within the preset second time period. In this case, a priority recovery event can be triggered to restore the priority of the target router device, specifically, it can be restored 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.

[0045] Figure 4 FIG. 1 is a schematic diagram of data flow for priority adjustment of VRRP router devices in some embodiments. Figure 4 As 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 recovery module 46. In a virtual router group, after a router device becomes a master device, the monitoring system 40 is triggered. The monitoring system 40 performs detection in units of virtual router groups. In the detection module 42, the number of times the monitored target router device switches from the master device state to the standby device state or the initial state within a preset first time period is detected, and the detection information is reported to the state switching counter. When the count of the state switching counter reaches the preset number threshold, the adjustment module 44 is triggered to adjust the priority, and the priority of the target router device is actively reduced to half of the current priority. After the adjustment mechanism of the adjustment module 44 is triggered, the target virtual router group is marked, and the fault event timer is triggered to count down to the preset second time 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 returns to zero, the recovery module 46 is notified in the form of an event notification to inform that the target router device has recovered to a healthy state. After receiving the notification that the fault event timer has been reset to zero, the recovery module 46 triggers a priority recovery event and notifies the adjustment module 44 to recover the priority of the target router device. After receiving the priority recovery event, the adjustment module 44 recovers the priority of the target router device to the priority configured by the user. Figure 4 The detection module 42, the adjustment module 44, the recovery module 46, and each counter in the embodiment may be implemented in the form of hardware, software, or a combination of hardware and software, which is not specifically limited in this embodiment.

[0046] Figure 5 is a flowchart of a method for setting priorities of virtual router groups in some of the embodiments, such as Figure 5 As shown, the priority setting method of the virtual router group includes the following steps: Step S501, determine whether the router device becomes the master device; if so, execute step S502; otherwise, execute step S518.

[0047] Step S502, triggering the monitoring system; wherein the router device that will become the master device is used as the target router device; the monitoring system includes a detection module, an adjustment module and a recovery module.

[0048] Step S503: detecting the frequency of occurrence of the fault state of the target router device based on the detection module.

[0049] Step S504, determining whether the target router device is switched to a standby device state or an initial state; if so, executing step S505; otherwise, returning to executing step S503.

[0050] Step S505, incrementing the state switching counter by 1.

[0051] Step S506, determining whether the count of the state switching counter reaches a preset number threshold; if so, executing step S507; otherwise, returning to executing step S504.

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

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

[0054] Step S509, determine whether a priority restoration notification is received; if so, execute step S511; otherwise, execute step S510.

[0055] Step S510, reducing the priority to 1 / 2 of the current priority.

[0056] Step S511, lowering the priority after the priority adjustment is re-triggered.

[0057] Step S512, triggering or refreshing the fault event timer.

[0058] Step S513, determine whether a fault event occurs; if so, execute step S512; otherwise, execute step S514.

[0059] Step S514: the fault event timer is decremented by 1.

[0060] Step S515, determine whether the fault event timer is reset to zero; if so, execute step S516; otherwise, return to execute step S513.

[0061] Step S516: instruct the restoration module to restore the priority of the target router device to the priority configured by the user.

[0062] Step S517, notifying the adjustment module to restore the priority; returning to step S508.

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

[0064] The above steps S501 to S518 can lower the priority of the failed 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 priority setting method of the virtual router group of 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 achieve automatic adjustment of the priority of the master device in the virtual router group in the entire network when the master device frequently fails, and automatically restore the priority after the available state is stable.

[0065] In this embodiment, a device for setting the priority of a virtual router group is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. The terms "module", "unit", "subunit" and the like used below may be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0066] Figure 6 60 is a structural block diagram of the priority setting device 60 of the virtual router group of this embodiment. Figure 6 As shown, the priority setting device 60 of the virtual router group includes: an adjustment module 62 and a recovery module 64; wherein: 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 a 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 monitored 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.

[0067] It should be noted that the above modules can be functional modules or program modules, and can be implemented by software or hardware. For modules implemented by hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.

[0068] In this embodiment, an electronic device is further provided, including a memory and a processor, wherein 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.

[0069] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0070] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program: S1, 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; wherein the target virtual router group includes at least two router devices; S2, monitoring the available state of the target router device, and when it is monitored 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.

[0071] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and will not be repeated in this embodiment.

[0072] In addition, in combination with the priority setting method for the virtual router group provided in the above embodiment, a storage medium can also be provided in this embodiment to implement the method. The storage medium stores a computer program; when the computer program is executed by a processor, any of the priority setting methods for the virtual router group in the above embodiment is implemented.

[0073] It should be understood that the specific embodiments described herein are only used to explain the application, rather than to limit it. Based on the embodiments provided in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the protection scope of this application.

[0074] 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 used 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.

[0075] Obviously, the drawings are only some examples or embodiments of the present application. For ordinary technicians in the field, the present application can also be applied to other similar situations based on these drawings without creative work. In addition, it is understandable that although the work done in this development process may be complicated and lengthy, for ordinary technicians in the field, certain changes in design, manufacturing or production based on the technical content disclosed in this application are only conventional technical means and should not be regarded as insufficient content disclosed in this application.

[0076] The term "embodiment" in this application refers to a specific feature, structure or characteristic described in conjunction with the embodiment that can be included in at least one embodiment of the present application. The appearance of this phrase in various locations in the specification does not necessarily mean the same embodiment, nor does it mean that it is mutually exclusive with other embodiments and is independent or optional. It is clearly or implicitly understood by those of ordinary skill in the art that the embodiments described in this application can be combined with other embodiments without conflict.

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

Claims

1. A method for setting the priority of a virtual router group, characterized in that: include: 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; 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 monitored that the available state of the target router device meets a preset stability condition, the priority of the target router device is restored to a preset priority.

2. The method for setting the priority of a virtual router group according to claim 1, characterized in that: The method includes detecting the frequency of occurrence of a 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, including: The number of switchings of the target router device from the master device state to the non-master device state within a preset first time period in the target virtual router group is detected, and when the number of switchings is higher than a preset number threshold, the priority of the target router device in the target virtual router group is reduced according to a preset reduction ratio.

3. The method for setting the priority of a virtual router group according to claim 2, characterized in that: The method further comprises: 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 of the target router device is reduced based on the current priority of the target router device according to the preset reduction ratio.

4. The method for setting the priority of a virtual router group according to claim 1, characterized in that: 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 a preset stability condition, the priority of the target router device is restored to a preset priority, including: After the priority of the target router device is adjusted, a fault event of the target router device is timed, and after it is determined, based on the timing result of the fault event, that the available state of the target router device is stably maintained for a preset second period of time, the priority of the target router device is restored to a preset priority.

5. The method for setting the priority of a virtual router group according to claim 4, characterized in that: After adjusting the priority of the target router device, timing the fault event of the target router device, and after determining, based on the timing result of the fault event, that the available state of the target router device is stably maintained for a preset second period of time, restoring the priority of the target router device to a preset priority, including: After adjusting the priority of the target router device, triggering a fault event timer for the fault event of the target router device; after the fault event timer is triggered, the countdown starts at a preset second time period, and the countdown is refreshed when a fault event occurs in the target router device; After the fault event timer is reset to zero, the priority of the target router device is restored to a preset priority.

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

7. The method for setting the priority of a virtual router group according to any one of claims 1 to 6, characterized in that: The target router device is a router device switched to a master device in the virtual router group.

8. A priority setting device for a virtual router group, characterized in that: include: An adjustment module and a recovery module; wherein: The adjustment module 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 a preset reduction ratio; wherein the target virtual router group includes at least two router devices; The recovery module is used to monitor the available state of the target router device, and when it is monitored 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.

9. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to execute the method for setting the priority of a virtual router group according to any one of claims 1 to 7.

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

Citation Information

Patent Citations

  • Method for shortening switching time of master / spare routers

    CN104683233A

  • Method and device for switching master router to backup routers based on VRRP (Virtual Router Redundancy Protocol)

    CN106100987A

  • Host and backup switching and election method in VRRP backup set, router and medium

    CN108833273A

  • Main and standby equipment switching method and device

    CN111030877A

  • Method and system for switching monitoring flow forwarding path

    CN111683007A