OSPF multi-process router-id election method and device, equipment and medium

By dynamically allocating Router-ids using timers and interface enable states after a router reboot, the Router-id election problem during OSPF process reboot is solved, ensuring that all processes obtain a unique identity, avoiding resource waste, and guaranteeing protocol stability.

CN115733821BActive Publication Date: 2026-05-29INSPUR NETWORK TECH (SHANDONG) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
INSPUR NETWORK TECH (SHANDONG) CO LTD
Filing Date
2022-11-14
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

When the router restarts, if the number of device loopback interfaces is less than the number of OSPF processes, some OSPF processes will be unable to elect a Router-id, resulting in failure to start normally, affecting the use of the OSPF routing protocol and causing a waste of IP address resources.

Method used

By creating a timer after the router restarts and dynamically determining the IP address of the Loopback and physical interface as the Router-id of the OSPF process based on the creation order of the OSPF process and the interface enable status, it is ensured that all processes can obtain a unique Router-id.

Benefits of technology

This solves the problem of OSPF processes being unable to elect Router-ids, avoids the waste of IP address resources, and ensures the stability and normal operation of the OSPF protocol.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115733821B_ABST
    Figure CN115733821B_ABST
Patent Text Reader

Abstract

Embodiments of the application disclose an OSPF multi-process Router-id election method, device, equipment and medium. The method comprises: in the case of router restart, determining a first number of IP addresses corresponding to a first number of Loopback interfaces enabled after the first number of Loopback interfaces; creating a second number of OSPF processes to be run, and creating a timer with a preset time threshold; determining the first number of IP addresses as Router-ids of the second number of OSPF processes based on the creation order of the second number of OSPF processes; and in the case that the timer runs to the preset time threshold, determining an OSPF process without a Router-id in the second number of OSPF processes as an OSPF process to be elected, and determining an IP address corresponding to an enabled physical interface as the Router-id of the OSPF process to be elected. The above scheme solves the problem that in the case of router restart and the number of device Loopback interfaces being less than the number of OSPF processes, some OSPF processes cannot be elected to Router-ids.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of interior gateway protocols, and more specifically to an OSPF multi-process Router-id election method, apparatus, device, and medium. Background Technology

[0002] The OSPF dynamic routing protocol requires the use of a Router-id as the router's identity. If a Router-id is not specified when starting these routing protocols, the routing protocol process may fail to start correctly. The priority for Router-id election is as follows: the Router-id manually configured by the OSPF process has the highest priority, the IP address of the Loopback interface has the second highest priority, and the IP address of the enabled physical interface has the third highest priority. The Router-id of each OSPF process serves as its identity and cannot be the same within the same OSPF area; otherwise, it will affect the establishment of OSPF neighbors.

[0003] Because loopback interfaces enable much faster than physical interfaces, the following situation can occur: When a device has multiple OSPF processes, and Router-ids are not manually configured for these processes, and the number of loopback interfaces on the device is less than the number of OSPF processes, when the router restarts, the loopback interfaces will be enabled first. The first OSPF process created will choose the IP address of the loopback interface as its corresponding Router-id. Since the IP addresses for the loopback interfaces have already been selected, but the physical interfaces are not yet enabled, subsequently created OSPF processes will have no address to choose as their corresponding Router-id, and their Router-id will remain empty. Besides the OSPF processes created first that selected the loopback interface, some processes will fail to run because they lack a corresponding Router-id, severely impacting the use of the OSPF routing protocol and wasting IP address resources. Summary of the Invention

[0004] This invention provides a multi-process OSPF Route-id election method to solve the technical problem that some OSPF processes cannot elect a Router-id when the router restarts and the number of device Loopback interfaces is less than the number of OSPF processes.

