Network topology automatic discovery method, device, equipment and medium

By obtaining the MAC address table of the network management device and iteratively analyze it, the problem of not being able to discover layer 2 devices and not supporting LLDP protocol devices in the existing technology is solved, and the topology automatic discovery of hybrid networks of different types of devices is realized, and a complete Network topology.

CN119299315AActive Publication Date: 2025-01-10CETC CYBERSPACE SECURITY TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In the existing network topology management method, the topology discovery based on routing tables cannot be discovered, and the LLDP protocol-based method cannot discover the complete topology structure because the device does not support the LLDP protocol in a real network environment.

Method used

By obtaining the MAC address table of the network management device, iteratively analyzes the connection relationship between devices, including the connection relationship between network management devices and type devices, to automatically discover the network topology structure without distinguishing device types.

Benefits of technology

It solves the problem that the layer 2 device cannot be discovered, and realizes topological discovery of hybrid networks of different types of devices without the device supporting the LLDP protocol, and completes the automated construction of the network topology structure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119299315A_ABST
    Figure CN119299315A_ABST
Patent Text Reader

Abstract

The invention discloses a network topology automatic discovery method and device, equipment and a medium, and relates to the technical field of computer networks. The method comprises the following steps: acquiring network management equipment and determining target network management equipment configured with a simple network management protocol from the network management equipment; traversing the target network management equipment to obtain an MAC address table; the MAC address table is used for recording MAC addresses of other devices learned by each device interface of the target network management device; the other devices comprise a network management device and a type device which carries out network configuration through the network management device; performing iterative analysis on the MAC address table by using a preset analysis rule to determine a first connection relationship between the network management devices and a second connection relationship between the network management devices and the type devices; and determining the current network topology structure based on the first connection relationship and the second connection relationship. Through the technical scheme of the invention, the network topology structure can be automatically discovered.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer network technology, and in particular to a method, device, equipment and medium for automatically discovering network topology. Background Art

[0002] Network topology management is the core of enterprise network management. It clarifies the connection relationship between network devices, including routers, switches, gateways, firewalls, servers, and terminals. Clear and accurate network topology management helps locate network faults and analyze performance.

[0003] The current network topology management methods include topology management based on manual maintenance. When the connection between devices changes, timely maintenance is required to ensure the accuracy of the topology structure. There is also automatic discovery of network topology. For this method, some use SNMP (Simple Network Management Protocol) to obtain the routing table of network devices for network topology discovery; some are based on LLDP (Link Layer Discovery Protocol) for network topology discovery.

[0004] The network topology is discovered based on the routing table. The next hop in the routing table is the connected device information. However, the routing table on the switch or router is generally optimized routing information, which makes it impossible to discover the complete topology structure. Moreover, if there is a layer 2 device between the current device and the next hop device, it will not be discovered without routing forwarding.

[0005] Network topology discovery based on LLDP requires that all devices support and enable LLDP. However, in real network environments, there are often a large number of different types of devices that do not support the LLDP protocol, resulting in the inability to discover the complete topology structure.

[0006] Therefore, how to solve the problem that the second layer device cannot be discovered in the topology discovery based on the routing table, and how to solve the discovery when the device does not support the LLDP protocol are problems that technicians in this field need to solve at present. Summary of the invention

[0007] In view of this, the purpose of the present invention is to provide a network topology automatic discovery method, device, equipment and medium, which can solve the problem that the second layer device cannot be discovered in the topology discovery based on the routing table, and the discovery problem when the device does not support the LLDP protocol. The specific scheme is as follows:

[0008] In a first aspect, the present application discloses a method for automatically discovering network topology, comprising:

[0009] Acquire a network management device, and determine a target network management device configured with a simple network management protocol from the network management device;

[0010] Traversing the target network management device to obtain a MAC address table of the target network management device; wherein the MAC address table is used to record the MAC addresses of other devices learned by each device interface of the target network management device; the other devices include the network management device and devices of the type whose network configuration is performed through the network management device;

