Multi-level network device topology generation method, device, equipment and medium

Through probe scheduled scanning and ICMP packet analysis, a multi-level network device topology diagram is generated, which solves the flexibility and compatibility problems of topology generation in the existing technology and improves network management efficiency.

CN118555208BActive Publication Date: 2024-10-01PRIMFORCE TECHNOLOGIES LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411020424.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-29
Publication Date
2024-10-01
Estimated Expiration
2044-07-29

AI Technical Summary

Technical Problem

It is difficult for the existing technology to flexibly and efficiently generate network device topology between multiple independent subnets, and there are problems such as poor universality, poor version compatibility, vendor lock-in, and poor flexibility.

Method used

Deploy probes to regularly scan the network devices associated with each subnet, and use ICMP packets to obtain the TTL attenuation, source IP address and gateway IP address of the probe, analyze the connection relationship between subnets, and generate multi-level network device profiles. Topology map.

Benefits of technology

It realizes the flexible generation of network device topology diagrams between multiple independent subnets, improves the efficiency of network management and monitoring, and avoids vendor lock-in and version compatibility issues.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118555208B_ABST
    Figure CN118555208B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of communication technology, and provides a method, device, equipment and medium for generating a multi-level network device topology. The method, device, equipment and medium can periodically scan the network devices associated with each subnet through deployed probes, and obtain the TTL attenuation, source IP address and gateway IP address corresponding to the probe of each injected data packet by parsing the ICMP injected data packet. The connection relationship between the routes of each subnet is further analyzed according to the TTL attenuation, source IP address and gateway IP address corresponding to the probe of each injected data packet, so as to flexibly generate a multi-level network device topology diagram of network devices between multiple independent subnets according to the connection relationship.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a method, device, equipment and medium for generating a multi-level network device topology. Background Art

[0002] As the scale of the network expands and the number of devices increases, it becomes increasingly difficult to manually manage and monitor all network devices. Therefore, the establishment of a network topology can significantly improve the efficiency of network management and the ability of network monitoring.

[0003] In the prior art, network device topology is mainly generated in the following ways:

[0004] 1. Use SNMP (Simple Network Management Protocol) to discover network device topology;

[0005] This method has the following main shortcomings:

[0006] 1) Poor universality: Using SNMP to discover network device topology requires the support of gateway devices;

[0007] 2) Version compatibility: The compatibility and configuration differences between different versions of SNMP increase management complexity.

[0008] 2. Use ARP (Address Resolution Protocol) to discover traditional network device topology;

[0009] However, this method cannot logically associate the topological relationships of network devices between multiple independent subnets.

[0010] 3. Use the gateway device-specific discovery protocol of some manufacturers to discover the network device topology;

[0011] This method has the following main shortcomings:

[0012] 1) Vendor lock-in: requires support from certain vendors’ gateway devices;

[0013] 2) Poor flexibility: Gateway devices from specific manufacturers need to be manually configured.

[0014] In view of the shortcomings of existing technologies, how to flexibly and efficiently generate network device topologies between multiple independent subnets has become an urgent problem to be solved. Summary of the invention

[0015] In view of the above, it is necessary to provide a multi-level network device topology generation method, apparatus, device and medium, aiming to solve the problem of being unable to associate the topology between network devices of independent levels.

[0016] A method for generating a multi-level network device topology, the method comprising:

[0017] Get at least one subnet and deploy a probe in each subnet.

[0018] At preset time intervals, each probe is used to scan network devices associated with the corresponding subnet;

[0019] Generate an ICMP data packet for each probe, and inject the local gateway information of the probe to each ICMP data packet to obtain each injected data packet;

[0020] Distribute each injected data packet to other probes except the probe to which each injected data packet belongs;

[0021] Each probe is used to parse each captured injected data packet to obtain the TTL attenuation, source IP address and gateway IP address corresponding to the probe of each injected data packet;

[0022] Analyze the connection relationship between the routes of each subnet based on the TTL attenuation of each injected data packet, the source IP address and the gateway IP address corresponding to the probe to which it belongs;

[0023] A multi-level network device topology diagram of the network device is generated according to the connection relationship.

[0024] According to a preferred embodiment of the present invention, obtaining at least one subnet and deploying a probe in each subnet includes:

[0025] Acquire multiple subnets under each route to obtain the at least one subnet;

[0026] The program body and library files of the executable program of the corresponding probe are saved in the designated file path corresponding to the probe server of each subnet;

[0027] Execute the program run command of each executable program to deploy the corresponding probe.

[0028] According to a preferred embodiment of the present invention, scanning the network devices associated with the corresponding subnet using each probe includes:

