Method and system for optimizing node relation in IP positioning

Through deep learning and comparison learning technologies optimizing the node relationship in IP positioning, the problem of inaccurate node relationship and difficulty recognizing reliable neighbor nodes have been solved, which significantly improves the accuracy and robustness of IP positioning.

CN119342036AActive Publication Date: 2025-01-21SHANDONG TIANHE CYBERSPACE SECURITY TECH RES INST CO LTD +1
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202411458682.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-18
Publication Date
2025-01-21
Estimated Expiration
2044-10-18

AI Technical Summary

Technical Problem

The existing IP positioning method results in insufficient positioning accuracy and robustness in the case of inaccurate node relationships and difficult to identify reliable neighbor nodes.

Method used

By introducing deep learning and contrastive learning technology, the neighbor relationship between the target node and known landmark nodes is optimized, including collecting and processing routing path data, constructing the initial IP distribution map, calculating feature similarity, optimizing node relationships and selection strategies.

Benefits of technology

It significantly improves the accuracy of IP positioning, reduces prediction errors caused by being far away from landmark points, and maintains high prediction accuracy in environments with unevenly distributed landmarks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119342036A_ABST
    Figure CN119342036A_ABST
Patent Text Reader

Abstract

The invention provides a method and system for optimizing a node relation in IP positioning, and relates to the technical field of networks, and the method comprises the steps: collecting and processing the routing path data of a target and a landmark; setting a screening rule, and screening the routing path data to obtain the information of the last hop router; constructing an initial IP distribution map by taking the last hop router as a center; obtaining feature data according to the initial IP distribution map, and calculating feature similarity to obtain an initial adjacency matrix of the similarity; according to the initial adjacency matrix of the similarity, optimizing the node relationship to obtain an optimized similarity adjacency matrix; and according to the optimized similarity adjacency matrix, determining first K neighbors and optimizing a selection strategy to obtain an optimization strategy. According to the method, deep learning and comparative learning technologies are introduced, and the neighborhood between the target node and the known landmark node is optimized, so that the prediction precision of the IP geographic position is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network technology, and in particular to a method and system for optimizing node relations in IP positioning. Background Art

[0002] With the rapid development of the Internet, IP geolocation technology plays an important role in network security, e-commerce, advertising and social media. Determining the geographic location of a device or user through an IP address not only helps identify the source of a network attack, but also provides companies with precise regional marketing and personalized services. Traditional IP positioning methods mainly rely on data mining and network measurement technology. Although they have improved positioning accuracy, they still have significant limitations.

[0003] In recent years, IP positioning methods based on machine learning and deep learning have gradually become a research focus. However, these methods still face many challenges in practical applications, which seriously affect the accuracy and robustness of positioning. First, the node relationship is inaccurate. Due to the limitations of feature learning, graph neural networks often learn unreliable node relationships. For multiple target nodes, the landmark points that affect the prediction results are usually the same, but these landmark points may not be the neighbors that are physically closest to the target. Especially in the case of uneven distribution of landmarks, distant landmarks may have too much impact on the prediction, resulting in a large deviation between the positioning results and the actual position. Secondly, it is difficult to identify reliable neighbor nodes. Existing methods find it difficult to effectively distinguish which landmark nodes are of practical value to target positioning, resulting in the model failing to make full use of key landmark nodes, thus affecting the overall positioning accuracy. Summary of the invention

[0004] The technical problem to be solved by the present invention is to provide a method and system for optimizing node relationships in IP positioning, which optimizes the neighbor relationship between target nodes and known landmark nodes by introducing deep learning and comparative learning techniques, thereby improving the prediction accuracy of IP geographic location.

[0005] In order to solve the above technical problems, the technical solution of the present invention is as follows:

[0006] In a first aspect, a method for optimizing node relationships in IP positioning is provided, the method comprising:

[0007] Collect and process routing path data for targets and landmarks;

[0008] Set filtering rules and filter the routing path data to obtain the information of the last hop router;

[0009] Construct the initial IP distribution map based on the last hop router as the center;

[0010] According to the initial IP distribution map, feature data is obtained and feature similarity is calculated to obtain an initial adjacency matrix of similarity;

[0011] According to the initial adjacency matrix of similarity, the node relationship is optimized to obtain an optimized similarity adjacency matrix;

[0012] According to the optimized similarity adjacency matrix, the first K neighbors are determined and the selection strategy is optimized to obtain the optimization strategy;

[0013] Perform location prediction based on the optimization strategy to obtain the target IP address.

[0014] Furthermore, filtering rules are set and the routing path data is filtered to obtain the information of the last hop router, including:

[0015] Get the complete routing path. For each routing path, parse each hop in the routing path and identify the last entry.

[0016] If there are multiple paths that include the last hop router, compare the delay data of the last hop in the path and select the corresponding path. If the last hop router is hidden, backtrack the path until a visible router is found and use it as the last visible router;