[0011] Iteratively analyzing the MAC address table using a first preset analysis rule and a second preset analysis rule respectively to determine a first connection relationship between the network management devices and a second connection relationship between the network management device and the type of device;

[0012] A current network topology is determined based on the first connection relationship and the second connection relationship.

[0013] Optionally, after acquiring the network management device and determining the target network management device configured with the simple network management protocol from the network management device, the method further includes:

[0014] The target network management device is traversed to obtain an interface table of the target network management device; wherein the interface table is used to record the interface name of each device interface in the target network management device and the MAC address of the target network management device.

[0015] Optionally, iteratively analyzing the MAC address table by using a first preset analysis rule to determine a first connection relationship between the network management devices includes:

[0016] Traversing the MAC address table to filter out a MAC address that is a first MAC address of the network management device;

[0017] According to the first MAC address, determining, for the target network management device in sequence, a first device interface on which only one MAC address of the network management device has been learned;

[0018] Determine a first network management device corresponding to the first device interface, and determine a corresponding second network management device according to the MAC address learned by the first device interface;

[0019] Establishing a connection relationship between the first network management device and the second network management device;

[0020] Determine, based on the first MAC address, a second device interface on which the MAC addresses of the plurality of network management devices are learned;

[0021] Determine a third network management device corresponding to the second device interface, and determine a corresponding fourth network management device according to the MAC address learned by the second device interface;

[0022] Excluding the first device interface, establishing a connection relationship between the third network management device and the fourth network management device;

[0023] When only one network management device is connected to the device interfaces of all the network management devices, the first connection relationship between the network management devices is determined based on the connection relationship between the first network management device and the second network management device, and the connection relationship between the third network management device and the fourth network management device.

[0024] Optionally, iteratively analyzing the MAC address table by using a second preset analysis rule to determine a second connection relationship between the network management device and the type of device includes:

[0025] Traversing the MAC address table to filter and obtain a second MAC address of a device of the type;

[0026] If the second MAC address corresponds to a plurality of the network management devices, obtaining currently occupied interfaces based on the first connection relationship, and excluding the currently occupied interfaces to obtain remaining devices;

[0027] If the number of the remaining devices is 0, determining that the type of device is in the first connection relationship, and determining the second connection relationship based on the first connection relationship;

[0028] If the number of the remaining devices is 1, a second connection relationship between the type of device and the remaining devices is established.

[0029] Optionally, after the iterative analysis of the MAC address table using the first preset analysis rule and the second preset analysis rule respectively to determine the first connection relationship between the network management devices and the second connection relationship between the network management device and the type of device, the method further includes:

[0030] Traversing the MAC address table, and when detecting that there are multiple MAC addresses on the target device interface on the network management device, determining the current situation type;

[0031] If the current situation type is a type in which the simple network management protocol is not configured in the network management device, obtaining a fifth network management device that is not configured with the simple network management protocol, and configuring the simple network management protocol for the fifth network management device;

[0032] If the current situation type is that the network management device has a type that cannot be configured with the simple network management protocol, a sixth network management device that cannot be configured with the simple network management protocol is obtained, and a multi-port forwarder is configured for the sixth network management device.

[0033] Optionally, after the iterative analysis of the MAC address table using the first preset analysis rule and the second preset analysis rule respectively to determine the first connection relationship between the network management devices and the second connection relationship between the network management device and the type of device, the method further includes:

[0034] The MAC address table is traversed, and when it is detected that the network management device has learned the same type of device, the type of device is inserted into the connection between the network management devices.

[0035] Optionally, the network topology automatic discovery method further includes:

[0036] All MAC addresses in the MAC address table are processed cyclically until all the MAC addresses are respectively connected to a device interface of the network management device.

[0037] In a second aspect, the present application discloses a network topology automatic discovery device, comprising:

