Method for determining main router and related device

By setting the main router status and priority for each router in the VRRP environment, directly determining the router with the highest priority as the main router is solved, which solves the problem of the long determination time of the main router in the traditional solution, and improves the network response speed and reliability sex.

CN119254694APending Publication Date: 2025-01-03北京傲星科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411284948.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-13
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

In VRRP environments, it takes too long to determine the main router in the traditional solution, resulting in insufficient network response speed and the inability to quickly switch the main router in an emergency situation.

Method used

By setting the working status of each router in the virtual router group to the main router state and assigning work priorities to each router, directly determine the router with the largest work priority as the target main router, saving switching time.

Benefits of technology

The time to elect a primary router from a virtual router group is shortened, and the network response speed and reliability is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119254694A_ABST
    Figure CN119254694A_ABST
Patent Text Reader

Abstract

The invention discloses a main router determination method and a related device, and relates to the field of network technology and equipment configuration. Comprising the following steps: setting the working state of each router in a virtual router group as a main router state, and allocating a working priority to each router; and taking the router which is in the main router state and has the maximum working priority in the virtual router group as a target main router corresponding to the virtual router group. Therefore, after the router with the maximum working priority is determined from the plurality of routers of the virtual router group, the router is directly used as the target main router, so that the time for switching the router from the backup router to the main router in the traditional scheme is saved, and the efficiency of switching the router from the backup router to the main router is improved. The time for selecting the main router from the virtual router group is shortened, and the response speed of the network is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network technology and equipment configuration, and in particular to a method for determining a master router and related devices. Background Art

[0002] VRRP (Virtual Router Redundancy Protocol) is a protocol used to implement gateway redundancy and failover in a LAN environment. The protocol provides gateway availability by sharing virtual IP addresses among multiple routers.

[0003] In a VRRP environment, among the multiple routers included in a virtual router group, only one router is elected as the "master router" to forward data packets to the target network; the other routers serve as "backup routers" and are on standby, ready to take over the work of the master router when it fails.

[0004] In the traditional solution, an election mechanism is used to determine which router in the virtual router group is the master router. Specifically, the working state of each router member in the virtual router group is set to the backup router state; within a certain period of time, for any router in the virtual router group, if the router does not receive a VRRP message sent by the master router in the virtual router group, or receives a VRRP message sent by other routers with lower working priorities in the same group, the router will switch from the backup router state to the master router state, and other routers with lower priorities will continue to maintain the backup router state, and the service message forwarding will be undertaken by the master router.

[0005] In the traditional solution, after the initial working state of each router in the virtual router group is configured to the backup router state, it takes several seconds for the router with the highest working priority to be automatically elected from the VRRP environment and for the working state of the elected router with the highest working priority to be switched from the backup router state to the main router state. In some emergency situations, this time is too long.

[0006] Therefore, how to shorten the time to elect a master router from a virtual router group and improve the response speed of the network has become an urgent problem to be solved in the field of network technology and equipment configuration. Summary of the invention

[0007] Based on the above problems, the present application provides a method for determining a master router, which can shorten the time for selecting a master router from a virtual router group and improve the response speed of the network.

[0008] The embodiments of the present application disclose the following technical solutions:

[0009] A first aspect of the present application provides a method for determining a master router, the method comprising:

[0010] Setting the working state of each router in the virtual router group to the main router state, and assigning a working priority to each of the routers;

[0011] The router in the virtual router group that is in the master router state and has the highest working priority is used as the target master router corresponding to the virtual router group.

[0012] In an optional implementation, the router in the virtual router group that is in the master router state and has the highest working priority is used as the target master router corresponding to the virtual router group, including:

[0013] If there is one router in the virtual router group that is in the master router state and has the highest working priority, then use the router as the target master router;

[0014] If there are multiple routers in the master router state and having the highest working priority in the virtual router group, the target master router is determined from the multiple routers having the highest working priority based on the IP address of each router having the highest working priority.

[0015] In an optional implementation, determining a router in the virtual router group that is in the master router state and has the highest working priority includes:

[0016] Based on the working priority of each router in the virtual router group and the working priority carried in the VRRP message sent by other routers in the virtual router group and received by each router, a router in the virtual router group that is in the master router state and has the highest working priority is determined.

[0017] In an optional implementation, after determining the target main router corresponding to the virtual router group, the method further includes:

[0018] For each remaining router other than the target main router in the virtual router group, the working state of the remaining router is switched from the main router state to the backup router state.

[0019] In an optional implementation, after determining the target main router corresponding to the virtual router group, the method further includes:

[0020] If the target master router fails, a master router corresponding to the virtual router group is determined from at least one of the remaining routers.

[0021] In an optional implementation, the step of determining that the target main router is faulty includes:

[0022] If the remaining routers fail to periodically receive the VRRP messages sent by the target master router within a preset time period, it is determined that the target master router has a fault.

[0023] A second aspect of the present application provides a device for determining a primary router, the device comprising:

[0024] A parameter configuration module, used to set the working state of each router in the virtual router group to the main router state, and assign a working priority to each of the routers;

[0025] The target master router determination module is used to use the router in the virtual router group that is in the master router state and has the highest working priority as the target master router corresponding to the virtual router group.

[0026] In an optional implementation, the target main router determination module includes:

[0027] A first target main router determining unit, configured to, if there is one router in the virtual router group that is in the main router state and has the highest working priority, use the router as the target main router;

[0028] The second target main router determining unit is used to determine the target main router from the multiple routers with the highest working priority based on the IP address of each router with the highest working priority if there are multiple routers in the virtual router group that are in the main router state and have the highest working priority.

[0029] A third aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method introduced in any implementation manner of the first aspect.

[0030] A fourth aspect of the present application provides an electronic device, including:

[0031] a memory having a computer program stored thereon;

[0032] A processor is used to execute the computer program in the memory to implement the steps of the method introduced in any implementation manner of the first aspect.

[0033] Compared with the prior art, this application has the following beneficial effects:

[0034] The present application discloses a method for switching router status, comprising: setting the working status of each router in a virtual router group to a master router status, and assigning a working priority to each router; and using the router in the master router status and having the highest working priority in the virtual router group as the target master router corresponding to the virtual router group.

[0035] Since the working state of each router in the virtual router group in the present application is directly set to the master router state, after determining the router with the highest working priority from the multiple routers included in the virtual router group, the router is directly used as the target master router, which saves the time spent on switching the router from the backup router to the master router in the traditional solution, shortens the time to determine the master router from the virtual router group, and improves the response speed of the network. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0037] Figure 1 A flowchart of a method for determining a master router provided in an embodiment of the present application;

[0038] Figure 2 A schematic diagram of a network topology structure provided in an embodiment of the present application;

[0039] Figure 3 A schematic diagram of a VRRP message is provided for an embodiment of the present application;

[0040] Figure 4 A schematic diagram of the structure of a device for determining a master router provided in an embodiment of the present application. DETAILED DESCRIPTION

[0041] VRRP (Virtual Router Redundancy Protocol) is a protocol used to implement gateway redundancy and failover in a LAN environment. The protocol provides gateway availability by sharing virtual IP addresses among multiple routers.

[0042] In a VRRP environment, among the multiple routers included in a virtual router group, only one router is elected as the "master router" to forward data packets to the target network; the other routers serve as "backup routers" and are on standby, ready to take over the work of the master router when it fails.

[0043] In the traditional solution, an election mechanism is used to determine which router in the virtual router group is the master router. Specifically, the working state of each router member in the virtual router group is set to the backup router state; within a certain period of time, for any router in the virtual router group, if the router does not receive a VRRP message sent by the master router in the virtual router group, or receives a VRRP message sent by other routers with lower working priorities in the same group, the router will switch from the backup router state to the master router state, and other routers with lower priorities will continue to maintain the backup router state, and the service message forwarding will be undertaken by the master router.