[0029] Use each probe to query the IP address and MAC address of its own host machine to obtain the probe server of the subnet corresponding to each probe;

[0030] Obtain the IP address and mask of the probe server of the subnet corresponding to each probe, and use the IP address and mask of the probe server of the subnet corresponding to each probe to calculate the IP range of the devices under the subnet corresponding to each probe; use each probe to broadcast ARP requests to all devices under the corresponding subnet based on the IP range; when receiving an ARP response fed back by any device in response to the ARP request, determine the any device as an access device under the subnet corresponding to each probe;

[0031] Each probe is used to query the routing information of its own host to obtain each gateway address, and the route corresponding to each probe is determined according to each gateway address;

[0032] The probe server of the subnet corresponding to each probe, the access device under the subnet corresponding to each probe, and the route corresponding to each probe are determined as network devices associated with the subnet corresponding to each probe.

[0033] According to a preferred embodiment of the present invention, injecting the local gateway information of the probe to each ICMP data packet to obtain each injected data packet comprises:

[0034] Determine the gateway corresponding to the probe to which each ICMP data packet belongs as the local gateway corresponding to each ICMP data packet;

[0035] Obtaining the IP address and MAC address of each local gateway as information of each local gateway;

[0036] The libnet interface function library is used to inject each local gateway information into the corresponding ICMP data packet to obtain each injected data packet.

[0037] According to a preferred embodiment of the present invention, analyzing the connection relationship between the routes where each subnet is located according to the TTL attenuation of each injected data packet, the source IP address and the gateway IP address corresponding to the probe to which it belongs includes:

[0038] For each injected data packet, when the TTL attenuation value is 1 and the source IP address is the same as the gateway IP address, it is determined that the subnet to which the sending probe and the receiving probe of the injected data packet belong is deployed under the same route;

[0039] When the value of the TTL attenuation is 1 and the source IP address is different from the gateway IP address, it is determined that the subnet to which the sending probe and the receiving probe of the injected data packet belong is deployed under a route with a direct physical connection relationship;

[0040] When the value of the TTL attenuation is greater than 1, it is determined that the subnet to which the sending probe and the receiving probe of the injected data packet belong is deployed under a route with an indirect physical connection relationship; the difference between the attenuation and 1 is calculated as the number of intermediate routes connected between the routes with an indirect physical connection relationship.

[0041] According to a preferred embodiment of the present invention, generating a multi-level network device topology diagram of the network device according to the connection relationship includes:

[0042] Taking each subnet and the route corresponding to each probe as the initial node, and generating the connection line between the initial nodes according to the connection relationship between the routes of each subnet, an initial topology diagram is obtained;

[0043] A new node is added to the initial topology map using the probe server of each probe corresponding to the subnet and the access device under each probe corresponding to the subnet, and each probe server and each access device are connected to the corresponding subnet to obtain the multi-level network device topology map.

[0044] According to a preferred embodiment of the present invention, after generating a multi-level network device topology diagram of the network device according to the connection relationship, the method further includes:

[0045] When a probe scans a new network device, the scanned new network device is updated to the multi-level network device topology map.

[0046] A multi-level network device topology generation device, the multi-level network device topology generation device comprising:

[0047] A deployment unit, used to obtain at least one subnet and deploy a probe in each subnet;

[0048] A scanning unit, configured to scan network devices associated with a corresponding subnet using each probe at a preset time interval;

[0049] A generating unit, used for generating an ICMP data packet of each probe, and injecting the local gateway information of the corresponding probe into each ICMP data packet to obtain each injected data packet;

[0050] a distribution unit, used for distributing each injected data packet to other probes except the probe to which each injected data packet belongs;

[0051] The parsing unit is used to parse each captured injected data packet using each probe to obtain the TTL attenuation, source IP address and gateway IP address corresponding to the probe of each injected data packet;

[0052] An analysis unit, used for analyzing the connection relationship between the routes where each subnet is located according to the TTL attenuation of each injected data packet, the source IP address and the gateway IP address corresponding to the probe;

[0053] The generating unit is further used to generate a multi-level network device topology diagram of the network device according to the connection relationship.

[0054] A computer device, comprising:

[0055] A memory storing at least one instruction;

[0056] A processor executes the instructions stored in the memory to implement the multi-stage network device topology generation method.

[0057] A computer-readable storage medium stores at least one instruction, and the at least one instruction is executed by a processor in a computer device to implement the multi-stage network device topology generation method.