[0038] A target device determination module, used to obtain a network management device and determine a target network management device configured with a simple network management protocol from the network management device;

[0039] A MAC address table acquisition module, used to traverse the target network management device to obtain the MAC address table of the target network management device; wherein the MAC address table is used to record the MAC addresses of other devices learned by each device interface of the target network management device; the other devices include the network management device and the type of devices whose network configuration is performed through the network management device;

[0040] an iterative analysis module, configured to iteratively analyze the MAC address table using a first preset analysis rule and a second preset analysis rule respectively, so as to determine a first connection relationship between the network management devices and a second connection relationship between the network management device and the type of device;

[0041] A network topology discovery module is used to determine a current network topology structure based on the first connection relationship and the second connection relationship.

[0042] In a third aspect, the present application discloses an electronic device, comprising a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to implement the network topology automatic discovery method as described above.

[0043] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the network topology automatic discovery method as described above.

[0044] The present application provides a method for automatic discovery of network topology, including: obtaining a network management device, and determining a target network management device configured with a simple network management protocol from the network management device; traversing the target network management device to obtain a MAC address table of the target network management device; wherein the MAC address table is used to record the MAC addresses of other devices learned by each device interface of the target network management device; the other devices include the network management device and the type of devices configured by the network management device; iteratively analyzing the MAC address table using a first preset analysis rule and a second preset analysis rule respectively to determine a first connection relationship between the network management devices, and a second connection relationship between the network management device and the type of devices; determining the current network topology structure based on the first connection relationship and the second connection relationship. It can be seen that by obtaining the MAC address table of the network management device in the network through the simple network management protocol, based on the iterative analysis of the MAC address table, without distinguishing the device type, the problem that the second-layer device cannot be discovered in the topology discovery based on the routing table can be solved, and the discovery of the device that does not support the LLDP protocol can also be solved. In this way, the network topology structure is automatically discovered, and the network topology discovery of a network with mixed devices of different types is completed.

[0045] In addition, the present application provides a network topology automatic discovery device, equipment and storage medium, which correspond to the above-mentioned network topology automatic discovery method and have the same effect as above. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0047] Figure 1 A flow chart of a network topology automatic discovery method disclosed in this application;

[0048] Figure 2 A schematic diagram of a network topology structure disclosed in this application;

[0049] Figure 3 A schematic diagram of a flow chart of a network topology automatic discovery method disclosed in this application;

[0050] Figure 4 A schematic diagram of the structure of a network topology automatic discovery device disclosed in this application;

[0051] Figure 5 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION

[0052] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0053] Currently, some methods for automatic network topology discovery use the SNMP protocol to obtain the routing table of network devices for network topology discovery, while others use LLDP to discover network topology.

[0054] The network topology is discovered based on the routing table. The next hop in the routing table is the connected device information. However, the routing table on the switch or router is generally optimized routing information, which makes it impossible to discover the complete topology structure. Moreover, if there is a layer 2 device between the current device and the next hop device, it will not be discovered without routing forwarding.

[0055] Network topology discovery based on LLDP requires that all devices support and enable LLDP. However, in a real network environment, there are often a large number of different types of devices that do not support the LLDP protocol, resulting in the inability to discover the complete topology structure.

[0056] To this end, the present application provides a network topology automatic discovery solution that can solve the problem that the second-layer device cannot be discovered in the topology discovery based on the routing table, as well as the discovery problem when the device does not support the LLDP protocol.

[0057] The embodiment of the present invention discloses a method for automatically discovering network topology. Figure 1 As shown, the method includes:

[0058] Step S11: Acquire a network management device, and determine a target network management device configured with a simple network management protocol from the network management devices.

[0059] Network management devices are mainly used for network management in communication networks. In the embodiment of the present application, the network management devices in the network topology are first obtained, and then the network management devices are traversed to determine the target network management device in which the SNMP protocol configuration is enabled. The automatic discovery of the network topology is further performed for the target network management device.