[0017] If all routers are not visible, then find the routers in the same C segment as the destination address to obtain the filtering rules;

[0018] According to the screening rules, the routing path data is screened to obtain the information of the last hop router.

[0019] Furthermore, based on the last hop router as the center, an initial IP distribution map is constructed, including:

[0020] Draw a network topology diagram and mark the IP address and corresponding subnet mask of each network node on the network topology diagram;

[0021] The last hop router is taken as the center and combined with the network topology map to construct the initial IP distribution map.

[0022] Furthermore, according to the initial IP distribution map, feature data is obtained and feature similarity is calculated to form an initial adjacency matrix of similarity, including:

[0023] Based on the initial IP distribution map, obtain multi-dimensional feature data, including IP, routing path and ISP information;

[0024] Through the convolutional neural network, the feature data is Perform feature fusion to obtain the data representation after feature fusion, where: Represents the features extracted by the target node in the k-th convolutional network; represents the features extracted from the landmark node in the kth layer of the convolutional network, and H represents the data after feature fusion;

[0025] According to the data after feature fusion, Calculate the similarity between the target node and the landmark node, where i and j are the indexes of the target node and the landmark node, S i,j is the similarity value between target node i and landmark node j, It is the feature data extracted by the target node in the k-th layer of the convolutional network; It is the feature data extracted by the landmark node in the k-th layer of the convolutional network;

[0026] According to the similarity between the target node and the landmark node, an initial adjacency matrix of similarity is formed.

[0027] Furthermore, according to the initial adjacency matrix of similarity, the node relationship is optimized to obtain an optimized similarity adjacency matrix, including:

[0028] By g i =-log(-log(u i )) Get the noise matrix, where g i is a random sample drawn from a uniform distribution in the interval (0, 1), g i is Gumbel noise;

[0029] According to the noise matrix, The initial adjacency matrix is ​​logarithmically adjusted to obtain the optimized landmark feature similarity, where is the adjusted adjacency matrix, τ is the temperature parameter, β is the weighting coefficient, g i is the Gumbel noise, and A is the optimized landmark feature similarity.

[0030] Furthermore, according to the optimized similarity adjacency matrix, the first K neighbors are determined and the selection strategy is optimized to obtain an optimization strategy, including:

[0031] According to the optimized similarity adjacency matrix, a strategy for selecting the K value is designed, including selecting all the remaining nodes as neighbors if the total number of landmark nodes is less than 5; selecting 40% of the nodes as neighbors if the number of nodes is between 5 and 30; and selecting 10% of the nodes as neighbors if the number of nodes is greater than 30.

[0032] According to the strategy of selecting K value, a Mask matrix M is constructed, including M ij =1, it means that node j is a neighbor of node i. If M ij= 0, it means that node j is not a neighbor of node i, where element M ij Indicates whether node j is a neighbor of node i;

[0033] According to the relationship in the Mask matrix, To obtain the comprehensive loss function, where L all is the contrast loss and mean absolute error loss, α is an adjustable hyperparameter with a value range between 0 and 1; P(i) is the set of neighbor nodes of node i, I is the set of landmark nodes to be processed; Y T is the true value of the target variable, is the predicted output value of the target variable, n is the total number of samples used to calculate the loss, and f i and f p is the feature vector of node i and neighbor p, where p is the neighbor of node i, τ is the temperature parameter, and i is the index of the node;

[0034] The comprehensive loss function is iteratively optimized to obtain the optimization strategy.

[0035] Furthermore, the comprehensive loss function is iteratively optimized to obtain an optimization strategy, including:

[0036] By A (t+1) =min A L all (A (t) ,θ) minimizes the loss function of all nodes and neighbor relationships to update the next iteration value of the currently represented node relationship, where A (t) is the node relationship currently represented, L all (A (t) ,θ) is the comprehensive loss function of the current adjacency matrix, t is the time, and θ is the embedding representation of the node or edge;

[0037] By R=A (t+1) -A (t) Calculate the difference between the current iteration and the previous iteration. If R<∈, stop the iteration. R is the difference, ∈ is the set difference, A (t) is the node relationship currently represented, A (t+1) It is the node relationship of the next moment.

[0038] In a second aspect, a system for optimizing node relationships in IP positioning includes:

[0039] The acquisition module is used to collect and process the routing path data of the target and the landmark; set the screening rules and screen the routing path data to obtain the information of the last hop router; and construct the initial IP distribution map based on the public last hop router screened out from the initial IP distribution map as the center;

[0040] The processing module is used to obtain feature data and calculate feature similarity according to the initial IP distribution map to obtain an initial adjacency matrix of similarity; optimize node relationships according to the initial adjacency matrix of similarity to obtain an optimized similarity adjacency matrix; determine the first K neighbors and optimize the selection strategy according to the optimized similarity adjacency matrix to obtain an optimization strategy; perform location prediction according to the optimization strategy to obtain a target IP address.