[0058] It can be seen from the above technical scheme that the present invention can periodically scan the network devices associated with each subnet through the deployed probes, and obtain the TTL attenuation, source IP address and gateway IP address corresponding to the probe of each injected data packet by parsing the ICMP injected data packet, and further analyze the connection relationship between the routes of each subnet according to the TTL attenuation, source IP address and gateway IP address corresponding to the probe of each injected data packet, so as to flexibly generate a multi-level network device topology diagram of network devices between multiple independent subnets according to the connection relationship. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] Figure 1 It is a flow chart of a preferred embodiment of the method for generating a multi-level network device topology of the present invention;

[0060] Figure 2 is a first schematic diagram of a multi-level network device topology diagram of the present invention;

[0061] Figure 3 is a second schematic diagram of a multi-stage network device topology diagram of the present invention;

[0062] Figure 4 is a third schematic diagram of a multi-level network device topology diagram of the present invention;

[0063] Figure 5 It is a functional module diagram of a preferred embodiment of the multi-level network device topology generation device of the present invention;

[0064] Figure 6 It is a schematic diagram of the structure of a computer device of a preferred embodiment of the method for generating a multi-level network device topology according to the present invention. DETAILED DESCRIPTION

[0065] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention is described in detail below with reference to the accompanying drawings and specific embodiments.

[0066] like Figure 1 FIG. 1 is a flowchart of a preferred embodiment of a method for generating a multi-level network device topology according to the present invention. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.

[0067] The multi-level network device topology generation method is applied to one or more computer devices, wherein the computer device is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (ASIC), programmable gate arrays (FPGA), digital signal processors (DSP), embedded devices, etc.

[0068] The computer device may be any electronic product that can perform human-computer interaction with a user, such as a personal computer, a tablet computer, a smart phone, a personal digital assistant (PDA), a game console, an interactive network television (IPTV), a smart wearable device, etc.

[0069] The computer device may also include a network device and / or a user device, wherein the network device includes, but is not limited to, a single network server, a server group consisting of multiple network servers, or a cloud consisting of a large number of hosts or network servers based on cloud computing.

[0070] The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), as well as big data and artificial intelligence platforms.

[0071] Among them, Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0072] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0073] The network where the computer device is located includes but is not limited to the Internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (VPN), etc.

[0074] S10, obtaining at least one subnet and deploying a probe in each subnet.

[0075] The subnet is the network connected under each route.

[0076] In this embodiment, obtaining at least one subnet and deploying a probe in each subnet includes:

[0077] Acquire multiple subnets under each route to obtain the at least one subnet;

[0078] The program body and library files of the executable program of the corresponding probe are saved in the designated file path corresponding to the probe server of each subnet;

[0079] Execute the program run command of each executable program to deploy the corresponding probe.

[0080] The probe may be an executable program written in a high-level programming language and may be executed on a server running an operating system such as Linux or Windows.

[0081] Through the above embodiments, probes can be deployed in each subnet to capture more comprehensive data packets.

[0082] S11, at every preset time interval, using each probe to scan the network devices associated with the corresponding subnet.

[0083] The preset time interval can be configured according to actual needs, such as 1 hour.

[0084] In this embodiment, using each probe to scan the network devices associated with the corresponding subnet includes:

[0085] Use each probe to query the IP address (Internet Protocol Address) and MAC address (Media Access Control Address) of its host machine to obtain the probe server of the subnet corresponding to each probe;

[0086] Obtain the IP address and mask of the probe server of the subnet corresponding to each probe, and use the IP address and mask of the probe server of the subnet corresponding to each probe to calculate the IP range of the devices under the subnet corresponding to each probe; use each probe to broadcast an ARP (Address Resolution Protocol) request to all devices under the corresponding subnet based on the IP range; when receiving an ARP response fed back by any device in response to the ARP request, determine the any device as an access device under the subnet corresponding to each probe;

[0087] Each probe is used to query the routing information of its own host to obtain each gateway address, and the route corresponding to each probe is determined according to each gateway address;

[0088] The probe server of the subnet corresponding to each probe, the access device under the subnet corresponding to each probe, and the route corresponding to each probe are determined as network devices associated with the subnet corresponding to each probe.

[0089] For example: each host machine can save its own IP address and MAC address locally for query, and obtain the probe server of each probe's corresponding subnet; the probe calculates the device IP range of the subnet through the IP address and mask of the host machine (that is, the probe server), such as 192.168.1.1-192.168.1.255, and then uses the ARP protocol to scan the device to obtain the access device under each probe's corresponding subnet; the probe obtains the default gateway address by querying the host machine's routing information (which can be cached locally on the host machine), and further determines the route corresponding to each probe based on the gateway address; integrates all scanned devices to obtain the network devices associated with each probe's corresponding subnet.