[0044] In the traditional solution, after the initial working state of each router in the virtual router group is configured to the backup router state, it takes several seconds for the router with the highest working priority to be automatically elected from the VRRP environment and for the working state of the elected router with the highest working priority to be switched from the backup router state to the main router state. In some emergency situations, this time is too long.

[0045] The time required to switch the working state of the router with the highest working priority from the backup router state to the main router state is T; the expression of T is:

[0046] T = (3 × VRRP message sending time interval) + (256 - router working priority) / 256; where the router working priority: the value range is 0-255, the configurable range is 1-254, 0 and 255 are the working priority values ​​reserved by the system for special purposes, the larger the working priority value, the higher the router priority.

[0047] Therefore, how to shorten the time to elect a master router from a virtual router group and improve the response speed of the network has become an urgent problem to be solved in the field of network technology and equipment configuration.

[0048] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0049] Figure 1 A flowchart of a method for determining a master router provided in an embodiment of the present application. Figure 1 As shown, the method for determining the master router in the virtual router group disclosed in the present application includes:

[0050] S101, setting the working state of each router in the virtual router group to the main router state, and assigning a working priority to each router.

[0051] The working priority of each router in the virtual router group can be the same or different. The value corresponding to the working priority is between 1-254.

[0052] It is understandable that those skilled in the art can set the initial working state of each router in the virtual router set and assign a working priority to each router by using a programming language such as C++.

[0053] S102: Use a router in the virtual router group that is in the master router state and has the highest working priority as a target master router corresponding to the virtual router group.

[0054] In an optional implementation, for each router in the virtual router group, after receiving VRRP messages sent by other routers in the virtual router group (the VRRP messages carry the working priority of the router sending the messages), the router determines the size of its own working priority and the working priorities of other routers received, and finally determines the router in the virtual router group that is in the master router state and has the highest working priority.

[0055] It is understandable that a virtual router group may include multiple routers, and the working priorities of these routers may be the same; that is, there may be one or more routers in the virtual router group that are in the master router state and have the highest working priority.

[0056] If there is only one router in the virtual router group that is in the master router state and has the highest working priority, then this router is used as the target master router corresponding to the virtual router group.

[0057] Exemplarily, virtual router group M1 (virtual router group M1 has executed step S101) includes router 1, router 2 and router 3, the working priority of router 1 is 254, the working priority of router 2 is 100, and the working priority of router 3 is 50. Then, there is only one router in the virtual router group that is in the master router state and has the highest working priority, namely router 1. Then router 1 is used as the target master router corresponding to virtual router group M1.

[0058] If there are multiple routers in the virtual router group that are in the master router state and have the highest working priority, the target master router corresponding to the virtual router group is determined from the multiple routers with the highest working priority based on the IP address of each router with the highest working priority.

[0059] For example, if the virtual router group M2 (the virtual router group M2 has executed step S101) includes router 4, router 5 and router 6. Among them, the working priority of router 4 is 254, the working priority of router 5 is 254, and the working priority of router 6 is 100, then there are two routers in the master router state with the highest working priority in the virtual router group M2, namely router 4 and router 5; at this time, the IP address of router 4 and the IP address of router 5 can be compared, and the router with the smaller IP address can be selected as the target master router corresponding to the virtual router group M2.

[0060] It should be emphasized that after a router in a virtual router group is determined as the target main router corresponding to the virtual router group, the working state of the target main router remains the pre-set main router state. However, for each remaining router other than the target main router in the virtual router group, the working state of the remaining router needs to be switched from the main router state to the backup router state.

[0061] After determining the target master router corresponding to the virtual router group, the internal timer in the network topology structure can be turned on to determine whether the remaining routers other than the target master router in the virtual router group periodically receive the VRRP messages sent by the target master router within a preset time period; if the VRRP messages sent by the target master router are not received periodically within the preset time period, it is considered that the current target master router is faulty.

[0062] At this time, in order to ensure that the network can work normally, the main router corresponding to the virtual router group can be determined from at least one remaining router other than the target router in the virtual router group based on the "election mechanism" in the traditional solution.

