Route tracking method, device, equipment and storage medium

By pre-constructing the port number conflict table and adjusting the port number in the route tracking, the detection failure problem caused by the occupation of the port number in the route tracking is solved, and more accurate reflection of network status and operation and maintenance misunderstandings are achieved.

CN114513455BActive Publication Date: 2025-02-25ZTE CORP
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011288649.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-17
Publication Date
2025-02-25
Estimated Expiration
2040-11-17

AI Technical Summary

Technical Problem

The existing route tracking method is easily occupied by other applications when selecting the port number, resulting in detection failure, misleading operation and maintenance personnel to believe that the network failure is actually normal.

Method used

By pre-constructing the port number conflict table, record the port numbers occupied by other applications, and determine the appropriate destination port number based on the initial port number and conflict table during routing tracing to avoid the occupied port number.

Benefits of technology

It effectively avoids the problem of failure of routing tracking operations due to port number occupied, ensures the accuracy of tracking results, and avoids misleading to operation and maintenance personnel.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114513455B_ABST
    Figure CN114513455B_ABST
Patent Text Reader

Abstract

The embodiment of the present application relates to the field of communication, and discloses a route tracking method, device, equipment and storage medium. In the present application, by pre-building a port number conflict table, and recording the port numbers occupied by other applications in the table, that is, the port numbers that the route tracking program cannot use, when the route tracking program is used for route tracking, the pre-assigned initial port number is adjusted according to the unavailable port number recorded in the port number conflict table, and the destination port number based on the route tracking is determined, thereby avoiding the port number occupied by other applications, excluding the reason that the route tracking operation fails because the port number is occupied, and then ensuring that the tracking result of the destination end to be accessed according to the determined destination port number and the destination IP address obtained from the route tracking command can accurately reflect the current network status and avoid misleading the operation and maintenance personnel.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of communications, and in particular to a route tracking method, apparatus, device and storage medium. Background Art

[0002] Traceroute is a technology used to track forwarding routes in a network and is often used to diagnose network failures. Currently, when using Traceroute to implement route tracking, port numbers greater than 30000 are generally used to send probe messages to avoid conflicts with port numbers listened to by other applications as much as possible.

[0003] However, with the development of network technology, these large port numbers are constantly occupied by other applications. For example, port number 33435 is occupied by the mtrace (Traceroute Facility for IP Multicast) application. This results in that when traceroute uses the port number occupied by other applications to send detection messages, the destination will not reply to the source with an ICMP (Internet Control Message Protocol) destination unreachable message, which in turn causes traceroute detection failure, and the user thinks that the current network is faulty, while in fact the network is normal, thus misleading the operation and maintenance personnel.

[0004] Therefore, how to choose a suitable port number needs to be solved urgently. Summary of the invention

[0005] The purpose of the embodiments of the present application is to provide a route tracking method, device, equipment and storage medium, aiming to solve the above-mentioned technical problems.

[0006] To solve the above technical problems, an embodiment of the present application provides a route tracking method, including:

[0007] When performing route tracing using a route tracing program, a destination IP address of a destination to be traced is obtained from a route tracing command, and an initial port number for accessing the destination is allocated;

[0008] Determining a destination port number according to the initial port number and a pre-constructed port number conflict table, wherein the port number conflict table is used to manage unavailable port numbers occupied by applications other than the route tracking program;

[0009] The destination end is tracked through the destination IP address and the destination port number.

[0010] To achieve the above purpose, the present application also provides a route tracking device, including:

[0011] The destination IP acquisition module is used to obtain the destination IP address of the destination to be tracked from the route tracking command when the route tracking program is used for route tracking;

[0012] An initial port number allocation module, used to allocate an initial port number for accessing the destination end;

[0013] a destination port number determination module, used to determine the destination port number according to the initial port number and a pre-constructed port number conflict table, wherein the port number conflict table is used to manage unavailable port numbers occupied by application programs other than the route tracking program;

[0014] The tracking module is used to track the destination end through the destination IP address and the destination port number.

[0015] To achieve the above purpose, the embodiment of the present application further provides a route tracking device, including:

[0016] a memory communicatively connected to the at least one processor; wherein,

[0017] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the route tracking method described above.

[0018] To achieve the above object, the embodiment of the present application further provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the above-mentioned route tracking method is implemented.