[0090] In the above embodiment, the network devices can be automatically scanned by the probe.

[0091] S12, generating an ICMP (Internet Control Message Protocol) data packet of each probe, and injecting the local gateway information of the corresponding probe into each ICMP data packet to obtain each injected data packet.

[0092] In this embodiment, the ICMP data packet is more likely to pass through the firewall of the gateway, and is therefore more likely to be captured by the probe, making the acquired data packet more comprehensive, further ensuring that more comprehensive network information can be acquired.

[0093] Of course, in other embodiments, other forms of data packets may also be used. As long as they can be collected by the probe, the present invention does not limit the type of data packets.

[0094] In this embodiment, injecting the local gateway information of the probe to each ICMP data packet to obtain each injected data packet includes:

[0095] Determine the gateway corresponding to the probe to which each ICMP data packet belongs as the local gateway corresponding to each ICMP data packet;

[0096] Obtaining the IP address and MAC address of each local gateway as information of each local gateway;

[0097] The libnet interface function library is used to inject each local gateway information into the corresponding ICMP data packet to obtain each injected data packet.

[0098] The data packets injected by the libnet interface function library will not have any impact on the actual business and occupy very little bandwidth, but can be parsed by the peer probe.

[0099] Through the above embodiment, an injection data packet carrying local gateway information can be generated, so that when a subsequent probe captures a corresponding injection data packet, the local gateway information of each injection data packet can be obtained by parsing.

[0100] S13, distributing each injected data packet to other probes except the probe to which each injected data packet belongs.

[0101] In the above embodiment, by distributing each injected data packet to probes in other sub-networks, each injected data packet can carry gateway information of both the sending and receiving ends, so as to be used in the subsequent analysis of the relationship between routes.

[0102] S14, using each probe to parse each captured injected data packet, obtain the TTL (Time To Live) attenuation, source IP address and gateway IP address corresponding to the probe of each injected data packet.

[0103] Specifically, each probe is used to analyze the gateway IP address and MAC address of the sending probe carried by each captured injection data packet, and the TTL attenuation, source IP address and gateway IP address corresponding to the probe of each injection data packet are extracted.

[0104] The TTL attenuation refers to the maximum number of network segments that a specified IP packet is allowed to pass through before being discarded by the router.

[0105] By parsing the source IP address, the WAN (Wide Area Network) port information of the last hop route of the data packet after NAT (Network Address Translation) can be obtained.

[0106] The gateway IP address refers to the gateway IP address of the subnet where the probe is located, and is the IP address of the LAN (Local Area Network) port of the router to which the probe is connected.

[0107] S15, analyzing the connection relationship between the routes where each subnet is located according to the TTL attenuation of each injected data packet, the source IP address and the gateway IP address corresponding to the corresponding probe.

[0108] In this embodiment, analyzing the connection relationship between the routes where each subnet is located according to the TTL attenuation of each injected data packet, the source IP address and the gateway IP address corresponding to the corresponding probe includes:

[0109] For each injected data packet, when the TTL attenuation value is 1 and the source IP address is the same as the gateway IP address, it is determined that the subnet to which the sending probe and the receiving probe of the injected data packet belong is deployed under the same route;

[0110] When the value of the TTL attenuation is 1 and the source IP address is different from the gateway IP address, it is determined that the subnet to which the sending probe and the receiving probe of the injected data packet belong is deployed under a route with a direct physical connection relationship;

[0111] When the value of the TTL attenuation is greater than 1, it is determined that the subnet to which the sending probe and the receiving probe of the injected data packet belong is deployed under a route with an indirect physical connection relationship; the difference between the attenuation and 1 is calculated as the number of intermediate routes connected between the routes with an indirect physical connection relationship.

[0112] For example, if the TTL attenuation of the injected data packets corresponding to probe server A and probe server F is 1 and the source IP address is the same as the gateway IP address, then probe server A and probe server F are respectively deployed on subnet A and subnet B belonging to the same router A.

[0113] For another example: the TTL attenuation value of the injected data packets corresponding to probe server A and probe server D is 1 and the source IP address is different from the gateway IP address. The gateway IP address of the probe corresponding to the injected data packet is the LAN port IP address of the router to which the probe is physically connected, that is, the LAN port IP of router A. The source IP address is NATed to the WAN port IP address of the last hop router of the injected data packet, that is, the WAN port IP address of router A. Subnet B to which probe server A belongs is deployed under router B, and subnet A to which probe server D belongs is deployed under router A, and router A is directly mounted under router B. Router A and router B have a direct physical connection relationship, that is, the subnets to which probe server A and probe server D belong are deployed under routers with a direct physical connection relationship.