[0005] In a first aspect, embodiments of this application provide a method for electing a Router-id for multiple OSPF processes, comprising: when the router restarts, after enabling a first number of Loopback interfaces of the router, determining a first number of IP addresses corresponding to the first number of Loopback interfaces; creating a second number of OSPF processes to be run, and creating a timer with a duration of a preset time threshold; determining the first number of IP addresses as the Router-id of the second number of OSPF processes based on the creation order of the second number of OSPF processes; when the timer reaches the preset time threshold, determining the OSPF process without a Router-id among the second number of OSPF processes as the OSPF process to be elected, and determining the IP address corresponding to the enabled physical interface as the Router-id of the OSPF process to be elected.

[0006] In one implementation of this application, the first quantity is less than the second quantity.

[0007] In one implementation of this application, determining a first number of IP addresses as the Router-id of the second number of OSPF processes based on the creation order of the second number of OSPF processes specifically includes: determining whether a Loopback interface exists; if so, determining the IP address of the Loopback interface that has not been used as the Router-id by the OSPF process; sorting the IP addresses of the Loopback interface that has not been used as the Router-id by the OSPF process based on a descending order rule, and applying the sorted IP addresses as the Router-id of the OSPF process based on the creation order of the second number of OSPF processes.

[0008] In one implementation of this application, determining that an OSPF process without a Router-id is a candidate OSPF process, and determining that the IP address corresponding to the enabled physical interface is the Router-id of the candidate OSPF process, specifically includes: determining whether there is an IP address of a physical interface in an enabled state; if so, determining the IP address of the physical interface that has not been used as the Router-id by the OSPF process; sorting the IP addresses of the physical interfaces that have not been used as the Router-id by the OSPF process based on a descending rule, and applying the sorted IP addresses as the Router-id of the OSPF process based on the creation order of a second number of OSPF processes.

[0009] In one implementation of this application, after determining that the IP address corresponding to the enabled physical interface is the Router-id of the OSPF process to be elected, the method further includes: determining whether the Router-id corresponding to any OSPF process is the same as the Router-id corresponding to other OSPF processes; if it is determined that no other OSPF process has the same Router-id as the Router-id corresponding to any OSPF process, then any OSPF process applies the corresponding Router-id.

[0010] In one implementation of this application, the method further includes: if it is determined that other OSPF processes have the same Router-id as any OSPF process, determine that the Router-id corresponding to any OSPF process is a reused Router-id, discard the reused Router-id, and re-determine the Router-id of any OSPF process.

[0011] In one implementation of this application, if the IP addresses of all Loopback interfaces and enabled physical interfaces have been selected as the Router-id of the OSPF process, and there is an OSPF process without a Router-id, the OSPF process without a Router-id is terminated.

[0012] Secondly, embodiments of this application also provide an OSPF multi-process Router-id election device, the device comprising: a preprocessing module, a process creation module, a first election module, and a second election module; the preprocessing module is used to determine a first number of IP addresses corresponding to a first number of Loopback interfaces after the router is restarted and a first number of Loopback interfaces are enabled; the process creation module is used to create a second number of OSPF processes to be run and to create a timer with a duration of a preset time threshold; the first election module is used to determine the first number of IP addresses as the Router-id of the second number of OSPF processes based on the creation order of the second number of OSPF processes; the second election module is used to determine, when the timer reaches the preset time threshold, the OSPF process without a Router-id among the second number of OSPF processes as the OSPF process to be elected, and to determine the IP address corresponding to the enabled physical interface as the Router-id of the OSPF process to be elected.

[0013] Thirdly, embodiments of this application also provide an OSPF multi-process Router-id election device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to: determine a first number of IP addresses corresponding to the first number of Loopback interfaces after the router is restarted; create a second number of OSPF processes to be run, and create a timer with a duration of a preset time threshold; determine the first number of IP addresses as the Router-id of the second number of OSPF processes based on the creation order of the second number of OSPF processes; and when the timer reaches the preset time threshold, determine the OSPF process without a Router-id among the second number of OSPF processes as the OSPF process to be elected, and determine the IP address corresponding to the enabled physical interface as the Router-id of the OSPF process to be elected.