[0019] The route tracking method, apparatus, device and storage medium proposed in the present application pre-build a port number conflict table and record the port numbers occupied by other applications, that is, the port numbers that cannot be used by the route tracking program, so that when the route tracking program is used to perform route tracking, the pre-allocated initial port number is adjusted according to the unavailable port number recorded in the port number conflict table to determine the destination port number based on which the route tracking is based, thereby avoiding the port number occupied by other applications and eliminating the reason that the route tracking operation fails because the port number is occupied, thereby ensuring that the tracking result of the destination end to be visited based on the determined destination port number and the destination IP address obtained from the route tracking command can accurately reflect the current network status and avoid misleading the operation and maintenance personnel. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] One or more embodiments are exemplarily described by the pictures in the corresponding drawings, and these exemplary descriptions do not constitute limitations on the embodiments.

[0021] Figure 1 is a flow chart of the route tracking method provided by the first embodiment of the present application;

[0022] Figure 2 This is a specific implementation flowchart of step 103 in the route tracking method provided in the first embodiment of the present application;

[0023] Figure 3 is a flow chart of a route tracking method provided in the second embodiment of the present application;

[0024] Figure 4 is a schematic diagram of the structure of a route tracking device provided in the third embodiment of the present application;

[0025] Figure 5 It is a structural diagram of the route tracking device provided in the fourth embodiment of the present application. DETAILED DESCRIPTION

[0026] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the embodiments of the present application will be described in detail below in conjunction with the accompanying drawings. However, it will be appreciated by those skilled in the art that in the present application, many technical details are proposed in order to enable the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical scheme claimed in the present application can also be implemented. The division of the following embodiments is for the convenience of description, and the specific implementation of the present application should not be construed as any limitation, and the various embodiments can be combined and referenced with each other under the premise of no contradiction.

[0027] The first embodiment of the present application relates to a route tracking method, which pre-builds a port number conflict table and records the port numbers occupied by other applications, that is, the port numbers that cannot be used by the route tracking program, so that when the route tracking program is used to perform route tracking, the pre-allocated initial port number is adjusted according to the unavailable port number recorded in the port number conflict table to determine the destination port number used for route tracking, thereby avoiding the port number occupied by other applications and eliminating the reason that the route tracking operation fails because the port number is occupied, thereby ensuring that the tracking result of the destination to be visited based on the determined destination port number and the destination IP address obtained from the route tracking command can accurately reflect the current network status and avoid misleading the operation and maintenance personnel.

[0028] The implementation details of the route tracking method of this embodiment are described below. The following content is only provided for the convenience of understanding and is not necessary for implementing this solution.

[0029] The route tracking method provided in this embodiment is specifically applied to any terminal device that can execute the method, such as a client or a server, etc., which will not be listed one by one here, and this embodiment does not limit this.

[0030] The specific process of this embodiment is as follows Figure 1 As shown, the specific steps include:

[0031] Step 101, when performing route tracing using a route tracing program, obtain the destination IP address of the destination to be traced from the route tracing command, and allocate an initial port number for accessing the destination.

[0032] Specifically, the route tracking program mentioned in this embodiment is what is commonly called Traceroute.

[0033] In order to facilitate understanding of the route tracing method provided in this embodiment, the tracing principle of Traceroute is first described below, specifically:

[0034] At the source end (source host or router), first send a UDP probe message with IP (Internet Protocol) TTL (Time To Live) equal to 1 through a UDP (User Datagram Protocol) major port number. When the UDP probe message is forwarded to the first-hop router, since the IP TTL is exhausted, it will reply to the source end with an ICMP (Internet Control Message Protocol) timeout message, so that the source end can obtain the address of the first-hop router; then, the source end adds 1 to the UDP major port number, and sends a UDP probe message with IP TTL equal to 2 through the UDP major port number after adding 1, and similarly, the address of the second-hop router can be obtained. Similarly, when the UDP probe message is forwarded to the destination end (destination host or router), since the port number in the UDP probe message is not listened to, the destination end will reply to the source end with an ICMP destination unreachable message, so that the source end can obtain the address of the destination end. At this point, Traceroute will end the tracking process.

[0035] It is not difficult to find from the above description that in order to realize route tracking of the destination to be tracked, it is first necessary to assign a port number to the destination to be tracked. In order to facilitate the distinction from the subsequent ports, this embodiment will call the port number assigned to the destination to be accessed before starting route tracking the initial port number.

[0036] Because, when using Traceroute to perform route tracking, a large port number is usually used, that is, a port number greater than 30000. Therefore, in this embodiment, the initial port number allocated to the destination is also a port number greater than 30000.

[0037] In addition, it is worth mentioning that in actual applications, the initial port number allocated to the destination can be a pre-fixed port number, such as 33434; or it can be a port number randomly selected from port numbers greater than 30,000 based on a precompiled random number selection program.

[0038] It should be understood that the above examples are merely examples listed for a better understanding of the technical solution of this embodiment and are not intended to be the sole limitation to this embodiment.