[0063] After a new target main router corresponding to the virtual router group is determined from the plurality of remaining routers, the working state of the router needs to be switched from the candidate router state to the main router state, so that the virtual router group can work normally.

[0064] For ease of understanding, combined Figure 2 The network topology shown in Figure 1 The method for determining the main router in is described in detail.

[0065] Figure 2In the network topology structure in , computer hosts, L2 switches, router A, router B, device C and device D of multiple users are protected. Router A and router B are two routers in the virtual router group. Device C and device D are other protocol forwarding devices outside the virtual router group, and device C and device D are not specifically limited in this application.

[0066] Reference Figure 1 Method for determining the master router in the virtual router group, determining Figure 2 The process of obtaining the target main router corresponding to the virtual router group (the virtual router group is referred to as virtual router group M in this application) is:

[0067] First, Figure 2 The working state of each router in the virtual router group M is set to the master router state, and a working priority is assigned to each router.

[0068] Specifically, first configure the basic link of router A. After the basic link configuration of router A is completed, enable the virtual router group M through the port connected to the access layer switch, set the initial working state of router A to the main router state, set the working priority of router A to the first value, and keep the default of not preempting resources. The first value is in the range of 1-254.

[0069] After the initial working state of router A is set to the master router state, router A immediately sends free ARP packets and VRRP packets to the outside from the port with VRRP function enabled.

[0070] It is understandable that when the working state of router A is the master router state, router A periodically sends VRRP packets to the outside at a default time interval, such as 1 second.

[0071] It is understandable that the purpose of sending free ARP messages is to direct the information messages that need to be transmitted to router A, so that router A can assume the functions of service forwarding and routing.

[0072] Figure 3 A schematic diagram of a VRRP message is provided for an embodiment of the present application. Figure 3 As shown in FIG. 1 , the VRRP message carries the work priority information (referred to as priority information) of the router sending the VRRP message, namely Figure 3 The Priority in is 254; at the same time, the VRRP message also carries the ID of the virtual router group to which the router that sends the VRRP message belongs, that is, Figure 3 Virtual RtrID in: 1; at the same time, the VRRP message also carries the protocol type of the message, that is, Figure 3Protocol in: VRRP(112).

[0073] Next, configure the basic link of router B in the virtual router group. After the basic link configuration of router B is completed, enable virtual router group M through the port connected to the access layer switch, set the initial working state of router B to the main router state, set the working priority of router B to the second value, and keep the default of not preempting resources. The second value is in the range of 1-254.

[0074] It should be noted that the present application only requires that the value range of the first value and the second value is 1-254; the specific sizes of the first value and the second value are not limited; the first value may be greater than the second value, the first value may be less than the second value, and the first value may be equal to the second value.

[0075] Exemplarily, in the present application, the first value is set to 254, and the second value is set to 100.

[0076] It should be noted that the present application does not limit the configuration order of router A and router B in the virtual router group M. When there are more router members in the virtual router group, the same method can be used to set the initial working state and working priority of each router in the virtual router group.

[0077] After the initial working state of router B is set to the master router state, router B immediately sends gratuitous ARP packets and VRRP packets from the VRRP-enabled port.

[0078] It is understandable that when the working state of router B is the master router state, router B periodically sends VRRP packets to the outside at a default time interval, such as 1 second.

[0079] After the initial working state of each router in the virtual router group is set to the master router state and each router is assigned a working priority, the router in the master router state and with the highest working priority in the virtual router group can be determined based on the working priority of each router in the virtual router group and the working priority carried in the VRRP message sent by other routers in the virtual router group and received by the router, and the router with the highest working priority is used as the target master router corresponding to the virtual router group.

[0080] Combination Figure 2As shown in the figure, after reaching the sending cycle, router B sends a VRRP message to the outside, which carries the working priority (100) of router B. After receiving the VRRP message sent by router B, router A parses the message and finds that the working priority 100 of router B carried in the message is less than its own working priority 254. Then router A does not change its own working status and continues to periodically send VRRP messages to the outside as the main router.