[0060] Step S12: Traverse the target network management device to obtain the MAC address table of the target network management device; wherein the MAC address table is used to record the MAC addresses of other devices learned by each device interface of the target network management device; the other devices include the network management device and the type of devices that perform network configuration through the network management device.

[0061] In an embodiment of the present application, the MAC address (Media Access Control Address) table and interface table of the target network management device are obtained through the SNMP protocol. In one embodiment, the MAC address table records the MAC addresses of other devices learned by each interface of the device. In another embodiment, the interface table records the interface name of the device and the MAC address of the device.

[0062] It should be noted that other devices include network management devices and devices that perform network configuration through network management devices. For example, terminal devices, network management devices can provide wireless access to the network or wired access to the network for terminal devices, and may include routers and switches responsible for connecting terminal devices to the Internet.

[0063] Step S13: Iteratively analyzing the MAC address table using the first preset analysis rule and the second preset analysis rule respectively to determine a first connection relationship between the network management devices and a second connection relationship between the network management device and the type of device.

[0064] In a specific implementation, the MAC address table is first analyzed iteratively using a first preset analysis rule to determine a first connection relationship between the network management devices, that is, to construct a topological connection relationship between these network management devices configured with the SNMP protocol.

[0065] Specifically, the steps include:

[0066] Step 1: Traverse the MAC address table to filter and obtain a MAC address that is a first MAC address of the network management device;

[0067] Analyze the topology between network management devices, traverse based on the MAC address table, and filter out the MAC address that is the first MAC address of the network management device. It can be understood that for the current network management device, other connected network management devices can be determined based on the first MAC address.

[0068] Step 2: According to the first MAC address, determine, for the target network management device, in sequence, a first device interface on which only one MAC address of the network management device is learned;

[0069] Step three: determine the first network management device corresponding to the first device interface, and determine the corresponding second network management device according to the MAC address learned by the first device interface.

[0070] Step 4: Establish a connection relationship between the first network management device and the second network management device.

[0071] First save the connection with only one other network management device MAC on the device interface. If only one MAC address of a network management device is learned on the first device interface, build a connection relationship between the two devices, save the first device interface occupied by the connection, and save the interface name used by the device.

[0072] like Figure 2 The figure shows an exemplary network topology, in which SNMP configuration is enabled for SW1, SW2, SW3, SW4, and SW5. The G0 / 0 / 4 interface of SW2 can only learn the MAC address of the network management device SW3, so the connection relationship between SW2 G0 / 0 / 4 and SW3 G0 / 0 / 1 is established, and the connection relationship between SW2 G0 / 0 / 5 and SW4 G0 / 0 / 1 is established in the same way.

[0073] Step 5: According to the first MAC address, determine the second device interface on which the MAC addresses of the plurality of network management devices are learned;

[0074] Step 6: Determine the third network management device corresponding to the second device interface, and determine the corresponding fourth network management device according to the MAC address learned by the second device interface;

[0075] Step 7: Excluding the first device interface, establishing a connection relationship between the third network management device and the fourth network management device.

[0076] After saving the connection with only one other network management device MAC on the device interface, based on the currently established connection relationship, handle the connection with multiple other network management device MACs on the interface. At this time, if the MAC addresses of multiple network management devices are learned on the device interface, the occupied interface needs to be excluded when building the device connection relationship. Specifically, the previously occupied interface can be excluded according to the interface name.

[0077] like Figure 2 As shown, for example, the G0 / 0 / 1 interface of SW1 can learn the MAC addresses of SW2, SW3, and SW4; the G0 / 0 / 1 interface of SW3 may also learn the MAC addresses of SW2 and SW1. However, since the interface addresses of SW3's G0 / 0 / 1 and SW4's G0 / 0 / 1 have been occupied when the connection relationship was previously established, only the connection relationship between SW1 G0 / 0 / 1 and SW2 G0 / 0 / 3 is saved.