[0041] According to a third aspect, a computing device includes:

[0042] one or more processors;

[0043] The storage device is used to store one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method described.

[0044] In a fourth aspect, a computer-readable storage medium stores a program, and when the program is executed by a processor, the method described is implemented.

[0045] The above solution of the present invention includes at least the following beneficial effects:

[0046] By optimizing node relationships through multiple iterations, the neighbor relationship between landmarks and targets can be accurately captured, and the prediction error caused by points far away from landmarks can be effectively reduced, thereby significantly improving the accuracy of IP positioning. The dynamic adjustment of neighbor relationship strategy in the method, combined with the optimization means of reparameterization and loss function minimization, makes the neighbor selection no longer rely solely on the initial features, but can be dynamically adjusted according to the actual optimized node relationship. By setting reasonable convergence conditions, the iteration can be automatically stopped when the change amplitude of the node relationship matrix is ​​less than the set threshold, which not only ensures the high efficiency of model optimization, but also avoids unnecessary iterative calculations. By introducing multi-dimensional feature extraction and attention mechanism, it can not only handle the situation of evenly distributed landmarks, but also maintain a high prediction accuracy in complex environments with uneven landmark distribution. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 It is a flow chart of a method for optimizing node relationships in IP positioning provided by an embodiment of the present invention.

[0048] Figure 2 It is a schematic diagram of an optimization system for node relationships in IP positioning provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0049] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in a form and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0050] like Figure 1 As shown, an embodiment of the present invention proposes a method for optimizing node relationships in IP positioning, and the method comprises the following steps:

[0051] Step 11, collecting and processing routing path data of targets and landmarks;

[0052] Step 12, set the screening rules and screen the routing path data to obtain the information of the last hop router;

[0053] Step 13, constructing an initial IP distribution map based on the last hop router as the center;

[0054] Step 14, according to the initial IP distribution map, obtain feature data and calculate feature similarity to obtain an initial adjacency matrix of similarity;

[0055] Step 15, optimizing the node relationship according to the initial similarity adjacency matrix to obtain an optimized similarity adjacency matrix;

[0056] Step 16, according to the optimized similarity adjacency matrix, determine the first K neighbors and optimize the selection strategy to obtain an optimization strategy;

[0057] Step 17, perform location prediction according to the optimization strategy to obtain the target IP address.

[0058] In an embodiment of the present invention, by collecting and processing the routing path data of the target and landmark, more comprehensive network information can be obtained, and by setting screening rules and screening the routing path data, it is possible to ensure that the data used is accurate and effective. An initial IP distribution map is constructed with the last hop router as the center, which helps to quickly locate the network area where the target IP address is located. By calculating the feature similarity and constructing the initial adjacency matrix, the relationship between the nodes can be quantified. The similarity adjacency matrix obtained after optimizing the node relationship can more accurately reflect the actual connection between the nodes, thereby improving the positioning efficiency. According to the optimized similarity adjacency matrix, the first K neighbors are determined, and the selection strategy is optimized, so that the refined management of network nodes can be achieved, and the accuracy of the positioning results can be ensured; the optimization strategy is iteratively optimized and the position is predicted, so that the positioning method can be continuously adjusted and improved to adapt to the dynamic changes of the network environment. Through accurate IP positioning, abnormal situations and potential threats in the network can be discovered and handled in a timely manner, thereby enhancing the security and stability of the network.

[0059] In a preferred embodiment of the present invention, the above step 11 may include:

[0060] Step 111, determine the located IP address or network node, and execute the route tracking command on the target and the landmark respectively to obtain the route path data;

[0061] Step 112: preprocess the routing path data to obtain preprocessed routing path data.

[0062] In the embodiment of the present invention, through preprocessing, repeated, erroneous or inconsistent routing path data can be removed, thereby improving the accuracy and reliability of the data. The preprocessing process standardizes and formats the data, and the routing path data is more neat and orderly. Accurate routing path data is the basis of IP positioning. Through preprocessing, the accuracy of the data can be ensured, thereby improving the accuracy and reliability of IP positioning. In the preprocessing process, the data can also be screened and filtered to retain information useful for positioning, eliminate interference factors, and further improve the positioning accuracy. Through the analysis of the routing path data, bottlenecks and delay nodes in the network can be found, thereby optimizing the routing strategy and improving the performance and efficiency of the network. The preprocessed data can more easily reveal the characteristics and laws of the network structure and provide strong support for network optimization. Accurate routing path data helps to timely discover abnormal traffic and potential threats in the network, thereby enhancing the security monitoring capability of the network. Through preprocessing and analysis, suspicious routing paths or nodes can be identified, providing important clues and basis for network security protection. The preprocessed routing path data can provide rich materials and cases for network research and promote the development of network science.