[0014] Fourthly, embodiments of this application also provide a non-volatile computer storage medium for OSPF multi-process Router-id election, storing computer-executable instructions. These computer-executable instructions are configured to: when the router restarts, after enabling a first number of Loopback interfaces, determine a first number of IP addresses corresponding to the first number of Loopback interfaces; create a second number of OSPF processes to be run, and create a timer with a duration of a preset time threshold; based on the creation order of the second number of OSPF processes, determine the first number of IP addresses as the Router-id of the second number of OSPF processes; when the timer reaches the preset time threshold, determine the OSPF process without a Router-id among the second number of OSPF processes as the OSPF process to be elected, and determine the IP address corresponding to the enabled physical interface as the Router-id of the OSPF process to be elected.

[0015] This embodiment provides a multi-process OSPF Router-id election method. By creating a timer with a preset time threshold, it determines the OSPF processes without a Router-id among a second number of OSPF processes as the OSPF processes to be elected. The IP address corresponding to the enabled physical interface is determined as the Router-id of the OSPF process to be elected. This allows the OSPF process to determine all Loopback interfaces and enabled physical interfaces as the corresponding Router-id. This solves the problem that some OSPF processes cannot elect a Router-id when the router restarts and the number of device Loopback interfaces is less than the number of OSPF processes, thus avoiding the waste of IP address resources and ensuring the stability of the OSPF protocol. Attached Figure Description

[0016] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0017] Figure 1 A flowchart of an OSPF multi-process Router-id election method is provided for embodiments of this application;

[0018] Figure 2 A schematic diagram of the internal structure of an OSPF multi-process Router-id election device provided in this application embodiment;

[0019] Figure 3 This is a schematic diagram of the internal structure of an OSPF multi-process Router-id election device provided in an embodiment of this application. Detailed Implementation

[0020] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0021] With the continuous expansion of network scale, the distance-vector routing protocol RIP (Routing Information Protocol) has become unsuitable for large-scale networks due to its slow convergence speed, unscientific metrics, and poor scalability. In response, the IETF developed the OSPF (Open Shortest Path First) protocol to replace RIP. OSPF, based on the SPF algorithm, is a link-state routing protocol that offers greater scalability, faster convergence, and enhanced security and reliability compared to RIP.

[0022] The OSPF dynamic routing protocol requires the use of a Router-id as the router's identity. If a Router-id is not specified when starting these routing protocols, the routing protocol process may fail to start correctly. The priority of Router-id election is as follows: the Router-id manually configured by the OSPF process has the highest priority; if no manually configured Router-id exists, and a Loopback interface with an IP address exists, the largest IP address among the Loopback interface addresses, and not used by other OSPF processes on the same device, is selected as the OSPF process's Router-id, meaning the Loopback interface's IP address has the second highest priority; if neither a manually configured Router-id nor a Loopback interface exists, the largest IP address among the enabled physical interfaces, and not used by other OSPF processes on the same device, is selected as the Router-id, meaning the enabled physical interface's IP address has the third highest priority. The Router-id of each OSPF process serves as its identity and cannot be the same within the same OSPF area; otherwise, it will affect the establishment of OSPF neighbors.

[0023] A Loopback interface is a logical interface on a router, also known as a virtual interface. Due to its virtual nature, the Loopback interface becomes enabled immediately upon router reboot. Because Loopback interfaces enable much faster than physical interfaces, the following situation can occur: When multiple OSPF processes exist on a device, and Router-ids are not manually configured for these processes, and the number of Loopback interfaces on the device is less than the number of OSPF processes, upon router reboot, the Loopback interface will be enabled first. The first OSPF process created will choose the IP address of the Loopback interface as its corresponding Router-id. Since the IP addresses for the Loopback interface have already been selected, but the physical interface is not yet enabled, subsequent OSPF processes will have no address to choose as their corresponding Router-id, and their Router-id will remain empty. After the physical interface is enabled, it will not trigger the OSPF process to elect a Router-id. Therefore, apart from the OSPF processes created first and selecting the Loopback interface, some processes will fail to run because they lack a corresponding Router-id, severely impacting the use of the OSPF routing protocol.