[0078] Step 8: When only one network management device is connected to the device interfaces of all the network management devices, determine the first connection relationship between the network management devices based on the connection relationship between the first network management device and the second network management device, and the connection relationship between the third network management device and the fourth network management device.

[0079] Finally, the above steps are continuously iterated until it is analyzed that only one network management device is connected to the interfaces of all network management devices. In this way, the connection relationship between the network management devices is analyzed and obtained.

[0080] In another specific implementation, after the topology construction of the network management device is completed, the MAC address table is iteratively analyzed using a second preset analysis rule to determine a second connection relationship between the network management device and the type of device, that is, to construct a connection relationship between the network management device and the type of device, such as a terminal, a server, and the like.

[0081] Specifically, the steps include:

[0082] Step 1: traverse the MAC address table to filter and obtain a second MAC address of the type of device;

[0083] Step 2: If the second MAC address corresponds to a plurality of the network management devices, obtaining currently occupied interfaces based on the first connection relationship, and excluding the currently occupied interfaces to obtain remaining devices;

[0084] Step 3: If the number of the remaining devices is 0, determine that the type of device is in the first connection relationship, and determine the second connection relationship based on the first connection relationship;

[0085] Step 4: If the number of the remaining devices is 1, a second connection relationship is established between the type of device and the remaining devices.

[0086] After analyzing the topological connection relationship between network management devices, start processing other MAC addresses learned on the network management device, which correspond to the MAC addresses of the type devices. In the process of building the connection between the network management device and the type device, if the MAC address exists on multiple network management devices, exclude the interface of the network management device that has been occupied. If there is only one left, the type device is connected to the remaining one. If there is no remaining, it means that the type device is between the network management devices built in the previous step.

[0087] like Figure 2 As shown in the figure, G0 / 0 / 4 of SW2 may learn the MAC of PC1 and PC2, G0 / 0 / 2 of SW3 will learn the MAC of PC1, and G0 / 0 / 3 will learn the MAC of PC2, but the G0 / 0 / 4 interface of SW2 is already occupied, so PC1 and PC2 are connected to SW3.

[0088] In a feasible implementation manner, excluding the interfaces that have been occupied by the network management device, there are still multiple interfaces left, which means that there is no SNMP information configured in the network management device and configuration needs to be added.

[0089] Step S14: determining a current network topology based on the first connection relationship and the second connection relationship.

[0090] like Figure 3 The figure shows the overall process diagram combined with the above steps. In the process of building the network topology, first traverse each device configured with SNMP to obtain the MAC address table. Secondly, analyze the connection relationship between the network management devices and the connection relationship between the type of device and the network management device in turn. Finally, based on the connection relationship obtained by the above analysis, complete the overall network topology analysis and obtain the network topology structure. In this way, it is possible to obtain the MAC address table of management devices such as switches and routers in the network through SNMP, and automatically discover the network topology structure based on the iterative analysis of the MAC address table.

[0091] The present application provides a method for automatic discovery of network topology, including: obtaining a network management device, and determining a target network management device configured with a simple network management protocol from the network management device; traversing the target network management device to obtain a MAC address table of the target network management device; wherein the MAC address table is used to record the MAC addresses of other devices learned by each device interface of the target network management device; the other devices include the network management device and the type of devices configured by the network management device; iteratively analyzing the MAC address table using a first preset analysis rule and a second preset analysis rule respectively to determine a first connection relationship between the network management devices, and a second connection relationship between the network management device and the type of devices; determining the current network topology structure based on the first connection relationship and the second connection relationship. It can be seen that by obtaining the MAC address table of the network management device in the network through the simple network management protocol, based on the iterative analysis of the MAC address table, without distinguishing the device type, the problem that the second-layer device cannot be discovered in the topology discovery based on the routing table can be solved, and the discovery of the device that does not support the LLDP protocol can also be solved. In this way, the network topology structure is automatically discovered, and the network topology discovery of a network with mixed devices of different types is completed.