[0063] In a specific embodiment of the present invention, the target IP address or network node to be located is determined, and the landmark node is a network node with a known location. A plurality of landmark nodes are selected and distributed at different locations of the network. The route tracking command is executed for the target IP address or network node, and each landmark node, respectively, and the route path data returned by each route tracking command is recorded and collected. The route path data is checked, and duplicate, invalid or erroneous records are removed, and the route path data from different sources are unified into the same format. Key information is extracted from the route path data, such as the source IP address, the target IP address, the IP address of each hop router, the number of hops, etc. Redundant information in the route path data is removed, such as duplicate router IP addresses and unnecessary comments.

[0064] In a preferred embodiment of the present invention, the above step 12 may include:

[0065] Step 121, obtaining a complete routing path, for each routing path, parsing each hop in the routing path, and identifying the last entry;

[0066] Step 122, if there are multiple paths including the last hop router, compare the delay data of the last hop in the path and select the corresponding path. If the last hop router is hidden, trace back the path until a visible router is found and use it as the last visible router;

[0067] Step 123, if all routers are not visible, then search for routers in the same C segment as the destination address to obtain a filtering rule;

[0068] Step 124, filtering the routing path data according to the filtering rule to obtain the information of the last hop router.

[0069] In an embodiment of the present invention, by parsing each hop in the routing path and identifying the last entry, the last router that the data packet passes through before reaching the target address can be accurately determined. When there are multiple paths containing the last hop router, by comparing the delay data of the last hop in the path, the path with the smallest delay or the best performance can be selected. In the case where all routers are invisible, by finding the router in the same C segment as the destination address, effective screening rules can be formulated, which helps to quickly locate the target address in a complex or dynamic network environment. According to the screening rules, the routing path data is screened, and irrelevant or redundant data can be quickly excluded, the efficiency and accuracy of data processing are improved, and it is helpful to shorten the time of IP positioning and reduce the computing cost. Through the in-depth analysis and processing of the routing path data, the network structure and behavior can be better understood.

[0070] In a specific embodiment of the present invention, a path containing complete routing information is obtained from the preprocessed routing path data, and the path includes all hops from the source node to the target node and their corresponding router IP addresses. The path data is split into multiple parts, each part represents a router hop number and its IP address, and the information in the path is read hop by hop to identify the last entry in the routing path; if there are multiple paths containing the last hop router, the delay data of the last hop in these paths are compared, and according to the delay data, the path with the smallest delay is selected as the optimal path; if the last hop router is hidden, the path is backtracked, and hop by hop is checked until a visible router is found, and the IP address and other relevant information of the last visible router are recorded. If all routers are invisible in the routing path, find the router in the same C segment as the destination address, and the same C segment indicates the same network prefix; according to the routers in the same C segment found, a screening rule is formulated. Using the screening rule, each hop in the path of the preprocessed routing path data is checked to see if it meets the screening conditions. From the filtered routing path data, the information of the last hop router is obtained, including the IP address, hop number, and delay of the router.

[0071] In a preferred embodiment of the present invention, the above step 13 may include:

[0072] Step 131, draw a network topology diagram, and mark the IP address and corresponding subnet mask of each network node on the network topology diagram;

[0073] Step 132, combining the last hop router as the center with the network topology map to construct an initial IP distribution map.

[0074] In an embodiment of the present invention, by drawing a network topology diagram, the connection relationship between each node in the network can be intuitively displayed, which is helpful for understanding the overall architecture of the network. The IP address and subnet mask of each network node are marked on the topology diagram, so that the network administrator can quickly locate and manage each device in the network, thereby improving maintenance efficiency. Combining the last-hop router as the center with the network topology diagram can clearly show the final convergence point of data traffic in the network, which helps to optimize network traffic management. The initial IP distribution map can more easily monitor the data traffic and node status in the network, and promptly detect and handle abnormal situations. Combining the topology map with the IP distribution map can make it easier to identify and respond to network security threats.

[0075] In a specific embodiment of the present invention, detailed information of the collected network is determined, including the number of network nodes, the connection relationship between them, the IP address of each node, and the corresponding subnet mask. A topological structure diagram of the network is drawn using a drawing tool based on the collected network information, and the IP address and the corresponding subnet mask are marked for each network node on the network topology diagram. The IP address of the last hop router and its position in the network topology diagram are determined. With the last hop router as the center, an initial IP distribution diagram is constructed in combination with the network topology diagram.

[0076] In a preferred embodiment of the present invention, the above step 14 may include:

[0077] Step 141, obtaining multi-dimensional feature data, including IP, routing path and ISP information, according to the initial IP distribution map;

[0078] Step 142, the feature data is processed by a convolutional neural network. Perform feature fusion to obtain the data representation after feature fusion, where: Represents the features extracted by the target node in the k-th convolutional network; represents the features extracted from the landmark node in the kth layer of the convolutional network, and H represents the data after feature fusion;