[0039] Step 102: Determine the destination port number according to the initial port number and a pre-built port number conflict table.

[0040] Specifically, with the continuous development of network technology, more and more large port numbers, that is, port numbers greater than 30000, are occupied by other applications. For example, port number 33435 is occupied by the matrace application. If the port number used by Traceroute for route tracking is coincidentally occupied by other applications, the Traceroute detection will fail. The detection results of Traceroute are an important basis for operation and maintenance personnel to determine whether the network is faulty.

[0041] That is to say, when Traceroute fails to detect because the port number is occupied by other applications, the operation and maintenance personnel will mistakenly think that the current network is faulty, but in fact the network is normal. Therefore, in order to solve this problem, it is particularly important to choose the right port number.

[0042] In order to select a suitable port number, that is, the port number based on which the destination is tracked, hereinafter referred to as the destination port number for easy distinction, this embodiment pre-constructs a port number for managing port numbers occupied by other applications other than Traceroute, that is, a port number that is not available for use by Traceroute, hereinafter referred to as the unavailable port number for easy distinction.

[0043] Regarding the construction of the port number conflict table, it can be achieved by pre-collecting the currently known unavailable port numbers occupied by other applications other than Traceroute, as well as the unavailable IP addresses corresponding to these unavailable port numbers, and then establishing a corresponding relationship between the unavailable port numbers and the corresponding unavailable IP addresses, thereby obtaining the port number conflict table.

[0044] Accordingly, the step 102 of determining the destination port number according to the initial port number and the pre-built port number conflict table is specifically as follows:

[0045] Based on the pre-assigned initial port number, the port number conflict table that records the unavailable port numbers is traversed, and the initial port number is compared with the unavailable port number traversed at the current moment. If the two are different, the port number conflict table is traversed continuously, and the initial port number is compared with the unavailable port number traversed at the current moment, until the initial port number is different from all the unavailable port numbers in the port number conflict table, and then the initial port number at this time is used as the destination port number.

[0046] Correspondingly, if the comparison shows that the two are the same, the initial port number is adjusted, such as adding 1 to the initial port number, and then the port number conflict table is traversed again, and the adjusted initial port number is compared with the currently traversed unavailable port number. Repeat the above operation until the initial port number is different from all the unavailable port numbers in the port number conflict table, and then the initial port number at this time (which may have been adjusted multiple times) is used as the destination port number.

[0047] For ease of understanding, the following examples are used to illustrate:

[0048] Assume that the pre-built port number conflict table is as shown in Table 1:

[0049] Table 1 Port number conflict table

[0050] Unavailable port number Unavailable IP address 33435 XXXX 33437 XXXX 33568 XXXX 34135 XXXX

[0051] If the pre-allocated initial port number is 33434, then based on the initial port number, the unavailable port numbers in Table 1 are traversed, and it can be determined that there is no unavailable port number in Table 1 that is the same as the initial port number 33434, so the initial port number 33434 can be directly determined as the destination port number.

[0052] If the pre-assigned initial port number is 33435, then based on the initial port number, the unavailable port numbers in Table 1 are traversed and it is found that there is an unavailable port number in Table 1 that is the same as the initial port number 33435. At this time, the initial port number 33435 needs to be adjusted, such as adding 1, to obtain the adjusted initial port number 33436. Then, based on the adjusted initial port number 33436, the unavailable port numbers in Table 1 are traversed again, and the unavailable port numbers traversed each time are compared with the initial port number 33436. Through comparison, it can be determined that there is no unavailable port number in Table 1 that is the same as the initial port number 33436, and therefore the adjusted initial port number 33436 can be determined as the destination port number.

[0053] It should be understood that the above examples are merely examples listed for a better understanding of the technical solution of this embodiment and are not intended to be the sole limitation to this embodiment.

[0054] In addition, it should be understood that the character "X" appearing in Table 1, in practical applications, specifically represents the actual value of IP.

[0055] Step 103: Track the destination end through the destination IP address and the destination port number.

[0056] Specifically, in this embodiment, when tracking the destination through the destination IP address and destination port number, detection will first be performed based on the existing method of initiating a UDP detection message to the destination, and then subsequent processing will be performed based on the detection results, such as whether to directly end the tracking of the destination, or to determine whether the destination port number is occupied by other applications based on other preset response protocols.

[0057] For ease of understanding, the following combination Figure 2 To explain in detail:

[0058] Sub-step 1031, based on the UDP protocol, sending a UDP detection message to the destination end through the destination IP address and the destination port number.