[0024] This embodiment provides a method, apparatus, device, and medium for OSPF multi-process Router-id election, which solves the technical problem that some OSPF processes cannot elect a Router-id when the router restarts and the number of device Loopback interfaces is less than the number of OSPF processes.

[0025] The technical solutions proposed in the embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0026] Figure 1 This document provides a flowchart of an OSPF multi-process Router-id election method as an embodiment of this application. Figure 1 As shown in the figure, the OSPF multi-process Router-id election method provided in this application embodiment specifically includes the following steps:

[0027] Step 101: When the router is restarted, after the first number of Loopback interfaces of the router are enabled, determine the first number of IP addresses corresponding to the first number of Loopback interfaces.

[0028] In one embodiment of this application, when the router restarts, since the Loopback interface is a virtual interface on the router device, it is immediately enabled upon restart. Therefore, this embodiment reads the configuration of each Loopback interface after determining that the router has restarted to determine the IP address corresponding to each Loopback interface. It can be understood that a first number of Loopback interfaces correspond to a first number of IP addresses.

[0029] Step 102: Create a second number of OSPF processes to be run, and create a timer with a duration of a preset time threshold.

[0030] In one embodiment of this application, after determining that the router has restarted, the router will also trigger the OSPF process creation program to sequentially create a second number of OSPF processes to be run. At this time, the Router-id of the OSPF process is empty.

[0031] In one embodiment of this application, the second quantity is greater than the first quantity, that is, the number of OSPF processes created is greater than the number of Loopback interfaces.

[0032] It should be noted that when the router restarts, the Loopback interface is enabled immediately upon restarting because it is a virtual interface on the router device. However, the physical interface, due to its physical nature, requires a certain period of time to be enabled, which generally does not exceed 5 seconds. Therefore, the preset time threshold for the timer is 5 seconds.

[0033] In one embodiment of this application, when a second number of OSPF processes are created, a timer with a duration of a preset time threshold is created, that is, a timer with a duration of 5 seconds is created.

[0034] Step 103: Based on the creation order of the second number of OSPF processes, determine the first number of IP addresses as the Router-id of the second number of OSPF processes.

[0035] In one embodiment of this application, after the OSPF process is created, it begins the election of Router-id. According to the Router-id election priority, since there is no manually configured Router-id at this point, the OSPF process determines whether a Loopback interface exists. If it does, the IP address of the Loopback interface is selected as the Router-id.

[0036] It should be noted that, since the number of OSPF processes is greater than the number of Loopback interfaces, and OSPF processes elect Router-ids sequentially based on their creation order, only the number of first-created OSPF processes equal to the number of Loopback interfaces can select the IP address of the Loopback interface as the corresponding Router-id.

[0037] Specifically, in this embodiment, the IP addresses of Loopback interfaces that have not been used as Router-ids by OSPF processes are first sorted according to a descending order. Then, based on the creation order of the second number of OSPF processes, the sorted IP addresses are used as the Router-ids of the OSPF processes. That is, the first created process receives the largest IP address among the sorted Loopback interface IP addresses as its Router-id, and so on. At this point, some later-created OSPF processes cannot obtain a Router-id because the IP addresses of the Loopback interfaces have been exhausted and the physical interfaces have not yet been enabled. The Router-ids of these OSPF processes remain empty, so they cannot run.

[0038] Step 104: When the timer reaches the preset time threshold, determine the OSPF process without Router-id among the second number of OSPF processes as the OSPF process to be elected, and determine the IP address corresponding to the enabled physical interface as the Router-id of the OSPF process to be elected.