[0079] Step 143, based on the feature fused data, Calculate the similarity between the target node and the landmark node, where i and j are the indexes of the target node and the landmark node, S i,j is the similarity value between target node i and landmark node j, It is the feature data extracted by the target node in the k-th layer of the convolutional network; It is the feature data extracted by the landmark node in the k-th layer of the convolutional network;

[0080] Step 144 , forming an initial adjacency matrix of similarity based on the similarity between the target node and the landmark node.

[0081] In an embodiment of the present invention, by collecting multi-dimensional feature data including IP, routing path and ISP information, the characteristics and behaviors of the network can be understood more comprehensively. The multi-dimensional feature data can provide richer information and help to more accurately analyze various problems in the network; by processing and fusing the multi-dimensional feature data using a convolutional neural network, deeper feature data can be extracted, which helps to reveal hidden patterns and associations in the network. The data after feature fusion has a stronger representation ability and can better capture the complex relationships and dynamic changes in the network. By calculating the similarity between the target node and the landmark node, the closeness of the relationship between them can be quantified. Similarity calculation is the basis of tasks such as node classification and clustering, which helps to more accurately divide the node groups in the network. The initial adjacency matrix of similarity is a key step in constructing a network map, which helps to intuitively display the node relationships and structural characteristics in the network.

[0082] In a specific embodiment of the present invention, the initial IP distribution map is analyzed, each network node and its IP address in the map are identified, the ISPs to which different network nodes belong are identified, and for each network node, its IP address, routing path and ISP information are collected. The collected multi-dimensional feature data is converted into the input format for convolutional neural network processing, and a convolutional neural network architecture is designed, which includes multiple convolutional layers, pooling layers and fully connected layers; the feature data of the target node and the landmark node are respectively input into the convolutional neural network, and in each layer of the network, the features are extracted by convolution operations, and the feature dimensions are reduced by pooling operations. In the last few layers of the network, the features of the target node and the landmark node are fused through the fully connected layer to obtain the data after feature fusion, and the data after feature fusion is obtained from the output layer of the convolutional neural network. According to the characteristics of the data after feature fusion, the similarity value between them is calculated; and according to the calculated similarity value, an initial adjacency matrix is ​​constructed.

[0083] In a preferred embodiment of the present invention, the above step 15, optimizing the node relationship according to the initial adjacency matrix of similarity to obtain an optimized similarity adjacency matrix, includes:

[0084] Step 151, by g i =-log(-log(u i )) Get the noise matrix, where g i is a random sample drawn from a uniform distribution in the interval (0, 1), gi is Gumbel noise;

[0085] Step 152, according to the noise matrix, by The initial adjacency matrix is ​​logarithmically adjusted to obtain the optimized landmark feature similarity, where is the adjusted adjacency matrix, τ is the temperature parameter, β is the weighting coefficient, gi is the Gumbel noise, and A is the optimized landmark feature similarity.

[0086] In an embodiment of the present invention, the noise matrix is ​​generated by Gumbel noise, which helps to break the inherent patterns and biases that may exist in the initial adjacency matrix, making the optimization process more flexible and diversified. The introduction of the noise matrix increases the robustness of the system, making the optimization process less sensitive to changes in initial conditions. By logarithmically adjusting the initial adjacency matrix and combining the noise matrix, temperature parameters and weighting coefficients, a more accurate and reliable landmark feature similarity can be obtained, which helps to better capture the relationship between landmark nodes. The optimized landmark feature similarity can improve the performance of various network analysis tasks based on the similarity, such as node classification and link prediction. Through logarithmic adjustment and the introduction of the noise matrix, the optimized landmark feature similarity can be made more interpretable. The introduction of temperature parameters and weighting coefficients makes the optimization process more flexible.

[0087] In a specific embodiment of the present invention, the dimension of the noise matrix is ​​set to be the same as that of the initial adjacency matrix, that is, the number of rows and columns corresponds to the number of target nodes and landmark nodes, respectively. For each element in the noise matrix, a random sample is drawn from a uniform distribution in the interval (0,1), and a Gumbel distribution transformation is applied to each random sample to generate Gumbel noise, and the generated Gumbel noise is filled into the corresponding position of the noise matrix to obtain a complete noise matrix. A temperature parameter is set to control the hyperparameter of the smoothness of the adjustment process, and a weighting coefficient is set to balance the influence of the initial adjacency matrix and the noise matrix in the adjustment process. For each element in the initial adjacency matrix, its logarithmic adjustment item is calculated, and each element in the initial adjacency matrix is ​​added to its corresponding logarithmic adjustment item to obtain an adjusted adjacency matrix. According to the adjusted adjacency matrix, the optimized landmark feature similarity is calculated.