[0059] Since the operation of sending a UDP probe message to the destination end through the destination IP address and the destination port number is based on the UDP protocol, it is the same as the method of initiating a UDP probe message to the destination end when using Traceroute for route tracking, and will not be repeated here.

[0060] Sub-step 1032, monitoring whether a response based on the UDP detection message is received from the destination.

[0061] Specifically, if a response based on the UDP detection message is received from the destination, the detection is considered successful. At this time, sub-step 1036 can be directly executed to end the tracking of the destination, that is, a route tracking is completed; otherwise, sub-step 1033 is executed.

[0062] In addition, it should be understood that in actual applications, as long as the UDP probe message reaches the destination, it will respond, but the destination it reaches may be the last hop host or router, or it may be an intermediate router. The destinations at different stages will respond differently based on the UDP probe message.

[0063] Specifically, if the UDP probe message reaches an intermediate router, the response received is an ICMP timeout message; if the UDP probe message reaches the last-hop host or router, the response received is an ICMP destination unreachable message.

[0064] In actual applications, the source end will end tracking the destination end when the response received is an ICMP destination unreachable message. Otherwise, it is necessary to continue to execute the step of sending a UDP detection message to the destination end based on the UDP protocol through the destination IP address and the destination port number.

[0065] Based on this, before determining that a response based on the UDP detection message is received from the destination, and executing sub-step 1036, it is necessary to first determine whether the received response is an ICMP destination unreachable message.

[0066] Accordingly, if yes, execute sub-step 1036; otherwise, determine whether the received response is an ICMP timeout message.

[0067] Accordingly, if yes, continue to execute the steps in sub-step 1031.

[0068] Specifically, when continuing to execute the steps in step 1031, the IP TTL value will be adjusted, such as adding 1, and the destination port number will be adjusted, such as adding 1; then, based on the adjusted IP TTL and destination port number, the UDP detection message is resent to the destination.

[0069] Furthermore, in order to ensure the validity of the route tracking results, in actual applications, the validity period of the received response can also be set, that is, the response must be received within a preset time period. Therefore, after sending a UDP detection message to the destination end based on the UDP protocol through the destination IP address and the destination port number, a timer task needs to be started. In actual applications, a timer can be started.

[0070] Accordingly, when monitoring whether a response based on the UDP detection message is received from the destination, specifically within the time period corresponding to the scheduled task, such as 1 second, monitoring whether a response based on the UDP detection message is received from the destination.

[0071] Accordingly, if a response based on the UDP detection message is received from the destination within the time period corresponding to the scheduled task, sub-step 1036 is executed; otherwise, sub-step 1033 is executed.

[0072] Sub-step 1033, based on a preset response detection protocol, sending a response detection message to the destination end through the destination IP address and the destination port number.

[0073] Specifically, the response detection protocol mentioned in this embodiment specifically refers to a protocol that enables the destination end to receive a response detection message sent based on the response detection protocol and respond, such as the ICMP protocol.

[0074] Correspondingly, when the selected response detection protocol is the ICMP protocol, the response detection message sent to the destination end through the destination IP address is specifically an ICMP detection message.

[0075] It should be understood that the above examples are merely examples listed for a better understanding of the technical solution of this embodiment and are not intended to be the sole limitation to this embodiment.

[0076] Sub-step 1034, monitoring whether a response is received from the destination based on the response detection message.

[0077] Specifically, if a response based on the response detection message is received from the destination, sub-step 1035 is executed.

[0078] Taking the response probe message as an ICMP probe message as an example, as long as the source end receives the response made by the destination end based on the ICMP probe message, specifically a reply message, it is considered that the reason why no response to the UDP probe message is received is because the destination port number is occupied by other applications, not because there is a fault in the current network.

[0079] Accordingly, if no response is received from the destination based on the response detection message, it can be considered that the detection has failed. At this time, you can return to step 102, redetermine the new destination port number, and then continue to perform the next hop detection based on the redetermined destination port number, that is, based on the redetermined port number, re-execute the above sub-steps included in step 103.

[0080] It should be understood that the above-mentioned continuing to perform the detection of the next hop specifically adjusts the IP TTL, such as adding 1, and adjusts the destination port number, such as adding 1, and then executes the above-mentioned sub-steps included in step 103 based on the adjusted IP TTL and destination port number.

[0081] In addition, after the destination port number is adjusted, it is necessary to re-determine whether the adjusted destination port number is available based on the port number conflict table.

[0082] Accordingly, the above operations are performed only when available.