[0039] Understandably, the physical interface enters the enabled state after 5 seconds. However, enabling the physical interface does not trigger the Router-id election of OSPF processes without Router-ids, resulting in a waste of resources between the unused IP address of the enabled physical interface and the OSPF processes without Router-ids. Therefore, in one embodiment of this application, a timer is set to filter out OSPF processes without Router-ids as candidate processes after a preset time threshold is reached, and trigger the Router-id election of these candidate processes to ensure that the IP address of the enabled physical interface is used by the OSPF processes.

[0040] In one embodiment of this application, when the timer reaches a preset time threshold of 5 seconds, all physical interfaces have entered the enabled state. OSPF processes without a Router-id are designated as candidate OSPF processes, and the election of Router-ids for these candidate OSPF processes is triggered. Based on a descending order rule, the IP addresses of physical interfaces not yet used as Router-ids by OSPF processes are sorted. Then, based on the creation order of a second number of OSPF processes, the sorted IP addresses are used as the Router-ids of the OSPF processes; that is, the process created first receives the largest IP address among the sorted physical interface IP addresses as its Router-id, and so on.

[0041] It's important to note that the Router-id serves as the identity identifier for an OSPF process. Within the same OSPF area, each OSPF process must have a unique Router-id; otherwise, it will affect the establishment of OSPF neighbors. After an OSPF process elects a Router-id, it needs to determine whether that Router-id is the same as the Router-id of other processes.

[0042] In one embodiment of this application, after determining that the IP address corresponding to the enabled physical interface is the Router-id of the OSPF process to be elected, it is determined whether the Router-id of the OSPF process to be elected is the same as the Router-id of other OSPF processes. If it is determined that no other OSPF process has a Router-id that is the same as the Router-id corresponding to any OSPF process, then the OSPF process to be elected uses that Router-id; if it is determined that no other OSPF process has a Router-id that is the same as the Router-id corresponding to any OSPF process, then the OSPF process to be elected discards that Router-id and a new election is performed.

[0043] In one embodiment of this application, if the IP addresses of all Loopback interfaces and enabled physical interfaces have been selected as the Router-id of the OSPF process, and there is an OSPF process without a Router-id, the OSPF process without a Router-id is terminated.

[0044] The OSPF multi-process Router-id election method in this application embodiment is to set a timer to check the Router-id of the OSPF process after the physical interface is enabled, and trigger the OSPF process with an empty Router-id to re-elect the Router-id. This enables the OSPF process to determine the corresponding Router-id from the IP addresses of all Loopback interfaces and all enabled physical interface IP addresses, avoiding the waste of IP address resources and ensuring the stability of the OSPF protocol.

[0045] The above are embodiments of the method proposed in this application. Based on the same inventive concept, embodiments of this application also provide an OSPF multi-process Router-id election device, the internal structure of which is as follows: Figure 2 As shown.

[0046] Figure 2 This is a schematic diagram of the internal structure of an OSPF multi-process Router-id election device provided in an embodiment of this application. Figure 2 As shown in the figure, an OSPF multi-process Router-id election device provided in this application includes: a preprocessing module 201, a process creation module 202, a first election module 203, and a second election module 204.

[0047] Those skilled in the art will understand that Figure 2 The illustrated OSPF multi-process Router-id election mechanism structure does not constitute a limitation on the OSPF multi-process Router-id election mechanism. In fact, the OSPF multi-process Router-id election mechanism can include more than [previous methods]. Figure 2 This refers to more or fewer components, or combinations of certain components, or arrangements of different components.

[0048] In one embodiment of this application, the preprocessing module 201 is used to determine the first number of IP addresses corresponding to the first number of Loopback interfaces after the first number of Loopback interfaces of the router are enabled when the router restarts; the process creation module 202 is used to create a second number of OSPF processes to be run and to create a timer with a duration of a preset time threshold; the first election module 203 is used to determine the first number of IP addresses as the Router-id of the second number of OSPF processes based on the creation order of the second number of OSPF processes; the second election module 204 is used to determine the OSPF process without a Router-id among the second number of OSPF processes as the OSPF process to be elected when the timer runs to the preset time threshold, and to determine the IP address corresponding to the enabled physical interface as the Router-id of the OSPF process to be elected.