[0088] In a preferred embodiment of the present invention, the above step 16, according to the optimized similarity adjacency matrix, determines the first K neighbors and optimizes the selection strategy to obtain an optimization strategy, including:

[0089] Step 161, designing a strategy for selecting the K value according to the optimized similarity adjacency matrix, including selecting all remaining nodes as neighbors if the total number of landmark nodes is less than 5; selecting 40% of the nodes as neighbors if the number of nodes is between 5 and 30; and selecting 10% of the nodes as neighbors if the number of nodes is greater than 30.

[0090] Step 162, based on the strategy of selecting the K value, a Mask matrix M is constructed, including M ij =1, it means that node j is a neighbor of node i. If M ij= 0, it means that node j is not a neighbor of node i, where element M ij Indicates whether node j is a neighbor of node i;

[0091] Step 163, according to the relationship in the Mask matrix, To obtain the comprehensive loss function, where L all is the contrast loss and mean absolute error loss, α is an adjustable hyperparameter with a value range between 0 and 1; P(i) is the set of neighbor nodes of node i, I is the set of landmark nodes to be processed; Y T is the true value of the target variable, is the predicted output value of the target variable, n is the total number of samples used to calculate the loss, and f i and f p is the feature vector of node i and neighbor p, where p is the neighbor of node i, τ is the temperature parameter, and i is the index of the node;

[0092] Step 164, iteratively optimize the comprehensive loss function to obtain an optimization strategy.

[0093] In an embodiment of the present invention, the K value is dynamically adjusted according to the total number of landmark nodes, so that the selection of neighbor nodes is more flexible and adaptive, which helps to find the appropriate number of neighbor nodes in networks of different sizes, thereby maintaining the stability of the optimization effect. By setting different K value strategies, a balance can be achieved between performance and efficiency; the Mask matrix clearly represents the neighbor relationship between nodes, which helps to ensure the correctness and effectiveness of the loss function. In large-scale networks, the Mask matrix can use a sparse representation method, which helps to improve the scalability and practicality of the algorithm, and helps to consider the similarity of nodes and prediction accuracy during the optimization process; by introducing adjustable hyperparameters, the weights of each item in the loss function can be adjusted according to specific application scenarios and needs; by iteratively optimizing the comprehensive loss function, the parameters can be continuously adjusted, which helps to obtain more accurate and reliable landmark feature similarity and prediction results.

[0094] In a specific embodiment of the present invention, the optimized similarity adjacency matrix traverses all landmark nodes. For each node, if the total number of landmark nodes is less than 5 according to the rows of its similarity adjacency matrix, all other nodes are selected as neighbors; if the number of nodes is between 5 and 30, 40% of the nodes are selected as neighbors; if the number of nodes is greater than 30, 10% of the nodes are selected as neighbors, and a K value is obtained. A Mask matrix of the same dimension as the optimized similarity adjacency matrix is ​​created, and all elements are initialized to 0. For each node, according to its similarity value and the corresponding K value, K nodes with the highest similarity are selected as neighbors. In the Mask matrix M, the position between node i and its selected neighbor node is set to 1, and the remaining positions are kept as 0 to obtain the Mask matrix M. According to the Mask matrix, the comprehensive loss is calculated, and the comprehensive loss function is iteratively optimized.

[0095] In a preferred embodiment of the present invention, the above step 17, iteratively optimizing the comprehensive loss function to obtain an optimization strategy, includes:

[0096] Step 171, pass A (t+1) =min A L all (A (t) ,θ) minimizes the loss function of all nodes and neighbor relationships to update the next iteration value of the currently represented node relationship, where A (t) is the node relationship currently represented, L all (A (t) ,θ) is the comprehensive loss function of the current adjacency matrix, t is the time, and θ is the embedding representation of the node or edge;

[0097] Step 172, by R=A (t+1) -A (t) Calculate the difference between the current iteration and the previous iteration. If R<∈, stop the iteration. R is the difference, ∈ is the set difference, A (t) is the node relationship currently represented, A (t+1) It is the node relationship of the next moment.

[0098] In an embodiment of the present invention, by minimizing the loss function of all nodes and neighbor relationships, the node relationship currently represented can be continuously updated, which helps to capture the real associations and interactions between nodes. The optimized node relationship representation can improve the performance of various network analysis tasks based on the representation. By continuously iteratively updating the node relationship representation, convergence can be promoted. During the iteration process, the loss function value will gradually decrease. By calculating the difference between the current iteration and the previous iteration, and judging whether it is less than the set difference threshold, computing resources and time costs can be saved. Stopping the iteration at this time can ensure stability and avoid overfitting or underfitting. By judging whether the iteration is stopped, an explainable iterative process can be provided, which helps network administrators or researchers understand the optimization process and convergence of the model.