[0083] In addition, it should be understood that in order to ensure the validity of the route tracking results, in actual applications, the validity period for the receiving destination to respond based on the response detection message can also be set, that is, the response must be received within a preset time period. Therefore, after sending the response detection message to the destination through the destination IP address and the destination port number based on the preset response detection protocol, it is necessary to start a timer task. In actual applications, a timer can be started.

[0084] Accordingly, when monitoring whether a response based on the response detection message is received from the destination, specifically, within the time period corresponding to the scheduled task, such as 1 second, monitoring whether a response based on the response detection message is received from the destination.

[0085] Accordingly, if a response is received from the destination based on the response detection message within the time period corresponding to the scheduled task, sub-step 1035 is executed; otherwise, the process returns to step 102.

[0086] Sub-step 1035, adding the destination IP address and the destination port number to the port number conflict table.

[0087] Specifically, if the received response is made by the destination based on the response detection message, it is considered that the destination port number is occupied by other applications, and the destination port number and the corresponding destination IP address are not suitable for route tracking. Therefore, it is necessary to add the destination IP address and the destination port number to the port number conflict table, that is, the current destination port number and destination IP address are unavailable port numbers and unavailable IP addresses.

[0088] Sub-step 1036, ending the tracking of the destination.

[0089] Therefore, the route tracking method provided in this embodiment pre-builds a port number conflict table and records the port numbers occupied by other applications in the table, that is, the port numbers that cannot be used by the route tracking program. Therefore, when the route tracking program is used to perform route tracking, the pre-allocated initial port number is adjusted according to the unavailable port number recorded in the port number conflict table to determine the destination port number used for route tracking, thereby avoiding the port number occupied by other applications and eliminating the reason that the route tracking operation fails because the port number is occupied, thereby ensuring that the tracking result of the destination end to be visited based on the determined destination port number and the destination IP address obtained from the route tracking command can accurately reflect the current network status and avoid misleading the operation and maintenance personnel.

[0090] The second embodiment of the present invention relates to a route tracking method. The second embodiment is further improved on the basis of the first embodiment, and the main improvement is: when constructing a port number conflict table, in addition to establishing a correspondence between unavailable port numbers and unavailable IP addresses, an initial survival remaining time is set for each unavailable port number, and after the initial survival remaining time is set, a countdown task is started, thereby obtaining a port number conflict table with timeliness.

[0091] Furthermore, after obtaining a port number conflict table with timeliness, the port number conflict table can be traversed regularly at a preset time granularity, and the current remaining survival time of the unavailable port number can be determined based on the countdown task corresponding to the traversed unavailable port number and the initial remaining survival time, and when the current remaining survival time is 0, the unavailable UDP and the unavailable IP address corresponding to the unavailable UDP are deleted from the port number conflict table.

[0092] Furthermore, after obtaining a port number conflict table with timeliness, each time a route tracking command is received, before determining the destination port number based on the assigned initial port number and the port number conflict table, the port number conflict table can be traversed first, and the current remaining survival time of the unavailable port number can be determined based on the countdown task corresponding to the traversed unavailable port number and the initial remaining survival time, and when the current remaining survival time is 0, the unavailable UDP and the unavailable IP address corresponding to the unavailable UDP are deleted from the port number conflict table.

[0093] Correspondingly, after completing the above operations, the destination port number is determined according to the allocated initial port number and the updated port number conflict table, and then the destination is tracked through the destination IP address and the determined destination port number.

[0094] In addition, it should be understood that, in actual applications, some unavailable port numbers occupied by other applications may be released by other applications when the remaining survival time is 0, or may still be occupied. Therefore, before deleting the unavailable UDP and the unavailable IP address corresponding to the unavailable UDP from the port number conflict table, route tracking can be performed based on the unavailable IP address and unavailable port number whose remaining survival time is 0, and then, based on the tracking results, it is determined whether to delete the unavailable UDP and the unavailable IP address corresponding to the unavailable UDP from the port number conflict table.

[0095] For ease of understanding, the following combination Figure 3 To explain in detail:

[0096] Step 301: Based on the UDP protocol, a UDP detection message is sent to the destination through the unavailable IP address and the unavailable port number.

[0097] Step 302: monitor whether a response is received from the destination based on the UDP detection message.

[0098] Specifically, if no response is received from the destination based on the UDP detection message, step 303 is executed; otherwise, step 305 is executed.

[0099] Step 303, based on a preset response detection protocol, a response detection message is sent to the destination through the unavailable IP address and the unavailable port number, and the response detection protocol is a protocol that the destination will respond to after receiving it.

[0100] Step 304: monitor whether a response is received from the destination based on the response detection message.

[0101] Specifically, if no response is received from the destination based on the response detection message, step 305 is executed; otherwise, step 306 is executed.