[0092] Based on the above embodiment, in a feasible implementation, the connection relationship between the devices needs to be specially processed. Specifically, the following steps may be included:

[0093] Traversing the MAC address table, and when detecting that there are multiple MAC addresses on the target device interface on the network management device, determining the current situation type;

[0094] If the current situation type is a type in which the simple network management protocol is not configured in the network management device, obtaining a fifth network management device that is not configured with the simple network management protocol, and configuring the simple network management protocol for the fifth network management device;

[0095] If the current situation type is that the network management device has a type that cannot be configured with the simple network management protocol, a sixth network management device that cannot be configured with the simple network management protocol is obtained, and a multi-port forwarder is configured for the sixth network management device.

[0096] In the embodiment of the present application, after processing all MAC addresses, there may be a situation where there are multiple MAC addresses on one interface of the network management device. There may be two reasons for this situation: one is that there is a HUB under the interface, and then many devices are connected. The other is that there is a network management device under the interface that has no SNMP information configured and needs to be configured.

[0097] like Figure 2 As shown in the figure, the SW6 device connected to the G0 / 0 / 2 interface of SW4 is not configured with SNMP; or SW6 is a HUB and cannot be configured with SNMP. At this time, there are multiple MAC addresses under the G0 / 0 / 2 interface of SW4. Add a virtual HUB connected to the G0 / 0 / 2 interface, and then connect the MAC device under the G0 / 0 / 2 interface to the virtual HUB.

[0098] Based on the above embodiment, in another feasible implementation, the connection relationship between the devices needs to be specially processed. Specifically, the following steps may be included:

[0099] The MAC address table is traversed, and when it is detected that the network management device has learned the same type of device, the type of device is inserted into the connection between the network management devices.

[0100] In the embodiment of the present application, after processing all MAC addresses, there may be a situation where the network management device learns the same type of device, that is, other MAC addresses are inserted between the network management devices. Figure 2 As shown, in the aforementioned implementation process, the connection relationship between SW1 G0 / 0 / 2 and SW5 G0 / 0 / 3 has been analyzed. When processing other MACs, it is found that SW1G0 / 0 / 2 and SW5 G0 / 0 / 3 have learned the MAC address of gateway 1, or other devices that are not configured or cannot be configured with SNMP, so this type of device is inserted into the existing connection between SW1 and SW5.

[0101] It should be noted that, based on the MAC address table, all MAC addresses in the MAC address table are processed cyclically until all the MAC addresses are respectively connected to a device interface of the network management device.

[0102] In summary, by obtaining the MAC address tables of management devices such as switches and routers in the network through SNMP, the network topology can be automatically discovered based on iterative analysis of the MAC address tables.

[0103] Accordingly, the present application also discloses a network topology automatic discovery device, see Figure 4 As shown, the device comprises:

[0104] The target device determination module 11 is used to obtain a network management device and determine a target network management device configured with a simple network management protocol from the network management device;

[0105] A MAC address table acquisition module 12 is used to traverse the target network management device to obtain the MAC address table of the target network management device; wherein the MAC address table is used to record the MAC addresses of other devices learned by each device interface of the target network management device; the other devices include the network management device and the type of devices that perform network configuration through the network management device;

[0106] An iterative analysis module 13, configured to perform iterative analysis on the MAC address table using a first preset analysis rule and a second preset analysis rule, respectively, to determine a first connection relationship between the network management devices, and a second connection relationship between the network management device and the type of device;

[0107] The network topology discovery module 14 is configured to determine a current network topology structure based on the first connection relationship and the second connection relationship.

[0108] Among them, for more specific working processes of the above-mentioned modules, please refer to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.