[0049] Based on the same inventive concept, this application also provides an OSPF multi-process Router-id election device, the structure of which is as follows: Figure 3 As shown.

[0050] Figure 3 This is a schematic diagram of the internal structure of an OSPF multi-process Router-id election device provided in an embodiment of this application. Figure 3 As shown, the device includes:

[0051] At least one processor 301;

[0052] And a memory 302 that is communicatively connected to at least one processor;

[0053] The memory 302 stores instructions executable by at least one processor, which are executed by at least one processor 301 to enable at least one processor 301 to:

[0054] When the router restarts, after the first number of Loopback interfaces are enabled, the first number of IP addresses corresponding to the first number of Loopback interfaces are determined; a second number of OSPF processes to be run are created, and a timer with a duration of a preset time threshold is created; based on the creation order of the second number of OSPF processes, the first number of IP addresses are determined as the Router-id of the second number of OSPF processes; when the timer reaches the preset time threshold, the OSPF processes without a Router-id among the second number of OSPF processes are determined as OSPF processes to be elected, and the IP address corresponding to the enabled physical interface is determined as the Router-id of the OSPF process to be elected.

[0055] Some embodiments of this application provide corresponding to Figure 1 A non-volatile computer storage medium storing computer-executable instructions, wherein the computer-executable instructions are configured as follows:

[0056] When the router restarts, after the first number of Loopback interfaces are enabled, the first number of IP addresses corresponding to the first number of Loopback interfaces are determined; a second number of OSPF processes to be run are created, and a timer with a duration of a preset time threshold is created; based on the creation order of the second number of OSPF processes, the first number of IP addresses are determined as the Router-id of the second number of OSPF processes; when the timer reaches the preset time threshold, the OSPF processes without a Router-id among the second number of OSPF processes are determined as OSPF processes to be elected, and the IP address corresponding to the enabled physical interface is determined as the Router-id of the OSPF process to be elected.

[0057] The various embodiments in this application are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments for IoT devices and media are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0058] The systems, media, and methods provided in this application are one-to-one correspondences. Therefore, the systems and media also have similar beneficial technical effects as their corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the systems and media will not be repeated here.

[0059] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0060] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0061] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0062] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0063] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0064] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0065] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0066] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0067] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A multi-process Router-id election method for OSPF, characterized in that, The method includes: When the router restarts, after the first number of Loopback interfaces of the router are enabled, the first number of IP addresses corresponding to the first number of Loopback interfaces are determined. Create a second number of OSPF processes to be run, and create a timer with a duration of a preset time threshold; Based on the creation order of the second number of OSPF processes, the first number of IP addresses are determined as the Router-id of the second number of OSPF processes; When the timer reaches the preset time threshold, the OSPF process without a Router-id among the second number of OSPF processes is determined as the OSPF process to be elected, and the IP address corresponding to the enabled physical interface is determined as the Router-id of the OSPF process to be elected.

2. The OSPF multi-process Router-id election method according to claim 1, characterized in that, The first quantity is less than the second quantity.

3. The OSPF multi-process Router-id election method according to claim 1, characterized in that, Based on the creation order of the second number of OSPF processes, the first number of IP addresses are determined as the Router-id of the second number of OSPF processes, specifically including: Determine if a Loopback interface exists; If so, identify the IP address of the Loopback interface that is not used as the Router-id by the OSPF process; Based on the descending order rule, the IP addresses of the Loopback interfaces that have not been used as Router-ids by the OSPF processes are sorted, and based on the creation order of the second number of OSPF processes, the sorted IP addresses are used as Router-ids for the OSPF processes.