[0102] It is not difficult to find that steps 301 to 304 in this embodiment are substantially the same as steps 1031 to 1034 in the first embodiment, and the main difference is that the IP address and port number based on which the message detection is performed are switched from the destination IP address to the unavailable IP address, and from the destination port number to the unavailable port number. Therefore, no further description is given here, and the specific details are shown in the relevant description in the first embodiment.

[0103] Step 305: Delete the unavailable UDP and the unavailable IP address corresponding to the unavailable UDP from the port number conflict table.

[0104] Step 306: Set the current remaining survival time corresponding to the unavailable port number as the initial remaining survival time.

[0105] Specifically, if it is determined through judgment that a response based on the response probe message is received from the destination, it means that at the current moment, the unavailable IP address and the unavailable port number are still occupied by other applications, that is, the unavailable IP address and the unavailable port number are still not available for use by Traceroute. In this case, the current remaining survival time corresponding to the unavailable port number needs to be adjusted from 0 to the initial remaining survival time, for example, still adjusted to 24 hours.

[0106] Therefore, the route tracking method provided in this embodiment introduces an aging mechanism, namely, the remaining survival time, to the port number conflict table. When the remaining survival time is 0, and by performing message detection on the unavailable port number and the unavailable IP address with the remaining survival time of 0, and then when it is determined that the unavailable port number has been restored to availability, the unavailable port number and the corresponding unavailable IP address are deleted from the port number conflict table. Otherwise, the initial remaining survival time is reset, so that the port number conflict table can better manage the unavailable port number, so that the destination port number determined based on the port number conflict table can be more suitable for Tracerout to perform route tracking, thereby ensuring the accuracy of route tracking.

[0107] In addition, it should be understood that the step division of the above methods is only for clear description. When implemented, they can be combined into one step or some steps can be split and decomposed into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this patent; adding insignificant modifications to the algorithm or process or introducing insignificant designs that do not change the core design of the algorithm and process are all within the scope of protection of this patent.

[0108] A third embodiment of the present invention relates to a route tracking device, such as Figure 4 As shown, it includes: a destination IP acquisition module 401, an initial port number allocation module 402, a destination port number determination module 403 and a tracking module 404.

[0109] Among them, the destination IP acquisition module 401 is used to obtain the destination IP address of the destination to be tracked from the route tracking command when using the route tracking program to perform route tracking; the initial port number allocation module 402 is used to allocate the initial port number for accessing the destination; the destination port number determination module 403 is used to determine the destination port number based on the initial port number and a pre-constructed port number conflict table, and the port number conflict table is used to manage unavailable port numbers occupied by applications other than the route tracking program; the tracking module 404 is used to track the destination through the destination IP address and the destination port number.

[0110] Furthermore, in another example, the route tracking device further includes a port number conflict table building module.

[0111] Specifically, the port number conflict table construction module is used to collect the unavailable port numbers occupied by applications other than the route tracking program, and the unavailable IP addresses corresponding to the unavailable port numbers; establish a corresponding relationship between the unavailable port numbers and the unavailable IP addresses to obtain the port number conflict table.

[0112] In addition, in another example, the tracking module 404 is specifically configured to:

[0113] Based on the UDP protocol, a UDP detection message is sent to the destination end through the destination IP address and the destination port number;

[0114] Monitoring whether a response from the destination based on the UDP detection message is received;

[0115] If received, then the tracking of the destination is terminated;

[0116] Otherwise, based on a preset response detection protocol, a response detection message is sent to the destination end through the destination IP address and the destination port number, and the response detection protocol is a protocol that the destination end will respond to after receiving it;

[0117] If a response is received from the destination based on the response detection message, the destination IP address and the destination port number are added to the port number conflict table, and the tracking of the destination is terminated;

[0118] Otherwise, the destination port number is re-determined according to the port number conflict table, and the destination end is tracked according to the destination IP address and the re-determined destination port number.

[0119] Furthermore, in another example, the route tracking device further includes a time management module.

[0120] Specifically, the time management module is used to start the timing task after the tracking module 404 sends a UDP detection message to the destination end based on the UDP protocol through the destination IP address and the destination port number.

[0121] Accordingly, the tracking module 404 is specifically configured to:

[0122] During the time period corresponding to the scheduled task, it is monitored whether a response from the destination based on the UDP detection message is received.

[0123] In addition, in another example, the tracking module 404 is further configured to:

[0124] Determine whether the received response is an ICMP destination unreachable message;

[0125] If yes, executing the step of ending the tracking of the destination end;

[0126] Otherwise, determine whether the received response is an ICMP timeout message;

