Active balanced allocation defense method for IPv6 address hopping of power Internet of Things
By establishing a mapping relationship model between load conditions and address allocation success rate, predicting and dynamically adjusting the mark bit retention threshold, the problem of selecting the number of mark bits during IPv6 address jump of power IoT devices is solved, and efficient and reliable address allocation and address pool optimization are achieved.
Patent Information
- Application Number
- CN202411805322.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-07
- Publication Date
- 2025-05-30
AI Technical Summary
During the IPv6 address jump of power IoT devices, the selection of the number of tag bits affects the success rate and efficiency of address allocation. It is difficult for the prior art to find the optimal tag bit retention threshold under different load conditions, resulting in a contradiction between address pool utilization and allocation success rate.
By analyzing the usage of mark bits in the historical jump cycle, a mapping relationship model between load conditions and address allocation success rate is established, the minimum mark bit retention threshold for each jump cycle is predicted, and the usage of mark bits in the address pool is dynamically monitored, and the supplementary mechanism is triggered to ensure the remaining number of mark bits above the threshold.
It improves the success rate of IPv6 address allocation of IoT devices, ensures the supply of address resources of key devices, and realizes dynamic optimization management of address pools, improving the utilization efficiency of address resources and service reliability.
Smart Images

Figure CN120075195A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information technology, and in particular to an active balanced allocation and defense method for IPv6 address hopping in the power Internet of Things. Background Art
[0002] During the IPv6 address hopping process of power Internet of Things devices, the influence of the remaining number of allocation flag bits in the address pool within a single hopping period on the address allocation success rate is a technical problem worthy of in-depth study.
[0003] The IPv6 address hopping mechanism aims to improve address utilization efficiency and reduce address waste, but at the same time introduces new technical challenges. The selection of the number of flag bits within the hopping period is crucial and directly affects the success rate and efficiency of address allocation. Too many flag bits will lead to a decrease in the utilization rate of the address pool, while too few may cause address allocation conflicts and failures. In the actual application scenarios of the power Internet of Things, the number of devices is huge, the address requirements are variable, and the requirements for address allocation efficiency under different service load conditions are also different. Therefore, it is necessary to deeply analyze the relationship between the number of flag bits and the address allocation efficiency within the hopping period, and find the optimal flag bit retention threshold under different load conditions. This requires comprehensive consideration of multiple factors such as the number of devices, the distribution of address requirements, and the hopping frequency, and balancing the contradiction between the address pool utilization rate and the address allocation success rate. At the same time, considering the particularity of power Internet of Things devices, such as requirements for low power consumption and high reliability, it poses higher challenges to the address allocation mechanism. Only by deeply understanding the business scenario and carefully analyzing the technical problems can the optimal solution be found to achieve efficient and reliable address allocation for power Internet of Things devices. Summary of the Invention
[0004] The present invention provides an active balanced allocation and defense method for IPv6 address hopping in the power Internet of Things, mainly including:
[0005] According to the IPv6 address hopping period of power Internet of Things devices, obtain the initial number of allocation flag bits in the IPv6 address pool within each hopping period, and through statistical analysis of the usage of flag bits in historical hopping periods, obtain the consumption rate of flag bits and the change trend of the remaining number under different load conditions;
[0006] Adopt a machine learning algorithm to model the relationship between the remaining number of flag bits and the address allocation success rate under different load conditions, and through training historical data, obtain the mapping relationship between the load conditions, the remaining number of flag bits and the address allocation success rate;
[0007] At the beginning of each IPv6 address hopping cycle, according to the current load conditions, the consumption rate of the marking bits under different load conditions, and the change trend of the remaining quantity, combined with the trained mapping relationship, predict the minimum marking bit reservation threshold that can achieve the target allocation success rate, and set it as the optimization target for this cycle to obtain the optimized target threshold;
[0008] During the IPv6 address hopping cycle, dynamically monitor the usage and remaining quantity of the marking bits in the address pool. When the remaining quantity of the marking bits drops to the optimized target threshold, trigger the marking bit replenishment mechanism of the address pool, and allocate new marking bits from the reserved backup address pool to ensure that the remaining quantity of the marking bits in the address pool is maintained above the threshold;
[0009] Adopt the method of sliding window to calculate and evaluate the address allocation efficiency of several recent hopping cycles, compare the actual allocation success rate with the expected target, and dynamically adjust the parameters in the established mapping relationship between the load conditions, the remaining quantity of the marking bits, and the address allocation success rate, so that it can adapt to the changing trend of the IPv6 address allocation requirements of IoT devices;
[0010] For different types and priorities of IoT devices, set differentiated address allocation strategies and marking bit reservation thresholds, and give priority to processing the allocation requests of critical devices and high-priority services to improve the utilization efficiency of address resources and service reliability. The address allocation strategy includes pre-allocating redundant address spaces for high-priority and critical devices. For low-priority and non-critical devices, when the address resources are tight, the allocation volume is correspondingly reduced, and the idle addresses are recycled more quickly;
[0011] Regularly analyze the usage of the allocated marking bits of the IPv6 addresses of IoT devices, identify the address spaces that are idle for a long time or have low utilization rate, and optimize the utilization rate of the address pool by recycling and reallocating these addresses to ensure that sufficient address resources are provided for new devices and services, so that the IPv6 address hopping process can proceed smoothly.
[0012] The technical solution provided by the embodiments of the present invention may include the following beneficial effects:
[0013] The present invention discloses a method for actively and evenly distributing and defending IPv6 addresses with address hopping in the power Internet of Things. Aiming at the possible allocation failure problem during the address hopping process of Internet of Things devices, by analyzing the usage of marker bits within the historical hopping period, a mapping relationship model between the load condition and the address allocation success rate is established. At the beginning of each hopping period, the minimum marker bit retention threshold is predicted based on the current load, and the address pool replenishment mechanism is triggered through dynamic monitoring. Meanwhile, a differentiated address allocation strategy is adopted, pre-allocating redundant address spaces for high-priority devices and appropriately reducing the allocation amount for low-priority devices when resources are scarce. By evaluating the allocation efficiency through a sliding window and dynamically adjusting the model parameters, the efficient utilization of address resources is achieved. The present invention can effectively improve the success rate of IPv6 address allocation for Internet of Things devices, ensure the address resource supply for key devices, and realize the dynamic optimization management of the address pool. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1 It is a flowchart of a method for actively and evenly distributing and defending IPv6 addresses with address hopping in the power Internet of Things according to the present invention.
[0015] Figure 2 It is a schematic diagram of a method for actively and evenly distributing and defending IPv6 addresses with address hopping in the power Internet of Things according to the present invention.
[0016] Figure 3 It is another schematic diagram of a method for actively and evenly distributing and defending IPv6 addresses with address hopping in the power Internet of Things according to the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0017] Next, the technical solutions in the embodiments of the present invention will be clearly and detailedly described in conjunction with the accompanying drawings in the embodiments of the present invention. The described embodiments are only a part of the embodiments of the present invention.
[0018] Such as Figures 1-3 , a method for actively and evenly distributing and defending IPv6 addresses with address hopping in the power Internet of Things in this embodiment may specifically include:
[0019] Step S101, according to the IPv6 address hopping period of the power Internet of Things devices, obtain the initial number of allocation marker bits of the IPv6 address pool within each hopping period, and through statistical analysis of the usage of marker bits within the historical hopping period, obtain the consumption rate of marker bits and the change trend of the remaining quantity under different load conditions.
[0020] Obtain the binary status of the IPv6 address pool flag bits in the time series database, and get the total number of flag bits in the address pool through a bit operation calculator; use a doubly linked list to store the correspondence between the flag bit index value and the timestamp, and judge the flag bit consumption rate value according to the ratio of the timestamp to the flag bit consumption quantity; according to the flag bit consumption rate value and the sliding time window, calculate the flag bit occupancy density by calculating the mean variance, and read the flag bit status data from the doubly linked list; for the flag bit status data, use the load pressure calculation formula P = M×D / T to calculate the address pool load pressure value, where M is the number of allocated flag bits, D is the flag bit occupancy density, and T is the time window length, and decompose and reconstruct the load pressure value through wavelet transform; if the load pressure value exceeds the preset threshold, read the flag bit status from the doubly linked list, perform a compact arrangement on the flag bits by bit operation, and obtain the recombined flag bit status data through binary compression storage.
[0021] Exemplarily, record the binary status of the flag bits in the IPv6 address pool according to the time series database, obtain the total number of flag bits in the address pool through a bit operation calculator, use a doubly linked list to store the corresponding relationship between each flag bit index value and the timestamp, and obtain the consumption rate value from the ratio of the number of consumed flag bits to the address pool update time in the database. Standardize the consumption rate value of the flag bits, calculate the mean and variance according to the sliding time window, fit the consumption law of the flag bits, calculate the occupancy density of the flag bits through the number of flag bits and the length of the time window, and read the flag bit status data from the doubly linked list. According to the load pressure calculation formula P = M × D / T, where M is the number of allocated flag bits, D is the occupancy density of the flag bits, and T is the length of the time window, calculate the load pressure value of the address pool, decompose and reconstruct the load data using wavelet transform, and monitor the change trend of the remaining number of flag bits in real time according to a preset threshold. Start the flag bit fragmentation reorganization loop for high load pressure values, read the flag bit status from the doubly linked list, rearrange the positions of the free flag bits, compactly arrange the flag bits through bit operations, store the reorganized flag bit status data using binary compression, and update the flag bit index timestamp in the database. Set the jump period to 1800 seconds in the power Internet of Things device, the IPv6 address pool capacity is 1024 addresses, corresponding to 1024 flag bits, record the flag bit status at an interval of every 30 seconds using the time series database, represent the flag bits in hexadecimal and store them in a compressed manner, the actual number of recording units is 64, the flag bit index in the doubly linked list storage structure ranges from 0 to 1023, and record the status update timestamp of each flag bit accurately to milliseconds. After the consumption rate value is standardized, it is limited between 0 and 1, and the occupancy density of the flag bits is calculated through a sliding time window with a width of 300 seconds. When the density is greater than 0.8, it is determined as high load pressure. The flag bit indexes are arranged in ascending order of the timestamp. If the difference between the timestamps of adjacent flag bits is greater than 180 seconds, it is determined as a fragment. Move the fragment flag bits forward through bit operations, and move the free flag bits backward in turn to achieve compact arrangement. The updated flag bit status data is stored using binary compression. Decompose the load pressure value using the db4 wavelet basis function for three layers. The reconstructed signal reflects the load change trend. Set the pressure warning threshold to 0.9. When the reconstructed signal exceeds the threshold and lasts for more than 300 seconds, trigger the fragmentation reorganization loop, read the flag bit status from the doubly linked list and rearrange it. The bit operation processing speed is 1000 flag bits per second. After the reorganization is completed, update the flag bit index timestamp in the database. After each jump period ends, count the usage of the flag bits, record the maximum consumption rate and the average consumption rate, and use them as the load warning reference value for the next period.
[0022] Step S102: Use a machine learning algorithm to model the relationship between the remaining number of flag bits and the address allocation success rate under different load conditions. Through training historical data, obtain the mapping relationship between the load conditions, the remaining number of flag bits, and the address allocation success rate.
[0023] Calculate the load value based on the total number of flag bits and the used data in the address pool database, obtain the load index through maximum-minimum normalization processing, and divide the load index into corresponding load levels according to the preset threshold; for the load level, obtain the flag bit allocation request records from the database, sample the allocation request records at a fixed time interval, and obtain the flag bit allocation success rate after removing abnormal sampling values through standard deviation; according to the flag bit allocation success rate, read the time series data at the preset sampling period, complement the time series data using the cubic spline interpolation method, and perform denoising processing on the complemented time series data through wavelet transform to obtain the training sample sequence; for the training sample sequence, construct a feature vector using the load index, the remaining number of flag bits, and the allocation success rate, perform dimensionality reduction processing on the feature vector through singular value decomposition, and establish a mapping relationship of training data in the hash table; according to the mapping relationship of training data, calculate the nearest neighbor sample points using the Euclidean distance, obtain the prediction success rate through bilinear interpolation, retrain the part where the deviation between the prediction success rate and the actual success rate exceeds the preset threshold, and update the mapping relationship from the database to obtain the relationship curve between the number of flag bits and the success rate.
[0024] Exemplarily, calculate the usage ratio based on the total number of flag bits and the used amount in the address pool database, obtain the load index through maximum-minimum normalization processing, divide it into five levels according to four thresholds of 0.2, 0.4, 0.6, and 0.8, read the hourly flag bit allocation request records from the database, sample the request data at 30-second intervals, remove the abnormal values exceeding three times the standard deviation, and calculate the flag bit allocation success rate under each level of load. Construct long short-term memory network training samples for the historical flag bit data, read the time series data at a sampling period of 10 seconds with a sliding window width of 600 seconds, complete the missing data points based on cubic spline interpolation, perform wavelet transform denoising on the flag bit allocation request sequence under each level of load index, and calculate the time series relationship between the remaining number of flag bits and the allocation success rate. Construct a three-dimensional feature vector based on the load index, the remaining number of flag bits, and the allocation success rate, perform dimensionality reduction processing on the feature data using singular value decomposition, store the mapping relationship of the training data in the hash table, calculate the lag time between the load index and the allocation success rate through the Pearson correlation coefficient, and obtain the change rules of the remaining number of flag bits and the success rate. For the real-time load index and the remaining number of flag bits, calculate the nearest neighbor sample point in the training data mapping table using the Euclidean distance, calculate the predicted success rate value through bilinear interpolation, retrain the data for the part where the deviation between the predicted result and the actual success rate exceeds 0.1, update the mapping relationship from the database, and output the curve graph of the number of flag bits and the success rate. In the IPv6 address pool, the total number of flag bits is set to 4096, the number of allocated flag bits within the sampling period is 2458, the calculated usage ratio is 0.6, and the load index value normalized to the range of 0 to 1 is 0.6, which is divided into the third level. The database records show that 3600 allocation request records are generated per hour at this load level. 120 data points are obtained at a 30-second sampling interval, 14 abnormal values exceeding three times the standard deviation are removed, and the allocation success rate is calculated as 0.85 for the remaining 106 valid data points. When training based on the long short-term memory network, set the sliding window width to 600 seconds, sample once every 10 seconds to obtain 60 data points, complete 8 missing data points through cubic spline interpolation, and perform three-layer decomposition denoising of the db4 wavelet on the flag bit allocation request sequence. The load index, the remaining number of flag bits, and the allocation success rate in the three-dimensional feature vector are respectively normalized to the range of 0 to 1. The first two feature vectors with a cumulative contribution rate of the eigenvalues reaching 0.95 are retained through singular value decomposition, and the dimensionality-reduced data is stored using a hash table. It is calculated that there is a 120-second lag time between the load index and the allocation success rate, and for every 100 reduction in the remaining number of flag bits, the success rate decreases by 0.02. During real-time monitoring, when the load index is 0.65 and the remaining number of flag bits is 1538, the coordinates of the nearest neighbor sample point (0.63, 1550, 0.83) are found based on the Euclidean distance, the predicted success rate is calculated as 0.82 through bilinear interpolation, the deviation from the actual success rate of 0.81 is 0.01, and the data curve graph is output after updating the mapping relationship.
[0025] Step S103, at the beginning of each IPv6 address hopping period, according to the current load conditions, the consumption rate of the flag bits under different load conditions, and the change trend of the remaining quantity, combined with the trained mapping relationship, predict the minimum flag bit retention threshold that can achieve the target allocation success rate, and set it as the optimization target for this period to obtain the optimized target threshold.
[0026] Obtain the number of flag bits used and the number of allocation requests from the time series database, where the number of flag bits used corresponds to the time point record of the IPv6 address hopping period; according to the number of flag bits used and the number of allocation requests, obtain the normalized data through an exponentially weighted moving average calculator, and calculate the slope of the flag bit consumption rate curve after removing the mutation points using the three - standard - deviation method; for the slope of the flag bit consumption rate curve, train the prediction parameters, fit the flag bit consumption rate curve using a piecewise cubic spline function to obtain the root mean square error of the fitting curve; according to the root mean square error of the fitting curve and the historical change curve of the remaining flag bits, use a fixed - step - length Runge - Kutta recursive calculator to calculate the time - series prediction value, and perform convolution smoothing processing on the prediction data using a Gaussian kernel function to obtain a smoothed prediction data curve; for the smoothed prediction data curve, use the golden section search method to find the minimum threshold point of the remaining flag bits within the preset boundary interval, verify the success rate index under the minimum threshold point through a forward dynamic programming calculator, and record the flag bit optimization target threshold and the upper and lower limits of the prediction confidence interval in the time series database.
[0027] Exemplarily, according to the time point of the IPv6 address hopping period recorded in the time series database, read the number of marker bits used, the number of allocation requests, and the number of successful allocations under the current load condition from the database. Normalize the data through a weighted average calculator based on exponential decay, eliminate mutation points using three times the standard deviation, and calculate the slope of the marker bit consumption rate curve in the previous period. For the mapping relationship data stored in the hash table, use the L-BFGS fitting optimizer to train the prediction parameters, extract the correlation value between the load condition and the marker bit consumption rate from the dataset, select the segmentation interval according to the maximum curvature point, and perform fitting calculation on the marker bit consumption rate curve through a piecewise cubic spline function. Calculate the root mean square error of the fitting curve. According to the fitting curve parameters and the historical change curve of the remaining number of marker bits, use a fixed-step Runge-Kutta recursive calculator to calculate the time series prediction value, store the prediction data points in a double-ended queue, and perform convolution smoothing on the prediction data curve through a Gaussian kernel function, setting the smoothing window width to 0.1 times the length of the prediction sequence. For the success rate curve after smoothing, use the golden section search method to find the minimum threshold point of the remaining number of marker bits within the preset boundary interval, verify the success rate index under the threshold through a forward dynamic programming calculator, and record the marker bit optimization target threshold and the upper and lower limits of the prediction confidence interval in the database. The IPv6 address hopping period is set to 3600 seconds, the time series database records the marker bit status every second, the total number of marker bits under the current load condition is 4096, the number of used ones is 2458, the number of allocation requests is 3600, and the number of successful allocations is 3240. Calculate the weight of the current moment as 1 through exponential decay weighting, with a decay of 0.001 per second forward, and eliminate data points exceeding the standard deviation of 0.015. The slope of the consumption rate curve is 0.8. Use the L-BFGS optimizer to iterate 500 times, set the convergence threshold to 0.0001, calculate the Pearson correlation coefficient between the load and the consumption rate as 0.85, select the segmentation points where the curve curvature is greater than 0.3, and fit each segment using a cubic spline function, setting the second derivative at the boundary to 0. The root mean square error of the fitting curve is 0.02. Based on the fourth-order Runge-Kutta method, recursively push forward 120 data points, set the step size to 1 second, set the capacity of the double-ended queue to 180, and perform convolution smoothing using a Gaussian kernel function with a standard deviation of 5, setting the smoothing window width to 12 seconds. Search for the minimum threshold point within the interval from 1000 to 3000 through the golden section search, set the search accuracy to 1, and use 10 points as the step size for the dynamic programming state transition. Verify that the success rate at the threshold point of 2048 is 0.92, the upper limit of the confidence interval is 2253, and the lower limit is 1843. The database records the target threshold of this period as 2048. Through the record display of the time series database, within 4 hours of running under the set threshold, the average consumption rate of marker bits is 0.82, and the fluctuation range of the success rate is between 0.90 and 0.94.
[0028] Step S104: During the IPv6 address hopping period, dynamically monitor the usage status and remaining quantity of the flag bits in the address pool. When the remaining quantity of the flag bits drops to the optimized target threshold, trigger the flag bit replenishment mechanism of the address pool, and allocate new flag bits from the reserved standby address pool to ensure that the remaining quantity of the flag bits in the address pool is maintained above the threshold.
[0029] According to the address pool monitoring unit, read the flag bit usage status data during the hopping period, store the monitoring data points through a circular buffer, and read the total number of flag bits and the allocated quantity from the master-slave nodes of the database to obtain the remaining quantity of the flag bits; for the flag bit usage data in the circular buffer, use a Kalman filter for data smoothing processing, calculate the change rate of the remaining quantity of the flag bits through a sliding window, and read the remaining capacity value of the standby pool from the database to obtain the status of the standby pool; query the unallocated number of flag bits according to the standby address pool hash index table, number the standby flag bits with timestamps, and mark the allocated status through a bitmap structure based on compressed storage of a block linked list; if the remaining quantity of the flag bits is lower than the threshold value, use a priority queue to allocate free flag bits and perform concurrent control through bitmap block-level locking; for the remaining number of flag bits in the standby pool, update the status data of the master and standby pools through a database transaction, and use a bitmap structure to release the flag bits that have exceeded the usage period to obtain the updated remaining number of flag bits in the standby pool.
[0030] Exemplarily, according to the address pool monitoring unit, the usage status data of the flag bits is read every 10 milliseconds within the jump period, and 1000 consecutive monitoring data points are stored through a circular buffer. The total number of flag bits and the allocated quantity are read from the master-slave nodes of the database, and the remaining quantity of flag bits is calculated using atomic operations. The monitoring results are updated in the database transaction. For the flag bit usage data in the circular buffer, a Kalman filter with an observation noise variance of 0.1 and a process noise variance of 0.01 is used for data smoothing. The change rate of the remaining quantity of flag bits is calculated through a sliding window with a width of 60 seconds. The remaining capacity value of the spare pool is read from the database, and the status of the spare pool is checked. The unallocated number of flag bits is queried according to the hash index table of the spare address pool. The start and end positions of the spare address pool are read from the database. The flag bits of the spare are numbered using a 64-bit integer timestamp. The allocated status is marked through a bitmap structure based on compressed storage of a block-linked list. If the remaining capacity of the spare pool is less than 128 flag bits, dynamic expansion is triggered. For the remaining quantity of flag bits in the real-time monitoring data that is lower than the threshold value, idle flag bits are allocated using a priority queue, and concurrent control is performed through 32-bit bitmap block-level locking. The status data of the main and spare pools is updated in the database transaction. Flag bits that exceed the usage period are released and the bitmap is updated, and the remaining number of flag bits in the spare pool is recounted. The IPv6 address pool monitoring unit samples at intervals of 10 milliseconds. The size of the circular buffer is set to 10MB to store 1000 data points. The main database records a total of 4096 flag bits. The synchronization delay of the slave node is less than 5 milliseconds. The atomic counter shows that 2856 flag bits have been allocated, and the real-time remaining quantity is 1240. The database uses a two-phase commit protocol to update the monitoring data. The initial state covariance of the Kalman filter is set to 1.0, and the residual is less than 0.001 after 100 iterations of convergence. The consumption rate of flag bits calculated within the 60-second sliding window is 2.5 per second. The spare pool capacity check shows that 1024 flag bits remain. The start position of the spare address pool is 4097, and the end position is 5120. The flag bits are numbered using a nanosecond-level timestamp. The bitmap is stored in 4KB blocks, and the compression ratio reaches 8:1. When the remaining capacity of the spare pool drops to 125, 512 flag bits are dynamically expanded. When the remaining quantity of flag bits drops to the threshold of 1200, the flag bit numbers to be allocated in the priority queue are 4097 - 4128 in timestamp order. Concurrent control is performed through a write lock on the 32-bit bitmap. The database update shows that the number of used flag bits in the main pool has increased by 32, the spare pool has 992 remaining, 48 flag bits that have not been used for more than 3600 seconds are recycled, the status of the flag bits in the 128th block of the bitmap is updated, and recounting shows that the spare pool actually has 1040 remaining flag bits.
[0031] Step S105, using the sliding window method, calculates and evaluates the address allocation efficiency of the most recent several hopping cycles, compares the actual allocation success rate with the expected target, and dynamically adjusts the parameters in the mapping relationship between the established load conditions and the remaining number of marker bits and the address allocation success rate, so that it can adapt to the changing trend of the IPv6 address allocation requirements of IoT devices.
[0032] A sliding window is used to read the address allocation records in the IPv6 address time series database, and the allocation request value and success value within the cycle are obtained through a trapezoidal integral calculator; the maximum and minimum values are normalized according to the allocation request value and the success value, and the missing data points in the normalized data are supplemented by the cubic spline interpolation function to obtain a complete normalized data sequence; for the complete normalized data sequence, the mapping parameter matrix is trained using the recursive least squares method. If the parameter change exceeds the preset threshold, the parameter update step is truncated through the L2 norm constraint to obtain the optimized mapping parameters; based on the optimized mapping parameters, the mapping error value is calculated using the Euclidean distance, and the data quality is evaluated through the covariance matrix. If the product of the load index and the remaining number exceeds three times the standard deviation of the historical mean, the corresponding data point is eliminated; for the data points whose mapping error values exceed the preset threshold, abnormal marks are made in the time series database, and new mapping parameter values are calculated using the time-decayed exponential weighted average, and the mapping parameter records in the database are updated through atomic operations.
[0033] Exemplarily, according to the IPv6 address hopping period data recorded in the time series database, a sliding window with a width of 6 hours is used to read the address allocation records. The trapezoidal integral calculator is used to count the number of allocation requests and successes in each period. The original data is normalized by the maximum and minimum values. The expected target success rate value is read from the database, and the missing data points are complemented by cubic spline interpolation. A parameter optimization calculation unit is constructed for the normalized data. The recursive least squares method with a learning rate of 0.01 is used to train the mapping parameter matrix. The L2 norm constraint is used to control the parameter update step size. The parameter changes exceeding 0.1 are truncated. The parameter update results are temporarily stored in the cache, and the database parameters are synchronized every 60 seconds. According to the updated parameters and historical allocation data, the Euclidean distance is used to calculate the mapping error, and the data quality is evaluated by the covariance matrix. The curve of the remaining number of flag bits is read from the database, and the data points whose product of the load index and the remaining number exceeds three standard deviations of the historical mean are removed. The exponential smoothing method is used to predict the change trend in the next 24 hours. For the mapping error in the real-time monitoring data exceeding the 0.1 threshold, the position of the abnormal period data points is marked in the database. The exponentially weighted average based on time decay is used to calculate the new parameter values. The temporarily stored parameters are read from the cache and numerically verified. The mapping parameters in the database are updated through atomic operations. The parameter convergence is evaluated and the latest flag bit allocation data is recorded. In the IPv6 address allocation scenario, the time series database records the address allocation data at 10-millisecond intervals. A sliding window with a width of 6 hours is used to read 2,160 data points. The trapezoidal integral calculation gives a total of 3,600 requests and 3,240 successful allocations in the period. The normalized values are distributed in the range of 0 to 1. The target success rate is set to 0.9. 50 missing data points are complemented by cubic spline interpolation. The initial parameter matrix of the recursive least squares method is set to the identity matrix, with a learning rate of 0.01. After 500 iterations, the parameters converge. The L2 norm constraint is 0.1, and the maximum parameter change after truncation is 0.08. The parameter cache uses a double-buffer structure, and the database is synchronized every 60 seconds. The mapping error is calculated using the 32-dimensional Euclidean distance. The eigenvalue decomposition of the covariance matrix shows that the data quality score is 0.85. The mean of the remaining number of flag bits is 1,024, and the standard deviation is 256. 15 abnormal points are removed. The exponential smoothing method is used to predict the change trend of the remaining number in the next 24 hours, and the prediction confidence level is 0.9. The current mapping error is 0.15, exceeding the 0.1 threshold. The database records the timestamp of the abnormal points. In the exponentially weighted average, the weight in the most recent 1 hour is 0.6, the weight from 1 to 3 hours is 0.3, and the weight from 3 to 6 hours is 0.1. The parameters read from the cache are verified and then written to the database. The parameter convergence criterion is less than 0.001, and the allocation success rate in the update period is increased to 0.93.
[0034] Step S106: Set differentiated address allocation policies and reserved flag thresholds for different types and priorities of IoT devices, prioritize the allocation requests for critical devices and high-priority services, and improve the utilization efficiency of address resources and service reliability. The address allocation policy includes pre-allocating redundant address spaces for high-priority and critical devices, and correspondingly reducing the allocation amount and accelerating the recycling of idle addresses for low-priority and non-critical devices when address resources are scarce.
[0035] Obtain the device activity value, network bandwidth value, and request frequency value according to the device priority database, perform weighted sorting on the values through a minimum heap priority queue to obtain the device priority sequence; for the parent device priority value in the device priority sequence, if the parent device priority value is high priority, the child device obtains the parent device priority value, and calculate the address pool priority distribution map; read the address pool priority distribution map through a bitwise operator, scan the continuous idle flag bits to obtain the pre-allocated space, and record the address segment position information of the pre-allocated space in the database; read the address segment position information of the address segments with device activity values lower than the threshold and no communication records from the radix tree index, and obtain the recycled address segments in reverse order according to the device priority sequence; use a double-pointer scanner to scan the recycled address segments, sort the recycled address segments according to the address segment length through a red-black tree to obtain the address pool bitmap, and re-divide the reserved space for the address segments exceeding the preset length according to the priority distribution map.
[0036] Exemplarily, three metrics including device activity, network bandwidth, and request frequency are obtained from the device priority database. The address allocation requests are sorted according to the metric weighted values through a minimum heap priority queue. When the parent device priority is high, the child device inherits the parent priority value. The priority distribution histogram in the current address pool is calculated from the database, and the pre-allocation space ratio is dynamically adjusted based on the priority ratio. For high-priority device allocation requests, the reserved space ratio is adaptively calculated according to the priority ratio, and batch pre-allocation is performed on consecutive free flag bits through bitwise operations. The start and end positions of the address segment and the timestamp are recorded in the database. When the usage rate of the pre-allocated space is lower than 20%, the reserved ratio is decreased, and when it is higher than 80%, the reserved ratio is increased. The pre-allocation parameters are updated every 120 seconds. The resource pressure is judged according to the total usage rate of the address pool. When the usage rate exceeds 80% or the pre-allocated space of any priority is insufficient, recycling is triggered. Addresses with an activity lower than 0.2 and no communication record for 600 seconds are read from the radix tree index, and the address segments are recycled in reverse order of priority. When there are insufficient high-priority addresses, low-priority address segments are temporarily borrowed. For the flag bits in the address pool after recycling, a double-pointer scan is used to merge consecutive free segments with an interval of less than 32 positions, and they are stored in the red-black tree sorted by the address segment length. The address pool bitmap is updated in the database, and address segments with more than 256 consecutive free bits are split, and the reserved space is re-divided according to the original priority ratio. In the IPv6 address allocation scenario, the device priority database records 3 quantitative metrics including activity from 0 to 1, bandwidth from 0 to 100 Mbps, and request frequency from 0 to 1000 times per hour. The comprehensive score is calculated with weights of 0.4, 0.3, and 0.3. The minimum heap priority queue arranges the requests in descending order of the score. In the current address pool, the high-priority ratio is 35%, the medium-priority ratio is 45%, and the low-priority ratio is 20%. The pre-allocated space is dynamically adjusted to 40%. The current usage rate of the pre-allocated space for high-priority devices is 75%. The bitwise operator allocates 32 consecutive flag bits each time. The database records the start and end positions of the pre-allocated segment 4097 - 5120 and the millisecond-level timestamp. During the 120-second update cycle, the pre-allocation usage rate reaches 85%, and the reserved ratio automatically increases to 45%. When the total usage rate of the address pool reaches 82%, recycling is triggered. The radix tree index shows that 256 addresses have an activity lower than 0.2 and are silent for more than 650 seconds. 154 addresses are recycled in ascending order of priority. Among them, there are insufficient high-priority addresses, and 48 addresses are temporarily borrowed from low-priority ones. The double-pointer scan finds that 12 free segments with an interval of less than 28 bits are generated after recycling, and they are merged into 3 consecutive free segments. The red-black tree storage shows that the longest free segment length is 384 bits, and a split operation is performed into 3 segments of 128 bits, which are re-divided among the three priorities according to the ratio of 35%, 45%, and 20%.
[0037] Step S107: Regularly analyze the usage of the allocation flag bits of the IPv6 addresses of IoT devices, identify address spaces that have been idle for a long time or have low utilization rates, optimize the utilization rate of the address pool by recycling and reallocating these addresses, ensure sufficient address resources for new devices and services, and enable the IPv6 address hopping process to proceed smoothly.
[0038] Obtain the address communication timestamp and traffic data according to the flag bit records stored in the address pool database. Use an exponentially weighted calculator for the timestamp and traffic data to obtain the address activity quantization value, and store the quantization value in the time series database. Determine whether the address activity quantization value is lower than the activity threshold and the duration exceeds the time threshold. If the judgment result is yes, extract the idle addresses from the time series database using a radix tree index. Identify the idle pattern of the idle addresses through a long short-term memory network. If one of the periodic idle pattern, temporary idle pattern, or permanent idle pattern is identified, record the corresponding idle type flag in the database transaction. Construct a priority recycling queue according to the idle type flag. If the permanent idle addresses with an idle duration exceeding the first threshold enter the first-level queue, if the periodic idle addresses with an idle duration exceeding the second threshold enter the second-level queue, and if the temporary idle addresses with an idle duration exceeding the third threshold enter the third-level queue. For the addresses in the priority recycling queue, use a doubly linked list to manage the continuous address segments with an interval less than the position threshold, and count the number of free addresses through a block counter. If the continuous free length exceeds the length threshold, perform a split operation, and mark the address segments after the split operation as reallocatable in the bitmap.
[0039] Exemplarily, according to the flag bit records stored in the address pool database, the address communication timestamps and traffic data are read through the time series sampled per second. An exponentially weighted calculator with a smoothing coefficient of 0.8 is used to quantify the address activity, and the calculation results are stored in the time series database. When the data deviation exceeds three standard deviations, it is marked as an abnormal point, and the activity statistics value is synchronously updated at the master and slave nodes of the database. For addresses with an activity value lower than 0.3 and a duration exceeding 1800 seconds, a 256-ary radix tree index is used to extract idle addresses, the address usage records are read from the database, and three modes of periodic idle, temporary idle, and permanent idle are identified through a four-layer long short-term memory network. The idle type flag is recorded in the database transaction. A three-level priority recovery queue is constructed according to the idle type flag. The bitmap is used to add permanently idle addresses exceeding 3600 seconds to the first level, periodically idle addresses exceeding 7200 seconds to the second level, and temporarily idle addresses exceeding 1800 seconds to the third level. During the recovery process, the atomicity is ensured through two-phase commit, and a write lock is added to the continuous segment where the recovered address is located. For the flag bits in the recovery queue, a doubly linked list is used to manage the continuous address segments with an interval less than 64 positions. The free addresses are counted in units of 256 bits by a block counter. When the continuous free length exceeds 512 bits, a split operation is performed, and the address space after recovery is compressed and sorted, and the reallocable address segments are marked in the bitmap. The IPv6 address pool database samples the communication data once per second. The record shows that the current total number of addresses is 4096, and the number of active addresses is 2458. The activity is calculated with a smoothing coefficient of 0.8, the standard deviation is 0.15, and the data points exceeding 0.45 are marked as abnormal and excluded. The synchronization delay between the master and slave databases is less than 10 milliseconds. For addresses with an activity of 0.28 and no communication for 1920 seconds, 384 idle addresses are extracted using a 256-ary radix tree index. The input layer of the four-layer long short-term memory network is set with 128 neurons, and the hidden layer has 64 neurons. 156 periodic idle addresses, 125 temporary idle addresses, and 103 permanent idle addresses are identified. The first level of the three-level priority recovery queue contains 98 permanently idle addresses exceeding 3750 seconds, the second level contains 142 periodically idle addresses exceeding 7300 seconds, and the third level contains 112 temporarily idle addresses exceeding 1850 seconds. A write lock is added to the 256-bit continuous address segment during the recovery process, and the two-phase commit takes less than 100 milliseconds. The doubly linked list management finds that two continuous address segments with intervals of 58 bits and 62 bits can be merged. The block counter shows that 3 continuous free segments exceeding 512 bits are formed after recovery, and they are split into 6 256-bit segments. After compression and sorting, the utilization rate of the available address segments is increased to 95%, and the bitmap update shows that 896 new reallocable addresses are added.
[0040] Obviously, those skilled in the art can make various changes and modifications to the embodiments of the present application without departing from the spirit and scope of the embodiments of the present application. Thus, if these modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application is also intended to cover these changes and modifications.
Claims
1. A method for active balanced distribution defense of IPv6 address jump in power Internet of Things, characterized in that: The method comprises: According to the IPv6 address hopping cycle of the power Internet of Things device, the initial number of allocated marker bits in the IPv6 address pool in each hopping cycle is obtained. By statistically analyzing the usage of marker bits in historical hopping cycles, the consumption rate and the change trend of the remaining number of marker bits under different load conditions are obtained. A machine learning algorithm is used to model the relationship between the remaining number of tag bits and the address allocation success rate under different load conditions. By training historical data, the mapping relationship between the load condition and the remaining number of tag bits and the address allocation success rate is obtained. At the beginning of each IPv6 address hopping cycle, based on the current load conditions and the consumption rate and remaining number of marker bits under different load conditions, combined with the trained mapping relationship, the minimum marker bit retention threshold that can achieve the target allocation success rate is predicted and set as the optimization target of this cycle to obtain the optimization target threshold; During the IPv6 address hopping period, the usage and remaining number of tag bits in the address pool are dynamically monitored. When the remaining number of tag bits drops to the optimization target threshold, the tag bit replenishment mechanism of the address pool is triggered to allocate new tag bits from the reserved backup address pool to ensure that the remaining number of tag bits in the address pool remains above the threshold. The sliding window method is used to calculate and evaluate the address allocation efficiency of the latest several jump cycles. Compare the actual allocation success rate with the expected target, and dynamically adjust the parameters in the mapping relationship between the established load conditions and the number of remaining marker bits and the address allocation success rate, so that it can adapt to the changing trend of the IPv6 address allocation needs of IoT devices; Differentiated address allocation strategies and tag bit retention thresholds are set for IoT devices of different types and priorities, and allocation requests for key devices and high-priority services are prioritized to improve the utilization efficiency of address resources and service reliability. The address allocation strategy includes pre-allocating redundant address space for high-priority and key devices, and reducing the allocation amount for low-priority and non-key devices when address resources are tight, and speeding up the recovery of their idle addresses. Regularly analyze the usage of the allocation mark bits of the IPv6 addresses of IoT devices, identify the address space that has been idle for a long time or has low utilization, optimize the utilization of the address pool by recycling and reallocating these addresses, ensure sufficient address resources for new devices and services, and enable the IPv6 address hopping process to proceed smoothly.
2. The method according to claim 1, characterized in that According to the IPv6 address hopping cycle of the power Internet of Things device, the initial number of allocated marker bits of the IPv6 address pool in each hopping cycle is obtained, and the consumption rate and the change trend of the remaining number of marker bits under different load conditions are obtained by statistically analyzing the usage of the marker bits in the historical hopping cycle, including: Obtain the binary state of the IPv6 address pool flag bit in the time series database, and obtain the total number of flag bits in the address pool through the bit operation calculator; A bidirectional linked list is used to store the corresponding relationship between the marker bit index value and the timestamp, and the marker bit consumption rate value is determined according to the ratio of the timestamp to the marker bit consumption quantity; According to the mark bit consumption rate value and the sliding time window, the mark bit occupancy density is obtained by calculating the mean variance, and the mark bit status data is read from the bidirectional linked list; For the marker bit status data, the load pressure calculation formula P = M × D / T is used to calculate the address pool load pressure value, where M is the number of allocated marker bits, D is the marker bit occupancy density, and T is the time window length. The load pressure value is decomposed and reconstructed through wavelet transform; If the load pressure value exceeds the preset threshold, the mark bit status is read from the bidirectional linked list, the mark bits are compactly arranged using bit operations, and the reorganized mark bit status data is obtained through binary compression storage.
3. The method according to claim 1, characterized in that The machine learning algorithm is used to model the relationship between the remaining number of tag bits and the address allocation success rate under different load conditions, and the mapping relationship between the load condition and the remaining number of tag bits and the address allocation success rate is obtained by training historical data, including: The load value is calculated based on the total amount of mark bits and the used amount data in the address pool database, the load index is obtained by normalizing the maximum and minimum values, and the load index is divided into corresponding load levels according to the preset threshold value; According to the load level, the marker allocation request records are obtained from the database, and the allocation request records are sampled at fixed time intervals. The marker allocation success rate is obtained by removing abnormal sampling values through standard deviation. According to the success rate of marker bit allocation, the time series data is read according to the preset sampling period, the time series data is completed using the cubic spline interpolation method, and the completed time series data is denoised by wavelet transform to obtain a training sample sequence; For the training sample sequence, the load index, the number of remaining marker bits and the allocation success rate are used to construct the feature vector, the singular value decomposition is used to reduce the dimension of the feature vector, and the training data mapping relationship is established in the hash table; According to the mapping relationship of the training data, the Euclidean distance is used to calculate the nearest neighbor sample point, and the prediction success rate is obtained through bilinear interpolation. The part where the deviation between the predicted success rate and the actual success rate exceeds the preset threshold is retrained, and the mapping relationship is updated from the database to obtain the relationship curve between the number of marker bits and the success rate.
4. The method according to claim 1, characterized in that: At the beginning of each IPv6 address hopping cycle, according to the current load conditions and the consumption rate and the change trend of the remaining number of the mark bits under different load conditions, combined with the trained mapping relationship, the minimum mark bit retention threshold that can achieve the target allocation success rate is predicted, and it is set as the optimization target of this cycle, and the optimization target threshold is obtained, including: Obtain the number of marker bits used and the number of allocation requests from the time series database. The number of marker bits used corresponds to the time point record of the IPv6 address hopping cycle. According to the number of marker bits used and the number of allocation requests, the normalized data is obtained by using an exponential decay weighted average calculator, and the slope of the marker bit consumption rate curve is calculated after removing the mutation point using the triple standard deviation method; According to the slope of the marker position consumption rate curve, the prediction parameters are trained, and the marker position consumption rate curve is fitted by a piecewise cubic spline function to obtain the root mean square error of the fitting curve; According to the root mean square error of the fitting curve and the change curve of the remaining number of historical markers, the fixed step-size Runge-Kutta recursive function is used to calculate the time series prediction value, and the prediction data is convoluted and smoothed by the Gaussian kernel function to obtain a smooth prediction data curve; For the smooth prediction data curve, the golden section search method is used to find the minimum threshold point of the remaining number of markers within the preset boundary interval. The success rate index under the minimum threshold point is verified by the forward dynamic programming calculator, and the marker optimization target threshold and the upper and lower limits of the prediction confidence interval are recorded in the time series database.
5. The method according to claim 1, characterized in that The method includes: dynamically monitoring the usage and remaining number of the tag bits of the address pool during the IPv6 address hopping period, and triggering the tag bit supplement mechanism of the address pool when the remaining number of the tag bits is reduced to the optimization target threshold, allocating new tag bits from the reserved backup address pool, and ensuring that the remaining number of the tag bits of the address pool is maintained above the threshold, including: The address pool monitoring unit reads the usage status data of the mark bit within the jump cycle, stores the monitoring data points through the ring buffer, and reads the total number of mark bits and the allocated number from the master and slave nodes of the database to obtain the remaining number of mark bits; For the usage data of the mark bit in the ring buffer, the Kalman filter is used for data smoothing, the rate of change of the remaining number of mark bits is calculated through the sliding window, and the remaining capacity value of the backup pool is read from the database to obtain the status of the backup pool; The number of unallocated mark bits is queried according to the hash index table of the backup address pool, the backup mark bits are numbered using timestamps, and the allocated status is marked through a bitmap structure based on compressed storage of a block linked list; If the number of remaining mark bits is lower than the threshold value, the priority queue is used to allocate free mark bits, and concurrency control is performed through bitmap block-level locking; According to the number of remaining marking bits in the standby pool, the status data of the main standby pool is updated through database transactions, and the bitmap structure is used to release the marking bits that have exceeded the service life to obtain the updated number of remaining marking bits in the standby pool.
6. The method according to claim 1, characterized in that The sliding window method is used to calculate and evaluate the address allocation efficiency of the most recent several hopping cycles, compare the actual allocation success rate with the expected target, and dynamically adjust the parameters in the mapping relationship between the established load condition and the remaining number of marker bits and the address allocation success rate, so that it can adapt to the changing trend of the IPv6 address allocation demand of the Internet of Things devices, including: The address allocation records in the IPv6 address time series database are read using a sliding window, and the allocation request value and success value within the cycle are obtained through a trapezoidal integral calculator; Perform maximum and minimum normalization processing according to the allocation request value and the success value, and use the cubic spline interpolation function to fill in the missing data points in the normalized data to obtain a complete normalized data sequence; For the complete normalized data sequence, the recursive least squares method is used to train the mapping parameter matrix. If the parameter change exceeds the preset threshold, the parameter update step is truncated by the L2 norm constraint to obtain the optimized mapping parameters. According to the optimized mapping parameters, the mapping error value is calculated using the Euclidean distance, and the data quality is evaluated through the covariance matrix. If the product of the load index and the remaining quantity exceeds three times the standard deviation of the historical mean, the corresponding data point is eliminated; For data points whose mapping error values exceed the preset threshold, anomalies are marked in the time series database, new mapping parameter values are calculated using time-decayed exponential weighted average, and the mapping parameter records in the database are updated through atomic operations.
7. The method according to claim 1, characterized in that The address allocation strategy and the mark bit reservation threshold are set for IoT devices of different types and priorities, and the allocation requests of key devices and high-priority services are processed preferentially, so as to improve the utilization efficiency of address resources and service reliability. The address allocation strategy includes pre-allocating redundant address space for high-priority and key devices, and reducing the allocation amount for low-priority and non-key devices when address resources are tight, and speeding up the recovery of their idle addresses, including: According to the device priority database, the device activity value, network bandwidth value and request frequency value are obtained, and the device priority sequence is obtained by weighted sorting of the values through the minimum heap priority queue; For the priority value of the parent device in the device priority sequence, if the priority value of the parent device is high, the child device obtains the priority value of the parent device and calculates the address pool priority distribution map; The address pool priority distribution map is read through the bit operator, the continuous idle mark bits are scanned to obtain the pre-allocated space, and the address segment location information of the pre-allocated space is recorded in the database; Read the address segment location information of the device activity value lower than the threshold and without communication records from the radix tree index, and obtain the reclaimed address segment in the reverse order of the device priority sequence; A dual-pointer scanner is used to scan the recovered address segments, and the recovered address segments are sorted according to the address segment length through a red-black tree to obtain an address pool bitmap. For address segments that exceed the preset length, the reserved space is re-divided according to the priority distribution map.
8. The method according to claim 1, characterized in that The above mentioned regular analysis of the usage of the allocation mark bits of the IPv6 addresses of IoT devices, identification of long-term idle or low-utilization address spaces, and optimization of the utilization of the address pool by recycling and reallocating these addresses ensures that sufficient address resources are provided for new devices and services, so that the IPv6 address hopping process can proceed smoothly, including: Obtain address communication timestamp and flow data according to the mark bit record stored in the address pool database, use an exponential weighted calculator to obtain a quantized value of address activity based on the timestamp and flow data, and store the quantized value in a time series database; The quantized value of the address activity is judged to be lower than the activity threshold and the duration exceeds the time threshold. If the judgment result is yes, the radix tree index is used to extract the idle address from the time series database; Identify the idle mode of the idle address through the long short-term memory network, and if one of the periodic idle mode, temporary idle mode and permanent idle mode is identified, record the corresponding idle type mark in the database transaction; A priority recycling queue is constructed based on the idle type tag. If the idle time exceeds the first threshold, the permanent idle address enters the first-level queue. If the idle time exceeds the second threshold, the periodic idle address enters the second-level queue. If the idle time exceeds the third threshold, the temporary idle address enters the third-level queue. For the addresses in the priority recovery queue, a bidirectional linked list is used to manage continuous address segments with an interval less than the position threshold. The number of free addresses is counted through a block counter. If the continuous free length exceeds the length threshold, a split operation is performed. The address segment after the split operation is marked as reallocatable in the bitmap.