A method for in-band clock synchronization for a hopping network
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NAT UNIV OF DEFENSE TECH
- Filing Date
- 2022-12-26
- Publication Date
- 2026-07-10
AI Technical Summary
In large-scale cluster network jump protection systems, existing satellite-based clock synchronization methods suffer from high construction costs and susceptibility to interference, making it difficult to guarantee time consistency among network devices.
A distributed in-band clock synchronization method is adopted. By screening node errors, nodes with errors less than the threshold are selected as initial nodes, and a master node is elected for clock synchronization. Satellite time synchronization is used as an auxiliary means to correct the error when satellite signals are available, avoiding the construction of additional channels and reusing existing network channels for synchronization.
It reduced construction costs, improved system stability and security, ensured relative time consistency of the network under satellite signal interference, and avoided the introduction of additional vulnerable nodes.
Smart Images

Figure CN116015519B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of network security technology, and in particular to an in-band clock synchronization method for hopping networks. Background Technology
[0002] Traditional network security protection largely relies on a passive approach, combining prior knowledge and precise identification based on static network configurations. It primarily focuses on detecting, discovering, and eliminating known threats, but struggles to effectively address unknown vulnerabilities, viruses, Trojans, and APT attacks. Dynamic network security defense, on the other hand, aims to introduce randomness, heterogeneity, dynamism, and uncertainty into the network operating environment. By proactively reconstructing or migrating protocols, software, addresses, and interfaces within the network system, it continuously changes the network's operating environment and state, making it difficult for attackers to predict and track. This significantly increases the difficulty and cost of network attacks, ultimately reducing network security risks.
[0003] In dynamic network protection systems based on address transitions, network addressing information (including routes, IP addresses, ports, etc.) is constantly changing. Ensuring the consistency of addressing information transitions among network devices, especially the coordinated consistency of the entire network in dynamic scenarios of large-scale cluster networks, is crucial to the effectiveness of dynamic network security defense. Therefore, selecting or designing appropriate synchronization strategies to reduce or even avoid the impact of network and service latency on communication links, and ensuring a high synchronization success rate, is both a hot topic and a challenge in this type of defense technology research.
[0004] Synchronization methods applicable to network dynamic protection systems mainly include clock-based, event-based, and timestamp-based methods. Event-based and timestamp-based synchronization methods are insufficient for network-wide jump synchronization in large-scale cluster networks. Clock-based synchronization methods are more suitable for large-scale cluster network jump protection systems. Currently, clock-based synchronization methods often use satellite time synchronization, such as BeiDou clocks and GPS clocks, to provide a precise clock source for synchronization. However, GPS / BeiDou timing signals are unstable, have random errors, and are susceptible to external interference. Directly applying them to dynamic network protection systems presents two problems: First, if the entire system uses BeiDou or GPS timing, all subnets need to install BeiDou timing equipment, resulting in huge construction costs. Furthermore, interference with satellite signals can affect the time consistency of nodes. Second, if only some BeiDou timing equipment is installed or time synchronization is only performed within the cluster network (e.g., via NTP protocol), an additional clock synchronization channel or multiplexed control channel is required to achieve time synchronization between subnet clusters. This synchronization channel introduces new risk points, and the channel construction itself incurs costs, making it difficult to meet security requirements. Summary of the Invention
[0005] This invention provides an in-band clock synchronization method for jump networks to address the problems of high construction costs and susceptibility to interference when deploying satellite timing equipment across the entire network. It provides a distributed jump network clock synchronization method that does not completely rely on satellite timing, based on the relative time synchronization between nodes within the cluster, and using satellite timing as an auxiliary means. When satellite signals are available, the relative time of the cluster is corrected. At the same time, no additional clock synchronization channel or multiplexed control channel is required to complete the time synchronization between jump network clusters, which reduces costs and does not introduce new vulnerable nodes.
[0006] This invention provides an in-band clock synchronization method for jump-type networks, comprising the following steps:
[0007] S1 filters the jump nodes with external time synchronization devices at preset time intervals, downgrades the nodes with errors greater than a preset threshold to slave nodes, and selects the nodes with errors less than the preset threshold as initial nodes.
[0008] S2 Each of the initial selection nodes performs a timer for a random duration, and the initial selection node that reaches the timer first is designated as a candidate node for the master node;
[0009] S3 The candidate node invites other preliminary nodes to vote. If the candidate node receives more than half of the votes from all preliminary nodes, the candidate node will be designated as the master node, broadcast the master node heartbeat to other nodes, and perform clock synchronization service; otherwise, it will continue to wait for heartbeats or voting requests from other nodes.
[0010] According to the present invention, an in-band clock synchronization method for hopping networks is provided. In step S1, hopping nodes equipped with external timing devices are screened, clock source qualification election is performed, nodes with errors greater than a preset threshold are downgraded to slave nodes, and nodes with errors less than the preset threshold are selected as initial nodes. This includes:
[0011] Each transition node connected to an external clock source sends a time request to other nodes connected to an external clock source at a preset time interval and temporarily provides clock synchronization services.
[0012] After receiving the request, other nodes perform a time offset query on the original jump node that initiated the time request, and return the time of each of the other nodes to the original jump node.
[0013] The original jump node obtains the system time within each node at the current moment;
[0014] Perform outlier analysis on the time of the original jump node and the system time within each node to determine the outlier values of the original jump node compared to other nodes. If the outlier value is greater than a preset outlier threshold, the original jump node is determined to be an outlier node; otherwise, the original jump node is determined to be a non-outlier node.
[0015] An in-band clock synchronization method for jump-type networks provided by the present invention includes:
[0016] Non-outlier nodes are selected as initial nodes, and outlier nodes are demoted to slave nodes.
[0017] If the number of non-outlier nodes is 0, then all nodes are selected as initial nodes.
[0018] An in-band clock synchronization method for jump-type networks provided by the present invention includes:
[0019] When all transition nodes in the entire network cluster are not connected to an external time synchronization device, all nodes are selected as initial nodes.
[0020] According to the in-band clock synchronization method for switching networks provided by the present invention, step S3 further includes:
[0021] If a candidate node does not receive more than half of the votes from all the initial selection nodes within a preset time, or receives a master node heartbeat broadcast by other nodes within a preset time, the current candidate node will be downgraded to a slave node.
[0022] According to the present invention, an in-band clock synchronization method for jump networks is provided, when any master node crashes or the clock signal emitted by the external clock source connected to the master node is unstable, the master node stops broadcasting the master node heartbeat.
[0023] If other preliminary nodes do not receive a heartbeat from the master node after one heartbeat cycle, a timer of random duration is executed, and the preliminary node that reaches the timer first becomes a candidate node for the master node.
[0024] Repeat step S3 until a selected node becomes the master node.
[0025] On the other hand, the present invention also provides an in-band clock synchronization system for jump networks, comprising an external timing layer, an internal clock election layer, and a time synchronization layer:
[0026] The external timing layer includes an external timing unit for each subnet transition node, and a preset number of external timing units are connected to any external clock source.
[0027] The internal clock election layer includes a qualification screening unit and a node coordination unit for each subnet jump node. The qualification screening unit screens jump nodes equipped with external time synchronization devices at preset time intervals, downgrading nodes with errors greater than a preset threshold to slave nodes, and selecting nodes with errors less than the preset threshold as initial selection nodes.
[0028] The node coordination unit performs a timer for each of the preliminary selection nodes for a random duration, and selects the preliminary selection node that reaches the timer first as a candidate node for the master node. The candidate node invites other preliminary selection nodes to vote. If the candidate node receives more than half of the votes from all preliminary selection nodes, the candidate node is selected as the master node; otherwise, it continues to wait for the heartbeats or voting requests from other nodes.
[0029] The time synchronization layer includes a time synchronization unit for each subnet transition node, which uses the elected master node as the time server and other transition nodes as slave nodes to request time synchronization from the master node.
[0030] According to the present invention, an in-band clock synchronization system for jump-type networks is provided in which all nodes are selected as initial nodes when none of the jump-type nodes in the entire network cluster are connected to an external time synchronization device.
[0031] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of any of the in-band clock synchronization methods described above.
[0032] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the in-band clock synchronization methods described above.
[0033] The present invention provides an in-band clock synchronization method for jump-type networks, which has at least the following technical advantages compared with the prior art:
[0034] (1) The distributed jump network clock synchronization method that does not rely entirely on satellite time synchronization provided by the present invention does not require the deployment of external time synchronization equipment throughout the network, nor does it require additional clock synchronization channels or the use of control signaling channels. It has a low construction cost and is suitable for large-scale cluster networks.
[0035] (2) This invention is based on the relative time synchronization between nodes within the cluster and uses satellite time synchronization as an auxiliary means. When satellite signals are available, the relative time of the cluster is corrected. It does not rely entirely on satellite time synchronization. When satellite signals are interfered with, it can still maintain the relative consistency of the time within the band and has strong stability.
[0036] (3) The present invention reuses a highly secure jump network, does not require an additional clock synchronization channel or reuse control signaling channel, does not introduce new vulnerable nodes, and protects both synchronous services and data services, thus providing strong security. Attached Figure Description
[0037] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0038] Figure 1 This is a flowchart illustrating the in-band clock synchronization method provided by the present invention;
[0039] Figure 2 This is one of the schematic diagrams of master clock election for the in-band clock synchronization method provided by the present invention;
[0040] Figure 3 This is the second schematic diagram of the master clock election method of the in-band clock synchronization method provided by the present invention;
[0041] Figure 4 This is the third schematic diagram of the master clock election method of the in-band clock synchronization method provided by the present invention;
[0042] Figure 5 This is a schematic diagram of the in-band clock synchronization device provided by the present invention. Detailed Implementation
[0043] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0044] The terms "comprising" and "having," and any variations thereof, in the specification, claims, and accompanying drawings of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or modules is not limited to the steps or modules listed, but may optionally include steps or modules not listed, or may optionally include other steps or modules inherent to such process, method, product, or apparatus.
[0045] It should be noted that the terms "first" and "second" used in this invention merely distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first" and "second" can be interchanged in a specific order or sequence where permissible. It should be understood that the objects distinguished by "first" and "second" can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those described or illustrated herein.
[0046] It should be noted that, based on the PTP protocol (IEEE1588), this invention designs an improved time synchronization protocol adapted to network transition environments, thereby ensuring that synchronization signaling will not be lost due to high-speed network transitions.
[0047] The method provided by this invention adopts a three-layer mode for clock synchronization. The top layer is the "external time synchronization layer", which deploys high-precision external time synchronization equipment. The nodes participating in the transition can choose whether to connect to the external time synchronization equipment. The optional external time synchronization equipment includes, but is not limited to, the Beidou satellite time synchronization source, and it is allowed that some or all nodes do not connect to the satellite time synchronization due to environmental or other reasons.
[0048] The middle layer is the internal clock election layer, which provides internal time synchronization for the entire subnet transition cluster. Each transition subnet contains a qualification screening unit and a node coordination unit. These units are responsible for elections at two levels: first, electing transition nodes that are qualified to be clock sources; and second, electing one of the transition nodes that are qualified to be clock sources as the internal time synchronization source at a certain moment.
[0049] The lower layer is the time synchronization layer. Each node contains a time synchronization unit that supports the modified PTP protocol. The elected "master" node acts as the modified PTP time server, and other nodes, as slave nodes, request time synchronization from this master node.
[0050] The control signaling and time synchronization signaling for node coordination all reuse the existing hopping network, without building new out-of-band channels to ensure security.
[0051] In one embodiment, such as Figure 1 As shown, this invention provides an in-band clock synchronization method for jump-type networks, comprising the following steps:
[0052] S1 filters the jump nodes with external time synchronization devices at preset time intervals, downgrades the nodes with errors greater than a preset threshold to slave nodes, and selects the nodes with errors less than the preset threshold as initial nodes.
[0053] S2 Each of the initial selection nodes performs a timer for a random duration, and the initial selection node that reaches the timer first is designated as a candidate node for the master node;
[0054] S3 The candidate node invites other preliminary nodes to vote. If the candidate node receives more than half of the votes from all preliminary nodes, the candidate node will be designated as the master node, broadcast the master node heartbeat to other nodes, and perform clock synchronization service; otherwise, it will continue to wait for heartbeats or voting requests from other nodes.
[0055] In step S1, initially, among the N transition nodes, M nodes are connected to an external clock source such as Beidou (or GPS, GLONASS, etc.) (M≤N, 0≤M);
[0056] According to the present invention, an in-band clock synchronization method for hopping networks is provided. In step S1, hopping nodes equipped with external timing devices are screened, clock source qualification election is performed, nodes with errors greater than a preset threshold are downgraded to slave nodes, and nodes with errors less than the preset threshold are selected as initial nodes. This includes:
[0057] Each transition node connected to an external clock source sends a time request to other nodes connected to external clock sources every preset time interval, such as every minute, and temporarily provides clock synchronization services.
[0058] After receiving the request, other nodes perform a time offset query on the original jump node that initiated the time request, and return the time of each of the other nodes to the original jump node.
[0059] The original jump node obtains the system time within each node at the current moment;
[0060] Perform outlier analysis on the time of the original jump node and the system time within each node to determine the outlier values of the original jump node compared to other nodes. If the outlier value is greater than a preset outlier threshold, the original jump node is determined to be an outlier node; otherwise, the original jump node is determined to be a non-outlier node.
[0061] As a further explanation, the outlier analysis method employs a density-based local outlier detection algorithm, the specific process of which is as follows:
[0062] Input: Sample set D, positive integer K (used to calculate the Kth distance);
[0063] Output: Local outlier factors for each sample point;
[0064] The process includes:
[0065] (1) Calculate the Euclidean distance of each object to all other objects;
[0066] (2) Sort the Euclidean distances and calculate the k-th distance and the k-th neighborhood;
[0067] (3) Calculate the reachability density of each object;
[0068] (4) Calculate the local outlier factor for each object;
[0069] (5) Sort the local outlier factors of each point and output them.
[0070] Furthermore, non-outlier nodes are selected as initial nodes, and outlier nodes are demoted to slave nodes; if the number of non-outlier nodes is 0, then all nodes are selected as initial nodes.
[0071] Furthermore, when none of the transition nodes in the entire network cluster are connected to an external time synchronization device, all nodes are selected as initial nodes through screening.
[0072] When the number of non-outlier nodes marked as "candidate nodes for time synchronization" in the entire cluster is zero, the election of candidate nodes is abandoned, the absolute time synchronization of the cluster is abandoned, and relative time synchronization within the cluster is adopted instead. That is, all nodes are screened and all nodes are marked as preliminary nodes.
[0073] When all the transition nodes in the entire network cluster are not connected to the external time synchronization device, the candidate node qualification election is abandoned, the absolute time synchronization of the cluster is abandoned, and the relative time synchronization within the cluster is adopted instead. That is, all nodes are filtered and all nodes are marked as preliminary nodes.
[0074] The initial node can continue to execute the above step S2 and can be used as a candidate node to further elect the master node.
[0075] In one embodiment, consider the possibility of nodes joining, leaving, or crashing. When these problems occur and the original master node becomes unable to provide services, other nodes need to elect a new master node. Figure 2-3 As shown, in step S3, the master clock election is performed, including:
[0076] (1) At the initial moment, all nodes marked as "can be candidates for time synchronization" are slave nodes, and each node maintains a countdown timer of random duration. When the countdown of a node reaches its end, such as... Figure 2 As shown, node A is the first to finish its countdown. The node then changes itself to a candidate node and invites other slave nodes to vote. The randomized countdown duration is to prevent all nodes from simultaneously changing their identities and triggering a voting storm.
[0077] (2) Figure 3 As shown, when node A receives more than 50% of the votes, node A is promoted to master node and starts broadcasting master node heartbeats and providing PTP clock synchronization services; if node A does not receive more than 50% of the votes within a certain period of time or receives a "master node" heartbeat from another node during this period (meaning that another node has preemptively become the master node), then node A will be demoted to slave node.
[0078] (3) Figure 4As shown, when A becomes the master node, it immediately broadcasts the "master node" heartbeat to other transition nodes to establish its master node status and begins to provide PTP clock synchronization services. It then continues to broadcast the "master node" heartbeat.
[0079] (4) When the master node A crashes or the external clock source connected to node A is unstable, node A stops broadcasting "heartbeat". At this time, if other nodes do not receive a heartbeat from the master node after one heartbeat cycle, they start a random countdown timer. The node that finishes the countdown first promotes itself to a candidate node and repeats steps (2) and (3).
[0080] Each time a node promotes itself to a candidate node, the current term count is incremented by 1 in the invitation vote. Each slave node can only vote once in the same term, that is, it can only vote for one candidate node, thus preventing multiple candidate nodes from reaching the "50%" winning threshold.
[0081] By combining external satellite time synchronization with the internal clock of the distributed PTP protocol, the subnet cluster can maintain relative time synchronization with a specific subnet even if all subnets lose their external time sources.
[0082] According to the in-band clock synchronization method for switching networks provided by the present invention, step S3 further includes:
[0083] If a candidate node does not receive more than half of the votes from all the initial selection nodes within a preset time, or receives a master node heartbeat broadcast by other nodes within a preset time, the current candidate node will be downgraded to a slave node.
[0084] According to the present invention, an in-band clock synchronization method for jump networks is provided, when any master node crashes or the clock signal emitted by the external clock source connected to the master node is unstable, the master node stops broadcasting the master node heartbeat.
[0085] If other preliminary nodes do not receive a heartbeat from the master node after one heartbeat cycle, a timer of random duration is executed, and the preliminary node that reaches the timer first becomes a candidate node for the master node.
[0086] Repeat step S3 until a selected node becomes the master node.
[0087] On the other hand, the present invention also provides an in-band clock synchronization system for switching networks. The in-band clock synchronization device described below and the in-band clock synchronization method described above can be referred to in correspondence, such as... Figure 5 As shown, it specifically includes an external time synchronization layer, an internal clock election layer, and a time synchronization layer:
[0088] The external timing layer includes an external timing unit for each subnet transition node, and a preset number of external timing units are connected to any external clock source.
[0089] The internal clock election layer includes a qualification screening unit and a node coordination unit for each subnet jump node. The qualification screening unit screens jump nodes equipped with external time synchronization devices at preset time intervals, downgrading nodes with errors greater than a preset threshold to slave nodes, and selecting nodes with errors less than the preset threshold as initial selection nodes.
[0090] The node coordination unit performs a timer for each of the preliminary selection nodes for a random duration, and selects the preliminary selection node that reaches the timer first as a candidate node for the master node. The candidate node invites other preliminary selection nodes to vote. If the candidate node receives more than half of the votes from all preliminary selection nodes, the candidate node is selected as the master node; otherwise, it continues to wait for the heartbeats or voting requests from other nodes.
[0091] The time synchronization layer includes a time synchronization unit for each subnet transition node, which uses the elected master node as the time server and other transition nodes as slave nodes to request time synchronization from the master node.
[0092] According to the present invention, an in-band clock synchronization system for jump-type networks is provided in which all nodes are selected as initial nodes when none of the jump-type nodes in the entire network cluster are connected to an external time synchronization device.
[0093] The present invention also provides an electronic device, which may include: a processor, a communications interface, a memory, and a communication bus, wherein the processor, the communications interface, and the memory communicate with each other through the communication bus. The processor may invoke logical instructions in the memory to execute the steps of the in-band clock synchronization method provided by any of the above methods.
[0094] Furthermore, the logical instructions in the aforementioned memory can be implemented as software functional units and sold or used as independent products, and can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0095] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, wherein when the program instructions are executed by a computer, the computer is able to perform the steps of the in-band clock synchronization method provided by any of the above methods.
[0096] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the in-band clock synchronization method provided by any of the above methods.
[0097] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0098] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0099] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An in-band clock synchronization method for jump-type networks, characterized in that, include: S1. At preset time intervals, the jump nodes equipped with external time synchronization devices are screened. Nodes with errors greater than a preset threshold are downgraded to slave nodes, and nodes with errors less than the preset threshold are selected as initial nodes. Specifically, this includes: each jump node connected to an external clock source sends a time request to other nodes connected to external clock sources at preset time intervals and temporarily provides clock synchronization services; after receiving the request, other nodes perform a time offset query to the original jump node that initiated the time request and return the time of each other node to the original jump node; the original jump node obtains the system time of each node at the current moment; outlier analysis is performed on the time of the original jump node and the system time of each node to determine the time outliers of the original jump node and other nodes. If the outlier is greater than a preset outlier threshold, the original jump node is determined to be an outlier node; otherwise, the original jump node is determined to be a non-outlier node; non-outlier nodes are selected as initial nodes, and outlier nodes are downgraded to slave nodes. S2. Each of the initial selection nodes performs a timer for a random duration, and the initial selection node that reaches the timer first is designated as a candidate node for the master node. S3. The candidate node invites other preliminary nodes to vote. If the candidate node receives more than half of the votes from all preliminary nodes, the candidate node is designated as the master node, broadcasts the master node heartbeat to other nodes, and performs clock synchronization service; otherwise, it continues to wait for heartbeats or voting requests from other nodes.
2. The in-band clock synchronization method for jump-type networks according to claim 1, characterized in that, Non-outlier nodes are selected as initial nodes, and outlier nodes are demoted to slave nodes. If the number of non-outlier nodes is 0, then all nodes are selected as initial nodes.
3. The in-band clock synchronization method for jump-type networks according to claim 1, characterized in that, When all transition nodes in the entire network cluster are not connected to an external time synchronization device, all nodes are selected as initial nodes.
4. The in-band clock synchronization method for jump-type networks according to claim 1, characterized in that, In step S3, if the candidate node does not receive more than half of the votes from all the initial selection nodes within a preset time, or receives a master node heartbeat broadcast by other nodes within a preset time, the current candidate node is downgraded to a slave node.
5. The in-band clock synchronization method for jump-type networks according to claim 1, characterized in that, When any master node crashes or the clock signal from the external clock source connected to that master node becomes unstable, that master node will stop broadcasting its heartbeat. If other preliminary nodes do not receive a heartbeat from the master node after one heartbeat cycle, a timer of random duration is executed, and the preliminary node that reaches the timer first becomes a candidate node for the master node. Repeat step S3 until a selected node becomes the master node.
6. An in-band clock synchronization system for switching networks, characterized in that, It includes an external time synchronization layer, an internal clock election layer, and a time synchronization layer: The external timing layer includes an external timing unit for each subnet transition node, and a preset number of external timing units are connected to any external clock source. The internal clock election layer includes a qualification screening unit and a node coordination unit for each subnet switching node. The qualification screening unit filters switching nodes equipped with external time synchronization devices at preset time intervals, downgrading nodes with errors greater than a preset threshold to slave nodes and selecting nodes with errors less than the preset threshold as initial selection nodes. Specifically, this includes: each switching node connected to an external clock source sends a time request to other nodes connected to external clock sources at preset time intervals and temporarily provides clock synchronization services; upon receiving the request, other nodes perform a time offset query on the original switching node that initiated the time request and return their respective times to the original switching node; the original switching node obtains the system time within each node at the current moment; outlier analysis is performed on the time of the original switching node and the system time within each node to determine the time outliers between the original switching node and other nodes. If the outlier is greater than a preset outlier threshold, the original switching node is determined to be an outlier node; otherwise, the original switching node is determined to be a non-outlier node; non-outlier nodes are selected as initial selection nodes, and outlier nodes are downgraded to slave nodes. The node coordination unit performs a timer for each of the preliminary selection nodes for a random duration, and selects the preliminary selection node that reaches the timer first as a candidate node for the master node. The candidate node invites other preliminary selection nodes to vote. If the candidate node receives more than half of the votes from all preliminary selection nodes, the candidate node is selected as the master node; otherwise, it continues to wait for the heartbeats or voting requests from other nodes. The time synchronization layer includes a time synchronization unit for each subnet transition node, which uses the elected master node as the time server and other transition nodes as slave nodes to request time synchronization from the master node.
7. An in-band clock synchronization system for jump-type networks according to claim 6, characterized in that, When all transition nodes in the entire network cluster are not connected to an external time synchronization device, all nodes are selected as initial nodes.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the in-band clock synchronization method as described in any one of claims 1 to 5.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the in-band clock synchronization method as described in any one of claims 1 to 5.