[0114] For another example: the TTL attenuation value of the injected data packets corresponding to probe server A and probe server F is 2, and the gateway IP address of the probe corresponding to the injected data packet is the LAN port IP address of the router physically connected to the probe, that is, the LAN port IP of router A; the source IP address is NATed to the WAN port IP address of the last hop intermediate router corresponding to the injected data packet, that is, the WAN port IP address of router C; therefore, router C is connected to router B, and router A is mounted under router C under router B, then router A and router B have an indirect physical connection relationship, and router C is the intermediate router. At this time, the subnets to which probe server A and probe server F belong are deployed under the router with an indirect physical connection relationship.

[0115] Through the above embodiments, the connection relationship between routes can be obtained by analyzing the TTL attenuation, the source IP address and the gateway IP address corresponding to the corresponding probe.

[0116] S16, generating a multi-level network device topology diagram of the network device according to the connection relationship.

[0117] In this embodiment, generating a multi-level network device topology diagram of the network device according to the connection relationship includes:

[0118] Taking each subnet and the route corresponding to each probe as the initial node, and generating the connection line between the initial nodes according to the connection relationship between the routes of each subnet, an initial topology diagram is obtained;

[0119] A new node is added to the initial topology map using the probe server of each probe corresponding to the subnet and the access device under each probe corresponding to the subnet, and each probe server and each access device are connected to the corresponding subnet to obtain the multi-level network device topology map.

[0120] The access devices may include various devices such as printers and cameras that access the sub-network.

[0121] For example: Figure 2 As shown, it is the first schematic diagram of the multi-level network device topology diagram of the present invention. Probe server A and probe server F are respectively deployed on subnet A and subnet B belonging to the same router A. Then, according to the connection relationship between the devices obtained in the previous text, each subnet, the route corresponding to each probe, the probe server of each probe corresponding to the subnet and the access device under each probe corresponding to the subnet are used as nodes, and each node is connected based on the association relationship, so as to generate the corresponding multi-level network device topology diagram. Similarly, if Figure 3 As shown, it is the second schematic diagram of the multi-level network device topology diagram of the present invention. Subnet B to which probe server A belongs is deployed under route B, and subnet A to which probe server D belongs is deployed under route A, and route A is directly mounted under route B. Route A and route B have a direct physical connection relationship, that is, the subnets to which probe server A and probe server D belong are deployed under routes with a direct physical connection relationship. Then, according to the connection relationship between the devices obtained in the previous text, the corresponding multi-level network device topology diagram can be generated. Figure 4 As shown, it is the third schematic diagram of the multi-level network device topology diagram of the present invention. Route C is connected to route B, and route A is mounted under route C under route B, then route A and route B have an indirect physical connection relationship, and route C is the middle route. At this time, the subnet to which probe server A and probe server F belong is deployed under a route with an indirect physical connection relationship, and then according to the connection relationship between the devices obtained above, the corresponding multi-level network device topology diagram can be generated.

[0122] Through the above embodiments, a multi-level network device topology diagram can be flexibly generated with greater universality.

[0123] In this embodiment, after generating the multi-level network device topology diagram of the network device according to the connection relationship, the method further includes:

[0124] When a probe scans a new network device, the scanned new network device is updated to the multi-level network device topology map.

[0125] It is understandable that due to factors such as heavy traffic in the network, the ARP reply packet may be discarded or delayed in forwarding, so there is a possibility that a device may be missed.

[0126] Based on the above problems, this embodiment can continuously capture new data packets through the timed scanning of the probe, thereby continuously improving the multi-level network device topology map.

[0127] It can be seen from the above technical scheme that the present invention can periodically scan the network devices associated with each subnet through the deployed probes, and obtain the TTL attenuation, source IP address and gateway IP address corresponding to the probe of each injected data packet by parsing the ICMP injected data packet, and further analyze the connection relationship between the routes of each subnet according to the TTL attenuation, source IP address and gateway IP address corresponding to the probe of each injected data packet, so as to flexibly generate a multi-level network device topology diagram of network devices between multiple independent subnets according to the connection relationship.

[0128] like Figure 5 , which is a functional module diagram of a preferred embodiment of the multi-level network device topology generation device of the present invention. The multi-level network device topology generation device 11 includes a deployment unit 110, a scanning unit 111, a generation unit 112, a distribution unit 113, a parsing unit 114, and an analysis unit 115. The module / unit referred to in the present invention refers to a series of computer program segments that can be executed by a processor and can perform fixed functions, which are stored in a memory. In this embodiment, the functions of each module / unit will be described in detail in subsequent embodiments.