4. The OSPF multi-process Router-id election method according to claim 1, characterized in that, The process of identifying an OSPF process without a Router-id as a candidate OSPF process is then determined, and the IP address corresponding to the enabled physical interface is identified as the Router-id of the candidate OSPF process. This process includes: Determine if the IP address of the physical interface in the enabled state exists; If so, identify the IP address of the physical interface that was not used as the Router-id by the OSPF process; Based on the descending order rule, the IP addresses of physical interfaces that have not been used as Router-ids by OSPF processes are sorted, and based on the creation order of the second number of OSPF processes, the sorted IP addresses are used as Router-ids for OSPF processes.

5. The OSPF multi-process Router-id election method according to claim 1, characterized in that, After determining that the IP address corresponding to the enabled physical interface is the Router-id of the OSPF process to be elected, the method further includes: Determine whether the Router-id corresponding to any OSPF process is the same as the Router-id corresponding to other OSPF processes; If it is determined that no other OSPF process has the same Router-id as any of the OSPF processes, then the OSPF process applies the corresponding Router-id.

6. The OSPF multi-process Router-id election method according to claim 5, characterized in that, The method further includes: If it is determined that another OSPF process has the same Router-id as any OSPF process, the Router-id corresponding to any OSPF process is determined to be a reused Router-id, the reused Router-id is discarded, and a new Router-id is determined for any OSPF process.

7. A multi-process OSPF Router-id election method according to claim 3 or 4, characterized in that, The method further includes: If the IP addresses of all Loopback interfaces and enabled physical interfaces have been selected as the Router-id for the OSPF process, and there is an OSPF process without a Router-id, then terminate the OSPF process without a Router-id.

8. An OSPF multi-process Router-id election device, characterized in that, The device includes: a preprocessing module, a process creation module, a first election module, and a second election module; The preprocessing module is used to determine the first number of IP addresses corresponding to the first number of Loopback interfaces after the first number of Loopback interfaces of the router are enabled when the router restarts. The process creation module is used to create a second number of OSPF processes to be run, and to create a timer with a duration of a preset time threshold. The first election module is used to determine the first number of IP addresses as the Router-id of the second number of OSPF processes based on the creation order of the second number of OSPF processes; The second election module is used to determine, when the timer reaches the preset time threshold, the OSPF process without a Router-id among the second number of OSPF processes as the OSPF process to be elected, and to determine the IP address corresponding to the enabled physical interface as the Router-id of the OSPF process to be elected.

9. An OSPF multi-process Router-id election device, characterized in that, The device includes: At least one processor; And, a memory communicatively connected to the at least one processor; The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enable the at least one processor to: When the router restarts, after the first number of Loopback interfaces of the router are enabled, the first number of IP addresses corresponding to the first number of Loopback interfaces are determined. Create a second number of OSPF processes to be run, and create a timer with a duration of a preset time threshold; Based on the creation order of the second number of OSPF processes, the first number of IP addresses are determined as the Router-id of the second number of OSPF processes; When the timer reaches the preset time threshold, the OSPF process without a Router-id among the second number of OSPF processes is determined as the OSPF process to be elected, and the IP address corresponding to the enabled physical interface is determined as the Router-id of the OSPF process to be elected.

10. A non-volatile computer storage medium for OSPF multi-process Router-id election, storing computer-executable instructions, characterized in that, The computer-executable instructions are set as follows: When the router restarts, after the first number of Loopback interfaces of the router are enabled, the first number of IP addresses corresponding to the first number of Loopback interfaces are determined. Create a second number of OSPF processes to be run, and create a timer with a duration of a preset time threshold; Based on the creation order of the second number of OSPF processes, the first number of IP addresses are determined as the Router-id of the second number of OSPF processes; When the timer reaches the preset time threshold, the OSPF process without a Router-id among the second number of OSPF processes is determined as the OSPF process to be elected, and the IP address corresponding to the enabled physical interface is determined as the Router-id of the OSPF process to be elected.