[0099] In a specific embodiment of the present invention, the loss function of all nodes and neighbor relationships is minimized by a formula, and the Adam optimization algorithm is used to update the next iteration value of the currently represented node relationship; a difference threshold is set according to the currently represented node relationship and the node relationship at the next moment, and the difference R between the current iteration and the previous iteration is calculated. If the difference < the difference threshold, it means that the difference between the current iteration and the previous iteration is small enough, and the iteration can be stopped, otherwise, continue to the next round of iteration.

[0100] In a preferred embodiment of the present invention, the above step 18, performing location prediction according to the optimization strategy to obtain the target IP address, may include:

[0101] According to the optimization strategy, IP address information and node location information are obtained to establish a mapping relationship from location to IP address.

[0102] The target IP address is obtained through the established mapping relationship.

[0103] In the embodiment of the present invention, through the mapping relationship, the IP address of a specific location can be quickly located, which is convenient for network configuration, monitoring and troubleshooting. When a network event occurs, the affected location and node can be quickly determined, accelerating the response and recovery process. The mapping relationship helps to understand the resource usage of each location in the network. Through the mapping relationship, it is easier to identify abnormal or unauthorized IP address access and take security measures in time. The mapping relationship can ensure that users can access the nearest server or node, reduce delays and improve response speed. By analyzing the data in the mapping relationship, bottlenecks and potential problems in the network can be discovered.

[0104] In a specific embodiment of the present invention, according to the optimization strategy, IP address information and node location information are obtained, wherein the network topology information includes nodes, edges and the relationship between them; the node attribute information includes the node location information and IP address information; the network topology information is parsed, the node and edge information is extracted, and the node attribute information is sorted to ensure that each node has a unique location identifier and IP address information. For each node with a known IP address, according to the node relationship obtained in the optimization strategy, the unknown IP address node closely related to the known IP address node is identified, and the mapping relationship is established. Multiple nodes may be located at the same location and share the same IP address, and a mapping relationship is established. The corresponding IP address is searched in the mapping table according to the target location information. If the mapping table returns multiple IP addresses, further logic is required to select the correct IP address. If the IP address of the target location is not found in the mapping table, it may be necessary to return an error or execute a fallback strategy. The target IP address is obtained based on the score of the matching degree between the IP address found in the mapping relationship and the target location.

[0105] like Figure 2 As shown, an embodiment of the present invention further provides a system 20 for optimizing node relationships in IP positioning, comprising:

[0106] The acquisition module 21 is used to collect and process the routing path data of the target and the landmark; set the screening rules and screen the routing path data to obtain the information of the last hop router; and construct the initial IP distribution map based on the public last hop router screened out from the initial IP distribution map as the center;

[0107] The processing module 22 is used to obtain feature data and calculate feature similarity based on the initial IP distribution map to obtain an initial adjacency matrix of similarity; optimize node relationships based on the initial adjacency matrix of similarity to obtain an optimized similarity adjacency matrix; determine the top K neighbors and optimize the selection strategy based on the optimized similarity adjacency matrix to obtain an optimized strategy; perform location prediction based on the optimized strategy to obtain a target IP address.

[0108] It should be noted that the system is a system corresponding to the above method, and all implementation methods in the above method embodiment are applicable to this embodiment and can achieve the same technical effect.

[0109] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A method for optimizing node relationships in IP positioning, characterized in that: The method comprises: Collect and process routing path data for targets and landmarks; Set filtering rules and filter the routing path data to obtain the information of the last hop router; Construct the initial IP distribution map based on the last hop router as the center; According to the initial IP distribution map, feature data is obtained and feature similarity is calculated to obtain an initial adjacency matrix of similarity; According to the initial adjacency matrix of similarity, the node relationship is optimized to obtain an optimized similarity adjacency matrix; According to the optimized similarity adjacency matrix, the first K neighbors are determined and the selection strategy is optimized to obtain the optimization strategy; Perform location prediction based on the optimization strategy to obtain the target IP address.

2. The method for optimizing node relationships in IP positioning according to claim 1, characterized in that: Set filtering rules and filter the routing path data to obtain the information of the last hop router, including: Get the complete routing path. For each routing path, parse each hop in the routing path and identify the last entry. If there are multiple paths that include the last hop router, compare the delay data of the last hop in the path and select the corresponding path. If the last hop router is hidden, backtrack the path until a visible router is found and use it as the last visible router; If all routers are not visible, then find the routers in the same C segment as the destination address to obtain the filtering rules; According to the screening rules, the routing path data is screened to obtain the information of the last hop router.

3. The method for optimizing node relationships in IP location according to claim 2, characterized in that: Based on the last hop router as the center, build the initial IP distribution map, including: Draw a network topology diagram and mark the IP address and corresponding subnet mask of each network node on the network topology diagram; The last hop router is taken as the center and combined with the network topology diagram to construct an initial IP distribution map.