[0081] After Router A reaches its sending cycle, it sends a VRRP message that carries Router A's work priority (254). After Router B receives the VRRP message sent by Router A, it parses the message and finds that Router A's work priority 254 carried in the message is greater than its own work priority 100. Router B then automatically switches its work status from the master router status to the backup router status.

[0082] It is understandable that if router B has received the VRRP message sent by router A before sending the VRRP message to the outside, and router B has determined that its own work priority is lower than the work priority of router A, then router B will automatically switch its own work status from the main router status to the backup router status, and router B will no longer periodically send VRRP messages to the outside as the main router.

[0083] Through the transmission and parsing process of VRRP messages, we can know that Figure 2 In the virtual router group M, the working priority of router A is greater than the working priority of router B. The initial working states of router A and router B are both set to the master router state. Therefore, router A, which is in the master router state and has a higher working priority, is used as the target router of the virtual router group M. For each remaining router other than the target router in the virtual router group, that is, router B, its working state is switched from the master router state to the backup router state.

[0084] It is understandable that the virtual router set may include more than two router members. No matter how many routers are included in the virtual router set, the method in the application may be adopted. Figure 1 The method shown determines that the virtual router set corresponds to the target main router.

[0085] Figure 2 The working priorities of router A and router B in the virtual router set M shown in are different. The working priority of router A is 254, and the working priority of router B is 100.

[0086] In another case, if Figure 2The working priority of router A in the virtual router group M is equal to the working priority of router B. At this time, based on each router with the largest working priority, that is, the IP address of router A and router B, the target main router corresponding to the virtual router set is determined from multiple routers with the largest working priority.

[0087] Exemplarily, when the initial working states of router A and router B are both the main router state, and the working priority of router A is equal to the working priority of router B, a router with a smaller IP address can be selected from router A and router B as the target main router of the virtual router set; at the same time, the working state of another router other than the target main router is switched from the main router state to the backup router state.

[0088] After determining the target master router corresponding to the virtual router group, start the local timer to determine whether the remaining routers other than the target master router in the virtual router periodically receive VRRP messages sent by the target master router within a preset time period. If the remaining routers fail to periodically receive VRRP messages sent by the target master router within the preset time period, it is determined that the target master router is faulty. At this time, referring to the method in the traditional solution, that is, based on the working priorities of the remaining routers and the working priorities carried in the VRRP messages sent by other routers received by the remaining routers, a backup router with the highest working priority is determined from at least one remaining router as the new target master router corresponding to the virtual router group.

[0089] In summary, the present application discloses a method for switching router status, including: setting the working status of each router in a virtual router group to a master router status, and assigning a working priority to each router; and using the router in the master router status and having the highest working priority in the virtual router group as the target master router corresponding to the virtual router group.

[0090] Since the working state of each router in the virtual router group in the present application is directly set to the master router state, after determining the router with the highest working priority from the multiple routers included in the virtual router group, the router is directly used as the target master router, which saves the time spent on switching the router from the backup router to the master router in the traditional solution, shortens the time to determine the master router from the virtual router group, and improves the reliability and response speed of the network.

[0091] Figure 4 A schematic diagram of the structure of a device for determining a master router provided in an embodiment of the present application.

[0092] Combination Figure 4As shown, the main router determination device 400 disclosed in the present application includes:

[0093] The parameter configuration module 401 is used to set the working state of each router in the virtual router group to the main router state, and assign a working priority to each router;

[0094] The target master router determination module 402 is used to use the router in the virtual router group that is in the master router state and has the highest working priority as the target master router corresponding to the virtual router group.

[0095] In an optional implementation, the target master router determination module 402 includes:

[0096] A first target main router determining unit, configured to, if there is one router in the virtual router group that is in the main router state and has the highest working priority, use the router as the target main router;

[0097] The second target main router determining unit is used to determine the target main router from the multiple routers with the highest working priority based on the IP address of each router with the highest working priority if there are multiple routers in the virtual router group that are in the main router state and have the highest working priority.

[0098] In an optional implementation, the target master router determination module 402 includes:

[0099] A working priority determination unit is used to determine a router in the virtual router group that is in the master router state and has the highest working priority based on the working priority of each router in the virtual router group and the working priority carried in the VRRP message received by each router and sent by other routers in the virtual router group.

[0100] In an optional implementation, the main router determination device 400 further includes:

[0101] The state switching module is used to switch the working state of each remaining router other than the target main router in the virtual router group from the main router state to the backup router state.

[0102] In an optional implementation, the main router determination device 400 further includes:

[0103] The target main router updating module is used to determine the main router corresponding to the virtual router group from at least one of the remaining routers if the target main router fails.

[0104] In an optional implementation, the main router determination device 400 further includes:

[0105] The fault determination module is configured to determine that the target master router has a fault if the remaining routers fail to periodically receive the VRRP message sent by the target master router within a preset time period.

[0106] Based on the above embodiments, a method and apparatus for determining a primary router are provided. Accordingly, the present application also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, some or all of the steps in the method for determining a primary router mentioned above are implemented.

[0107] Based on the method and device for determining a primary router provided in the foregoing embodiments, the present application further provides an electronic device, including:

[0108] a memory having a computer program stored thereon;

[0109] The processor is configured to execute the computer program in the memory to implement some or all of the steps in the method for determining the master router provided in the above embodiment.

[0110] It should be noted that each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described above is merely schematic, in which the unit described as a separate component may or may not be physically separated, and the component prompted as a unit may or may not be a physical unit, that is, it may be located in one place, or it may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.

[0111] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for determining a master router, characterized in that: include: Setting the working state of each router in the virtual router group to the main router state, and assigning a working priority to each of the routers; The router in the virtual router group that is in the master router state and has the highest working priority is used as the target master router corresponding to the virtual router group.

2. The method according to claim 1, characterized in that The step of using the router in the virtual router group that is in the master router state and has the highest working priority as the target master router corresponding to the virtual router group includes: If there is one router in the virtual router group that is in the master router state and has the highest working priority, then use the router as the target master router; If there are multiple routers in the master router state and having the highest working priority in the virtual router group, the target master router is determined from the multiple routers having the highest working priority based on the IP address of each router having the highest working priority.

3. The method according to claim 1, characterized in that Determining a router in the virtual router group that is in the master router state and has the highest working priority includes: Based on the working priority of each router in the virtual router group and the working priority carried in the VRRP message sent by other routers in the virtual router group and received by each router, a router in the virtual router group that is in the master router state and has the highest working priority is determined.

4. The method according to any one of claims 1 to 3, characterized in that After determining the target main router corresponding to the virtual router group, the method further includes: For each remaining router other than the target main router in the virtual router group, the working state of the remaining router is switched from the main router state to the backup router state.

5. The method according to claim 4, characterized in that After determining the target main router corresponding to the virtual router group, the method further includes: If the target master router fails, a master router corresponding to the virtual router group is determined from at least one of the remaining routers.

6. The method according to claim 5, characterized in that The step of determining that the target main router is faulty comprises: If the remaining routers fail to periodically receive the VRRP messages sent by the target master router within a preset time period, it is determined that the target master router has a fault.

7. A device for determining a primary router, characterized in that: The device comprises: A parameter configuration module, used to set the working state of each router in the virtual router group to the main router state, and assign a working priority to each of the routers; The target master router determination module is used to use the router in the virtual router group that is in the master router state and has the highest working priority as the target master router corresponding to the virtual router group.

8. The method according to claim 1, characterized in that: The target main router determination module includes: A first target main router determining unit, configured to, if there is one router in the virtual router group that is in the main router state and has the highest working priority, use the router as the target main router; The second target main router determining unit is used to determine the target main router from the multiple routers with the highest working priority based on the IP address of each router with the highest working priority if there are multiple routers in the virtual router group that are in the main router state and have the highest working priority.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method described in any one of claims 1 to 6 are implemented.

10. An electronic device, characterized in that: include: a memory having a computer program stored thereon; A processor, configured to execute the computer program in the memory to implement the steps of the method according to any one of claims 1 to 6.