[0129] The deployment unit 110 is used to obtain at least one subnet and deploy a probe in each subnet;

[0130] The scanning unit 111 is used to scan the network devices associated with the corresponding subnet using each probe at every preset time interval;

[0131] The generating unit 112 is used to generate an ICMP data packet for each probe, and inject the local gateway information of the corresponding probe into each ICMP data packet to obtain each injected data packet;

[0132] The distribution unit 113 is used to distribute each injected data packet to other probes except the probe to which each injected data packet belongs;

[0133] The parsing unit 114 is used to parse each captured injected data packet using each probe to obtain the TTL attenuation, source IP address and gateway IP address corresponding to the probe of each injected data packet;

[0134] The analysis unit 115 is used to analyze the connection relationship between the routes where each subnet is located according to the TTL attenuation of each injected data packet, the source IP address and the gateway IP address corresponding to the corresponding probe;

[0135] The generating unit 112 is further configured to generate a multi-level network device topology diagram of the network device according to the connection relationship.

[0136] It can be seen from the above technical scheme that the present invention can periodically scan the network devices associated with each subnet through the deployed probes, and obtain the TTL attenuation, source IP address and gateway IP address corresponding to the probe of each injected data packet by parsing the ICMP injected data packet, and further analyze the connection relationship between the routes of each subnet according to the TTL attenuation, source IP address and gateway IP address corresponding to the probe of each injected data packet, so as to flexibly generate a multi-level network device topology diagram of network devices between multiple independent subnets according to the connection relationship.

[0137] like Figure 6 , which is a schematic diagram of the structure of a computer device of a preferred embodiment of the method for generating a multi-level network device topology according to the present invention.

[0138] The computer device 1 may include a memory 12 , a processor 13 , and a bus, and may also include a computer program stored in the memory 12 and executable on the processor 13 , such as a multi-stage network device topology generation program.

[0139] Those skilled in the art will appreciate that the schematic diagram is merely an example of the computer device 1 and does not constitute a limitation on the computer device 1. The computer device 1 may be a bus-type structure or a star-type structure. The computer device 1 may also include more or less other hardware or software than shown in the diagram, or a different arrangement of components. For example, the computer device 1 may also include input and output devices, network access devices, etc.

[0140] It should be noted that the computer device 1 is only an example, and other existing or future electronic products that are suitable for the present invention should also be included in the protection scope of the present invention and included here by reference.

[0141] The memory 12 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. In some embodiments, the memory 12 may be an internal storage unit of the computer device 1, such as a mobile hard disk of the computer device 1. In other embodiments, the memory 12 may also be an external storage device of the computer device 1, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), etc. equipped on the computer device 1. Further, the memory 12 may also include both an internal storage unit of the computer device 1 and an external storage device. The memory 12 may not only be used to store application software and various types of data installed in the computer device 1, such as the code of a multi-level network device topology generation program, but may also be used to temporarily store data that has been output or is to be output.

[0142] In some embodiments, the processor 13 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and a combination of various control chips. The processor 13 is the control core (Control Unit) of the computer device 1, and uses various interfaces and lines to connect various components of the entire computer device 1, and executes various functions and processes data of the computer device 1 by running or executing programs or modules stored in the memory 12 (for example, executing a multi-level network device topology generation program, etc.), and calling data stored in the memory 12.

[0143] The processor 13 executes the operating system of the computer device 1 and various installed applications. The processor 13 executes the applications to implement the steps in the above-mentioned various multi-level network device topology generation method embodiments, for example Figure 1 Steps shown.

[0144] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory 12 and executed by the processor 13 to implement the present invention. The one or more modules / units may be a series of computer-readable instruction segments capable of implementing specific functions, which are used to describe the execution process of the computer program in the computer device 1. For example, the computer program may be divided into a deployment unit 110, a scanning unit 111, a generation unit 112, a distribution unit 113, a parsing unit 114, and an analysis unit 115.

[0145] The above-mentioned integrated unit implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, and includes a number of instructions for enabling a computer device (which can be a personal computer, a computer device, or a network device, etc.) or a processor to execute a part of the multi-stage network device topology generation method described in each embodiment of the present invention.

[0146] If the module / unit integrated in the computer device 1 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware devices through a computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of each of the above-mentioned method embodiments can be implemented.

[0147] The computer program includes computer program code, which may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory, etc.