[0127] If so, continue to execute the step of sending a UDP detection message to the destination end based on the UDP protocol through the destination IP address and the destination port number.

[0128] In addition, in another example, the port number conflict table building module is further used to:

[0129] A correspondence between the unavailable port number and the unavailable IP address is established, and an initial remaining survival time is set for each unavailable port number, and a countdown task is started to obtain the port number conflict table.

[0130] Furthermore, in another example, the route tracking device further includes a port number conflict table maintenance module.

[0131] Specifically, the port number conflict table maintenance module is used to traverse the port number conflict table, determine the current remaining survival time of the unavailable port number based on the countdown task corresponding to the traversed unavailable port number and the initial remaining survival time, and when the current remaining survival time is 0, delete the unavailable UDP and the unavailable IP address corresponding to the unavailable UDP from the port number conflict table.

[0132] In addition, in another example, the port number conflict table maintenance module is specifically used to:

[0133] Based on the UDP protocol, sending a UDP detection message to the destination through the unavailable IP address and the unavailable port number;

[0134] Monitoring whether a response from the destination based on the UDP detection message is received;

[0135] If received, the step of deleting the unavailable UDP and the unavailable IP address corresponding to the unavailable UDP from the port number conflict table is executed;

[0136] Otherwise, based on a preset response detection protocol, a response detection message is sent to the destination end through the unavailable IP address and the unavailable port number, wherein the response detection protocol is a protocol to which the destination end will respond after receiving the message;

[0137] If no response is received from the destination based on the response detection message, the step of deleting the unavailable UDP and the unavailable IP address corresponding to the unavailable UDP from the port number conflict table is performed;

[0138] Otherwise, the current remaining survival time corresponding to the unavailable port number is set as the initial remaining survival time.

[0139] In addition, in another example, the destination port number determination module 403 is specifically used to:

[0140] According to the initial port number, traverse the port number conflict table;

[0141] If the unavailable port number that is the same as the initial port number is not traversed, the initial port number is determined as the destination port number;

[0142] Otherwise, the initial port number is adjusted until the adjusted initial port number cannot be found in the port number conflict table, and the adjusted initial port number is determined as the destination port number.

[0143] It is not difficult to find that this embodiment is a device embodiment corresponding to the first or second embodiment, and this embodiment can be implemented in conjunction with the first or second embodiment. The relevant technical details mentioned in the first or second embodiment are still valid in this embodiment, and in order to reduce repetition, they are not repeated here. Accordingly, the relevant technical details mentioned in this embodiment can also be applied in the first or second embodiment.

[0144] It is worth mentioning that all modules involved in this embodiment are logic modules. In practical applications, a logic unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. In addition, in order to highlight the innovative part of the present invention, this embodiment does not introduce units that are not closely related to solving the technical problem proposed by the present invention, but this does not mean that there are no other units in this embodiment.

[0145] A fourth embodiment of the present application relates to a route tracking device, such as Figure 5 As shown, it includes: at least one processor 501; and a memory 502 that is communicatively connected to the at least one processor 501; wherein the memory 502 stores instructions that can be executed by the at least one processor 501, and the instructions are executed by the at least one processor 501 so that the at least one processor 501 can execute the route tracking method described in the above method embodiment.

[0146] The memory 502 and the processor 501 are connected in a bus manner, and the bus may include any number of interconnected buses and bridges, and the bus connects various circuits of one or more processors 501 and the memory 502 together. The bus can also connect various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be one element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices on a transmission medium. The data processed by the processor 501 is transmitted on a wireless medium via an antenna, and further, the antenna also receives data and transmits the data to the processor 501.

[0147] The processor 501 is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management and other control functions. The memory 502 can be used to store data used by the processor 501 when performing operations.

[0148] The fifth embodiment of the present application relates to a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the route tracking method described in the above method embodiment.

[0149] That is, those skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a program, and the program is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0150] Those skilled in the art will appreciate that the above embodiments are specific embodiments for implementing the present application, and in actual applications, various changes may be made thereto in form and detail without departing from the spirit and scope of the present application.

Claims

1. A route tracking method, characterized in that: include: When performing route tracing using a route tracing program, a destination IP address of a destination to be traced is obtained from a route tracing command, and an initial port number for accessing the destination is allocated; The pre-allocated initial port number is adjusted according to the unavailable port number recorded in the pre-constructed port number conflict table to determine the destination port number used for the route tracking, wherein the port number conflict table is used to manage the unavailable port numbers occupied by the application programs other than the route tracking program, and the unavailable IP addresses corresponding to the unavailable port numbers; The destination end is tracked by the destination IP address and the destination port number.