4. The method for optimizing node relationships in IP positioning according to claim 3, characterized in that: According to the initial IP distribution map, feature data is obtained and feature similarity is calculated to form an initial adjacency matrix of similarity, including: Based on the initial IP distribution map, obtain multi-dimensional feature data, including IP, routing path and ISP information; Through the convolutional neural network, the feature data is Perform feature fusion to obtain the data representation after feature fusion, where: Represents the features extracted by the target node in the k-th layer of the convolutional network; represents the features extracted from the landmark node in the kth layer of the convolutional network, and H represents the data after feature fusion; According to the data after feature fusion, Calculate the similarity between the target node and the landmark node, where i and j are the indexes of the target node and the landmark node, S i,j is the similarity value between target node i and landmark node j, It is the feature data extracted by the target node in the k-th layer of the convolutional network; It is the feature data extracted by the landmark node in the k-th layer of the convolutional network; According to the similarity between the target node and the landmark node, an initial adjacency matrix of similarity is formed.

5. The method for optimizing node relationships in IP positioning according to claim 4, characterized in that: According to the initial adjacency matrix of similarity, the node relationship is optimized to obtain the optimized similarity adjacency matrix, including: By g i =-log(-log(u i )) Get the noise matrix, where g i is a random sample drawn from a uniform distribution in the interval (0, 1), g i is Gumbel noise; According to the noise matrix, The initial adjacency matrix is ​​logarithmically adjusted to obtain the optimized landmark feature similarity, where is the adjusted adjacency matrix, τ is the temperature parameter, β is the weighting coefficient, g i is the Gumbel noise, and A is the optimized landmark feature similarity.

6. The method for optimizing node relationships in IP positioning according to claim 5, characterized in that: According to the optimized similarity adjacency matrix, the first K neighbors are determined and the selection strategy is optimized to obtain the optimization strategy, including: According to the optimized similarity adjacency matrix, a strategy for selecting the K value is designed, including selecting all the remaining nodes as neighbors if the total number of landmark nodes is less than 5; selecting 40% of the nodes as neighbors if the number of nodes is between 5 and 30; and selecting 10% of the nodes as neighbors if the number of nodes is greater than 30. According to the strategy of selecting K value, a Mask matrix M is constructed, including M ij =1, it means that node j is a neighbor of node i. If M ij = 0, it means that node j is not a neighbor of node i, where element M ij Indicates whether node j is a neighbor of node i; According to the relationship in the Mask matrix, To obtain the comprehensive loss function, where L all is the contrast loss and mean absolute error loss, α is an adjustable hyperparameter with a value range between 0 and 1; P(i) is the set of neighbor nodes of node i, I is the set of landmark nodes to be processed; Y T is the true value of the target variable, is the predicted output value of the target variable, n is the total number of samples used to calculate the loss, and f i and f p is the feature vector of node i and neighbor p, where p is the neighbor of node i, τ is the temperature parameter, and i is the index of the node; The comprehensive loss function is iteratively optimized to obtain the optimization strategy.

7. The method for optimizing node relationships in IP positioning according to claim 6, characterized in that: The comprehensive loss function is iteratively optimized to obtain the optimization strategy, including: By A (t+1) =min A L all (A (t) ,θ) minimizes the loss function of all nodes and neighbor relationships to update the next iteration value of the currently represented node relationship, where A (t) is the node relationship currently represented, L all (A (t) ,θ) is the comprehensive loss function of the current adjacency matrix, t is the time, and θ is the embedding representation of the node or edge; By R=A (t+1) -A (t) Calculate the difference between the current iteration and the previous iteration. If R<∈, stop iterating. R is the difference, ∈ is the set difference, and A (t) is the node relationship currently represented, A (t+1) It is the node relationship of the next moment.

8. A system for optimizing node relationships in IP positioning, characterized in that: include: The acquisition module is used to collect and process the routing path data of the target and landmarks; Set filtering rules and filter the routing path data to obtain the information of the last hop router; construct the initial IP distribution map based on the public last hop router filtered out from the initial IP distribution map as the center; A processing module, used to obtain feature data according to the initial IP distribution map, and calculate feature similarity to obtain an initial adjacency matrix of similarity; According to the initial adjacency matrix of similarity, the node relationship is optimized to obtain an optimized similarity adjacency matrix; According to the optimized similarity adjacency matrix, the first K neighbors are determined and the selection strategy is optimized to obtain the optimization strategy; Perform location prediction based on the optimization strategy to obtain the target IP address.

9. A computing device, characterized in that include: one or more processors; A storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the method as claimed in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program, which, when executed by a processor, implements the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • IP address geographic position determination method and system

    CN103259877A

  • IP positioning method based on routing hops

    CN110474843A

  • Network topology boundary routing IP identification algorithm oriented to IP positioning

    CN110912756A

  • IP positioning method based on router error training

    CN110995885A

  • Street-level IP positioning method based on IP2vec model

    CN115102925A