[0148] Furthermore, the computer-readable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.

[0149] The blockchain referred to in this invention is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the blockchain underlying platform, platform product service layer, and application service layer.

[0150] The bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 The bus is represented by only one straight line, but it does not mean that there is only one bus or one type of bus. The bus is configured to realize the connection and communication between the memory 12 and at least one processor 13, etc.

[0151] Although not shown, the computer device 1 may also include a power source (such as a battery) for supplying power to various components. Preferably, the power source may be logically connected to the at least one processor 13 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include any components such as one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, and power status indicators. The computer device 1 may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.

[0152] Furthermore, the computer device 1 may also include a network interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is usually used to establish a communication connection between the computer device 1 and other computer devices.

[0153] Optionally, the computer device 1 may further include a user interface, which may be a display, an input unit (such as a keyboard), or a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode) touch device. The display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the computer device 1 and to display a visual user interface.

[0154] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.

[0155] Figure 6 Only the computer device 1 having components 12-13 is shown, and it can be understood by those skilled in the art that Figure 6 The structure shown does not constitute a limitation on the computer device 1, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.

[0156] Combination Figure 1 The memory 12 in the computer device 1 stores a plurality of instructions to implement a multi-level network device topology generation method, and the processor 13 can execute the plurality of instructions to implement:

[0157] Get at least one subnet and deploy a probe in each subnet.

[0158] At preset time intervals, each probe is used to scan network devices associated with the corresponding subnet;

[0159] Generate an ICMP data packet for each probe, and inject the local gateway information of the probe to each ICMP data packet to obtain each injected data packet;

[0160] Distribute each injected data packet to other probes except the probe to which each injected data packet belongs;

[0161] Each probe is used to parse each captured injected data packet to obtain the TTL attenuation, source IP address and gateway IP address corresponding to the probe of each injected data packet;

[0162] Analyze the connection relationship between the routes of each subnet based on the TTL attenuation of each injected data packet, the source IP address and the gateway IP address corresponding to the probe to which it belongs;

[0163] A multi-level network device topology diagram of the network device is generated according to the connection relationship.

[0164] Specifically, the specific implementation method of the processor 13 for the above instructions can refer to Figure 1 The description of the relevant steps in the corresponding embodiments will not be repeated here.

[0165] It should be noted that the data involved in this case were all obtained legally.

[0166] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.

[0167] The present invention can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present invention can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present invention can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0168] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0169] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.

[0170] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.

[0171] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.

[0172] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the present invention can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.

[0173] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.

Claims

1. A method for generating multi-level network device topology, It is characterized in that The multi-stage network device topology generation method comprises: Get at least one subnet and deploy a probe in each subnet. At preset time intervals, each probe is used to scan network devices associated with the corresponding subnet; Generate an ICMP data packet for each probe, and inject the local gateway information of the probe to which it belongs into each ICMP data packet to obtain each injected data packet; wherein, injecting the local gateway information of the probe to which it belongs into each ICMP data packet to obtain each injected data packet comprises: determining the gateway corresponding to the probe to which each ICMP data packet belongs as the local gateway corresponding to each ICMP data packet; obtaining the IP address and MAC address of each local gateway as each local gateway information; using the libnet interface function library to inject each local gateway information into the corresponding ICMP data packet to obtain each injected data packet; Distribute each injected data packet to other probes except the probe to which each injected data packet belongs; Each probe is used to parse each captured injected data packet to obtain the TTL attenuation, source IP address and gateway IP address corresponding to the probe of each injected data packet; Analyze the connection relationship between the routes where each subnet is located according to the TTL attenuation of each injected data packet, the source IP address and the gateway IP address corresponding to the probe to which it belongs, including: for each injected data packet, when the value of the TTL attenuation is 1 and the source IP address is the same as the gateway IP address, determine that the subnet to which the sending probe of the injected data packet belongs and the receiving probe belong is deployed under the same route; when the value of the TTL attenuation is 1 and the source IP address is different from the gateway IP address, determine that the subnet to which the sending probe of the injected data packet belongs and the receiving probe belong is deployed under a route with a direct physical connection relationship; when the value of the TTL attenuation is greater than 1, determine that the subnet to which the sending probe of the injected data packet belongs and the receiving probe belong is deployed under a route with an indirect physical connection relationship; calculate the difference between the attenuation and 1 as the number of intermediate routes connected between the routes with the indirect physical connection relationship; A multi-level network device topology diagram of the network device is generated according to the connection relationship.