2. The route tracking method according to claim 1, characterized in that: The construction of the port number conflict table includes: Collecting the unavailable port numbers occupied by applications other than the route tracking program and the unavailable IP addresses corresponding to the unavailable port numbers; A correspondence between the unavailable port numbers and the unavailable IP addresses is established to obtain the port number conflict table.

3. The route tracking method according to claim 2, characterized in that: Tracking the destination end by using the destination IP address and the destination port number includes: Based on the UDP protocol, a UDP detection message is sent to the destination end through the destination IP address and the destination port number; Monitoring whether a response from the destination based on the UDP detection message is received; If received, then the tracking of the destination is terminated; Otherwise, based on a preset response detection protocol, a response detection message is sent to the destination end through the destination IP address and the destination port number, and the response detection protocol is a protocol that the destination end will respond to after receiving it; If a response is received from the destination based on the response detection message, the destination IP address and the destination port number are added to the port number conflict table, and the tracking of the destination is terminated; Otherwise, the destination port number is re-determined according to the port number conflict table, and the destination end is tracked according to the destination IP address and the re-determined destination port number.

4. The route tracking method according to claim 3, characterized in that: After sending the UDP detection message to the destination end through the destination IP address and the destination port number based on the UDP protocol, the method further includes: Start a scheduled task; The monitoring of whether a response from the destination based on the UDP detection message is received includes: During the time period corresponding to the scheduled task, it is monitored whether a response from the destination based on the UDP detection message is received.

5. The route tracking method according to claim 3 or 4, characterized in that: Before the tracking of the destination is ended, the method further includes: Determine whether the received response is an ICMP destination unreachable message; If yes, executing the step of ending the tracking of the destination end; Otherwise, determine whether the received response is an ICMP timeout message; If so, continue to execute the step of sending a UDP detection message to the destination end based on the UDP protocol through the destination IP address and the destination port number.

6. The route tracking method according to claim 2, characterized in that: The construction of the port number conflict table also includes: A correspondence between the unavailable port number and the unavailable IP address is established, and an initial remaining survival time is set for each unavailable port number, and a countdown task is started to obtain the port number conflict table.

7. The route tracking method according to claim 6, characterized in that: After obtaining the port number conflict table, the method further includes: The port number conflict table is traversed, and the current remaining survival time of the unavailable port number is determined according to the countdown task corresponding to the traversed unavailable port number and the initial remaining survival time, and when the current remaining survival time is 0, the unavailable port and the unavailable IP address corresponding to the unavailable port are deleted from the port number conflict table.

8. The route tracking method according to claim 7, characterized in that: Before deleting the unavailable port and the unavailable IP address corresponding to the unavailable port from the port number conflict table, the method further includes: Based on the UDP protocol, sending a UDP detection message to the destination through the unavailable IP address and the unavailable port number; If received, the step of deleting the unavailable port and the unavailable IP address corresponding to the unavailable port from the port number conflict table is executed; Otherwise, based on a preset response detection protocol, a response detection message is sent to the destination end through the unavailable IP address and the unavailable port number, wherein the response detection protocol is a protocol to which the destination end will respond after receiving the message; If no response is received from the destination end based on the response detection message, the step of deleting the unavailable port and the unavailable IP address corresponding to the unavailable port from the port number conflict table is performed; Otherwise, the current remaining survival time corresponding to the unavailable port number is set as the initial remaining survival time.

9. The route tracking method according to claim 1 or 8, characterized in that: Determining the destination port number according to the initial port number and a pre-built port number conflict table includes: According to the initial port number, traverse the port number conflict table; If the unavailable port number that is the same as the initial port number is not traversed, the initial port number is determined as the destination port number; Otherwise, the initial port number is adjusted until the adjusted initial port number cannot be found in the port number conflict table, and the adjusted initial port number is determined as the destination port number.

10. A route tracking device, characterized in that: include: The destination IP acquisition module is used to obtain the destination IP address of the destination to be tracked from the route tracking command when the route tracking program is used for route tracking; An initial port number allocation module, used to allocate an initial port number for accessing the destination end; a destination port number determination module, used to adjust the pre-allocated initial port number according to the unavailable port number recorded in the pre-built port number conflict table, and determine the destination port number used for the route tracking, wherein the port number conflict table is used to manage the unavailable port numbers occupied by the application programs other than the route tracking program, and the unavailable IP addresses corresponding to the unavailable port numbers; The tracking module is used to track the destination end through the destination IP address and the destination port number.

11. A route tracking device, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the route tracing method according to any one of claims 1 to 9.

12. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the route tracking method according to any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Method and device for acquiring decentralized network node position information

    CN110430139A