[0109] It can be seen that the above scheme of this embodiment includes: obtaining a network management device, and determining a target network management device configured with a simple network management protocol from the network management device; traversing the target network management device to obtain a MAC address table of the target network management device; wherein the MAC address table is used to record the MAC addresses of other devices learned by each device interface of the target network management device; the other devices include the network management device and the type of devices configured by the network management device; the MAC address table is iteratively analyzed using the first preset analysis rule and the second preset analysis rule respectively to determine the first connection relationship between the network management devices and the second connection relationship between the network management device and the type of devices; the current network topology is determined based on the first connection relationship and the second connection relationship. It can be seen that by obtaining the MAC address table of the network management device in the network through the simple network management protocol, based on the iterative analysis of the MAC address table, without distinguishing the device type, the problem that the second-layer device cannot be discovered in the topology discovery based on the routing table can be solved, and the discovery of the device that does not support the LLDP protocol can also be solved. In this way, the network topology is automatically discovered, and the network topology discovery of the network mixed with different types of devices is completed.

[0110] Furthermore, the present application also discloses an electronic device. Figure 5 This is a structural diagram of an electronic device 20 according to an exemplary embodiment, and the content in the diagram cannot be considered as any limitation on the scope of use of the present application.

[0111] Figure 5 The present invention provides a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the network topology automatic discovery method disclosed in any of the aforementioned embodiments.

[0112] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0113] In addition, the memory 22 as a carrier for resource storage may be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon may include an operating system 221, a computer program 222 and data 223, etc. The data 223 may include various data. The storage method may be temporary storage or permanent storage.

[0114] The operating system 221 is used to manage and control the hardware devices and computer program 222 on the electronic device 20, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the network topology automatic discovery method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.

[0115] Furthermore, the embodiment of the present application also discloses a computer-readable storage medium, wherein the computer-readable storage medium mentioned here includes a random access memory (Random Access Memory, RAM), a memory, a read-only memory (Read-Only Memory, ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a magnetic disk or an optical disk, or any other form of storage medium known in the technical field. Wherein, when the computer program is executed by the processor, the aforementioned network topology automatic discovery method is implemented. For the specific steps of the method, reference can be made to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.

[0116] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0117] The steps of the network topology automatic discovery method or algorithm described in conjunction with the embodiments disclosed herein can be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module can be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the technical field.

[0118] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0119] The above is a detailed introduction to a network topology automatic discovery method, device, equipment and medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A method for automatically discovering network topology, characterized in that: include: Acquire a network management device, and determine a target network management device configured with a simple network management protocol from the network management device; Traversing the target network management device to obtain a MAC address table of the target network management device; wherein the MAC address table is used to record the MAC addresses of other devices learned by each device interface of the target network management device; the other devices include the network management device and devices of the type whose network configuration is performed through the network management device; Iteratively analyzing the MAC address table using a first preset analysis rule and a second preset analysis rule respectively to determine a first connection relationship between the network management devices and a second connection relationship between the network management device and the type of device; A current network topology is determined based on the first connection relationship and the second connection relationship.

2. The network topology automatic discovery method according to claim 1, characterized in that: After acquiring the network management device and determining the target network management device configured with the simple network management protocol from the network management device, the method further includes: The target network management device is traversed to obtain an interface table of the target network management device; wherein the interface table is used to record the interface name of each device interface in the target network management device and the MAC address of the target network management device.