2. The method for generating a multi-level network device topology according to claim 1, It is characterized in that The obtaining of at least one subnet and deploying a probe in each subnet includes: Acquire multiple subnets under each route to obtain the at least one subnet; The program body and library files of the executable program of the corresponding probe are saved in the designated file path corresponding to the probe server of each subnet; Execute the program run command of each executable program to deploy the corresponding probe.

3. The method for generating a multi-level network device topology according to claim 1, It is characterized in that The method of using each probe to scan the network devices associated with the corresponding subnet includes: Use each probe to query the IP address and MAC address of its own host machine to obtain the probe server of the subnet corresponding to each probe; Obtain the IP address and mask of the probe server of the subnet corresponding to each probe, and use the IP address and mask of the probe server of the subnet corresponding to each probe to calculate the IP range of the devices under the subnet corresponding to each probe; use each probe to broadcast ARP requests to all devices under the corresponding subnet based on the IP range; when receiving an ARP response fed back by any device in response to the ARP request, determine the any device as an access device under the subnet corresponding to each probe; Use each probe to query the routing information of its own host to obtain each gateway address, and determine the route corresponding to each probe based on each gateway address; The probe server of the subnet corresponding to each probe, the access device under the subnet corresponding to each probe, and the route corresponding to each probe are determined as network devices associated with the subnet corresponding to each probe.

4. The method for generating a multi-level network device topology according to claim 3, It is characterized in that Generating a multi-level network device topology diagram of the network device according to the connection relationship includes: Taking each subnet and the route corresponding to each probe as the initial node, and generating the connection line between the initial nodes according to the connection relationship between the routes of each subnet, an initial topology diagram is obtained; A new node is added to the initial topology map using the probe server of each probe corresponding to the subnet and the access device under each probe corresponding to the subnet, and each probe server and each access device are connected to the corresponding subnet to obtain the multi-level network device topology map.

5. The method for generating a multi-level network device topology according to claim 1, It is characterized in that After generating the multi-level network device topology diagram of the network device according to the connection relationship, the method further includes: When a probe scans a new network device, the scanned new network device is updated to the multi-level network device topology map.

6. A multi-level network device topology generation device, It is characterized in that The multi-stage network device topology generating device comprises: A deployment unit, used to obtain at least one subnet and deploy a probe in each subnet; A scanning unit, configured to scan network devices associated with a corresponding subnet using each probe at a preset time interval; A generating unit is used to generate an ICMP data packet for each probe, and inject the local gateway information of the probe to which it belongs into each ICMP data packet to obtain each injected data packet; wherein, the injecting the local gateway information of the probe to which it belongs into each ICMP data packet to obtain each injected data packet comprises: determining the gateway corresponding to the probe to which each ICMP data packet belongs as the local gateway corresponding to each ICMP data packet; obtaining the IP address and MAC address of each local gateway as each local gateway information; injecting each local gateway information into the corresponding ICMP data packet using the libnet interface function library to obtain each injected data packet; a distribution unit, used for distributing each injected data packet to other probes except the probe to which each injected data packet belongs; The parsing unit is used to parse each captured injected data packet using each probe to obtain the TTL attenuation, source IP address and gateway IP address corresponding to the probe of each injected data packet; An analysis unit is used to analyze the connection relationship between the routes where each subnet is located according to the TTL attenuation of each injected data packet, the source IP address and the gateway IP address corresponding to the probe to which it belongs, including: for each injected data packet, when the value of the TTL attenuation is 1 and the source IP address is the same as the gateway IP address, it is determined that the subnet to which the sending probe of the injected data packet belongs and the receiving probe are deployed under the same route; when the value of the TTL attenuation is 1 and the source IP address is different from the gateway IP address, it is determined that the subnet to which the sending probe of the injected data packet and the receiving probe belong is deployed under a route with a direct physical connection relationship; when the value of the TTL attenuation is greater than 1, it is determined that the subnet to which the sending probe of the injected data packet and the receiving probe belong is deployed under a route with an indirect physical connection relationship; the difference between the attenuation and 1 is calculated as the number of intermediate routes connected between the routes with the indirect physical connection relationship; The generating unit is further used to generate a multi-level network device topology diagram of the network device according to the connection relationship.

7. A computer device, It is characterized in that The computer device comprises: a memory storing at least one instruction; and A processor executes instructions stored in the memory to implement the multi-stage network device topology generation method as described in any one of claims 1 to 5.

8. A computer-readable storage medium, Features: The computer-readable storage medium stores at least one instruction, and the at least one instruction is executed by a processor in a computer device to implement the multi-stage network device topology generation method as described in any one of claims 1 to 5.