3. The network topology automatic discovery method according to claim 1, characterized in that: Iteratively analyzing the MAC address table using a first preset analysis rule to determine a first connection relationship between the network management devices includes: Traversing the MAC address table to filter out a MAC address that is a first MAC address of the network management device; According to the first MAC address, determining, for the target network management device in sequence, a first device interface on which only one MAC address of the network management device has been learned; Determine a first network management device corresponding to the first device interface, and determine a corresponding second network management device according to the MAC address learned by the first device interface; Establishing a connection relationship between the first network management device and the second network management device; Determine, based on the first MAC address, a second device interface on which the MAC addresses of the plurality of network management devices are learned; Determine a third network management device corresponding to the second device interface, and determine a corresponding fourth network management device according to the MAC address learned by the second device interface; Excluding the first device interface, establishing a connection relationship between the third network management device and the fourth network management device; When only one network management device is connected to the device interfaces of all the network management devices, the first connection relationship between the network management devices is determined based on the connection relationship between the first network management device and the second network management device, and the connection relationship between the third network management device and the fourth network management device.

4. The network topology automatic discovery method according to claim 1, characterized in that: Iteratively analyzing the MAC address table using a second preset analysis rule to determine a second connection relationship between the network management device and the type of device, including: Traversing the MAC address table to filter and obtain a second MAC address of a device of the type; If the second MAC address corresponds to a plurality of the network management devices, obtaining currently occupied interfaces based on the first connection relationship, and excluding the currently occupied interfaces to obtain remaining devices; If the number of the remaining devices is 0, determining that the type of device is in the first connection relationship, and determining the second connection relationship based on the first connection relationship; If the number of the remaining devices is 1, a second connection relationship between the type of device and the remaining devices is established.

5. The network topology automatic discovery method according to claim 1, characterized in that: After the MAC address table is iteratively analyzed using the first preset analysis rule and the second preset analysis rule respectively to determine the first connection relationship between the network management devices and the second connection relationship between the network management device and the type of device, the method further includes: Traversing the MAC address table, and when detecting that there are multiple MAC addresses on the target device interface on the network management device, determining the current situation type; If the current situation type is a type in which the simple network management protocol is not configured in the network management device, obtaining a fifth network management device that is not configured with the simple network management protocol, and configuring the simple network management protocol for the fifth network management device; If the current situation type is that the network management device has a type that cannot be configured with the simple network management protocol, a sixth network management device that cannot be configured with the simple network management protocol is obtained, and a multi-port forwarder is configured for the sixth network management device.

6. The network topology automatic discovery method according to claim 1, characterized in that: After the MAC address table is iteratively analyzed using the first preset analysis rule and the second preset analysis rule respectively to determine the first connection relationship between the network management devices and the second connection relationship between the network management device and the type of device, the method further includes: The MAC address table is traversed, and when it is detected that the network management device has learned the same type of device, the type of device is inserted into the connection between the network management devices.

7. The network topology automatic discovery method according to claim 5 or 6, characterized in that: Also includes: All MAC addresses in the MAC address table are processed cyclically until all the MAC addresses are respectively connected to a device interface of the network management device.

8. A network topology automatic discovery device, characterized in that: include: A target device determination module, used to obtain a network management device and determine a target network management device configured with a simple network management protocol from the network management device; A MAC address table acquisition module, used to traverse the target network management device to obtain the MAC address table of the target network management device; wherein the MAC address table is used to record the MAC addresses of other devices learned by each device interface of the target network management device; the other devices include the network management device and the type of devices whose network configuration is performed through the network management device; an iterative analysis module, configured to iteratively analyze the MAC address table using a first preset analysis rule and a second preset analysis rule respectively, so as to determine a first connection relationship between the network management devices and a second connection relationship between the network management device and the type of device; A network topology discovery module is used to determine a current network topology structure based on the first connection relationship and the second connection relationship.

9. An electronic device, characterized in that: The electronic device comprises a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to implement the network topology automatic discovery method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: Used to store computer programs; wherein when the computer program is executed by the processor, the network topology automatic discovery method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Method and device for discovering network topology

    CN102694689A

  • Network administration device and method for discovery of network topology

    CN103036725A

  • Network topology structure generation method and device, equipment and medium

    CN111600762A

  • Method and device for determining network topology and computer storage medium

    CN112751714A

  • Apparatus and method for topology discovery among network devices

    US20050270986A1