CN109257225B - Method, device, storage medium and processor for generating network topology - Google Patents

Method, device, storage medium and processor for generating network topology Download PDF

Info

Publication number
CN109257225B
CN109257225B CN201811191139.3A CN201811191139A CN109257225B CN 109257225 B CN109257225 B CN 109257225B CN 201811191139 A CN201811191139 A CN 201811191139A CN 109257225 B CN109257225 B CN 109257225B
Authority
CN
China
Prior art keywords
dictionary
core switch
network
generating
port
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811191139.3A
Other languages
Chinese (zh)
Other versions
CN109257225A (en
Inventor
吴中仁
乞宗勃
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Xinyan Huizhi Information Technology Co ltd
Original Assignee
Beijing Xinyan Huizhi Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Xinyan Huizhi Information Technology Co ltd filed Critical Beijing Xinyan Huizhi Information Technology Co ltd
Priority to CN201811191139.3A priority Critical patent/CN109257225B/en
Priority to CN202110850948.6A priority patent/CN113572645B/en
Publication of CN109257225A publication Critical patent/CN109257225A/en
Application granted granted Critical
Publication of CN109257225B publication Critical patent/CN109257225B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/12Discovery or management of network topologies
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/618Details of network addresses
    • H04L2101/622Layer-2 addresses, e.g. medium access control [MAC] addresses

Abstract

The invention discloses a method, a device, a storage medium and a processor for generating network topology. Wherein, the method comprises the following steps: acquiring equipment information of network equipment in a specified network segment; generating a core switch connection equipment dictionary based on the network address of the core switch according to the equipment information, wherein the core switch connection equipment dictionary is used for recording the switch information directly connected with the core switch; generating a non-core switch connection relation dictionary according to the core switch connection equipment dictionary and the equipment information based on the network address of the core switch, wherein the non-core switch connection relation dictionary is used for recording the connection relation between the non-core switches; and generating a network topology map according to the core switch connection equipment dictionary and the non-core switch connection relation dictionary. The invention solves the technical problem that the completeness requirement of the MAC address forwarding table information of all switches is high in the prior art based on the method for generating the network topology by the MAC address forwarding table.

Description

Method, device, storage medium and processor for generating network topology
Technical Field
The present invention relates to the field of networks, and in particular, to a method, an apparatus, a storage medium, and a processor for generating a network topology.
Background
Network topology discovery refers to discovering network devices and the interconnection relationship between devices existing in a network. Typically, a network device (e.g., firewall, router, switch, etc.) will assign a "management address" for the management device after deployment and online, and this "management address" is the IP address described in the network topology discovery. Since network devices typically have many ports, these ports are used to connect to either another network device or to external devices such as servers, personal computers, printers, etc. Specifically, which two ports between two network devices are connected to each other, and which port of a network device is connected to the network card of another device, are the connection relationships described in the network topology discovery.
When discovering an IP address of a Network device and a connection relationship between the Network devices in the prior art, it is first necessary to scan a subnet where the device is located through an Internet Control Message Protocol (ICMP) Protocol, and after acquiring a communicable IP address, it is tried to acquire device-related information through a Simple Network Management Protocol (SNMP); and then analyzing the equipment information acquired through the SNMP protocol to obtain the connection relation between the equipment. At present, there are two main ways of analyzing device information obtained by an SNMP protocol:
in the first, data is collected and analyzed by a proximity device discovery protocol. Since the neighbor discovery protocol varies from manufacturer to manufacturer, from device make to device make, and from model to model. For example, for Cisco devices, the CDP protocol, and for Huaye, Huasan early devices, the NDP protocol. After 2000, the international standards organization IEEE issued the RFC2922 specification, in which a new vendor-independent neighbor Discovery Protocol, Link Layer Discovery Protocol (LLDP), was defined, and after 2006, vendors began to continuously comply with this Protocol.
In the second mode, ARP table and bridging table information of network equipment are read through SNMP, and then the ARP table and the bridging table of all the equipment are summarized and analyzed to generate a network topological graph. The information recorded in the ARP table is the correspondence between the IP address and the MAC address known to the network device. The bridging table records the corresponding relation between the MAC address table and the network equipment port.
For the first way, due to the implementation principle of the neighbor discovery protocol: the network device which opens the protocol will periodically send data packet to the device connected with it, the data packet contains source device address and port information, so that the adjacent device which receives the data packet will store the information in its own memory to form the completed adjacent device list. Therefore, it is easy to implement the discovery function of the network topology as long as the protocol is opened, and it is sufficient to read and summarize the adjacent device table from all the network devices. But network topology discovery via the adjacency device discovery protocol faces several problems:
(1) there may be devices in the network that do not support the discovery protocol of the neighboring device, such devices being not discoverable by the discovery protocol of the neighboring device;
(2) due to different manufacturers, brands and models of devices, the adjacent device discovery protocols may be different, and the problem of incompatibility exists. As described above, before the advent of the unified LLDP protocol, some vendors developed neighbor discovery protocols for their devices, such as cisco's CDP protocol and chengyi NDP protocol, which were incompatible due to differences in data format and operation mode. So if a cisco device and a legacy device are connected to each other while being placed in the same lan, no other device will be registered in their respective neighbor lists.
(3) Incomplete SNMP support. Although some network devices implement the general LLDP protocol, the neighbor device information table may not be obtained through the SNMP protocol, and further effective neighbor device discovery information cannot be collected through the SNMP protocol.
(4) The LLDP protocol defaults to the "off" state on most devices, requiring a network administrator to log in the devices in turn and "open" the protocol, where the LLDP can work normally and there is data in the neighbor list.
Therefore, it can be seen that, by the first way, the network topology discovery is performed by using the neighbor discovery protocol, and the network topology cannot be generated or is not complete.
For the second mode, the working principle of the switching network device is to realize data exchange among the plurality of connected PCs, servers and other peripherals. In the data exchange process, the exchange records the MAC address learned from the port on each port, so that when one device communicates with another device, the device converts the IP address of the opposite device into the MAC address through the ARP protocol, and then informs the MAC address to the exchange, and the exchange knows which port to forward the data through only looking up the bridging table.
However, in the second method, the generation of the network topology by the forwarding table still has a certain difficulty because: one MAC address may be recorded or a plurality of MAC addresses may be recorded in the forwarding table of a specific port. If only one MAC address is recorded, the network equipment can be considered to be directly connected with the equipment corresponding to the MAC address; if a plurality of MAC addresses are recorded, it is highly likely that another network device is connected to the network device, and another network device is connected to the devices corresponding to the MAC addresses, respectively, which makes it difficult to determine which device is the "another network device".
Aiming at the problem that the completeness requirement of the MAC address forwarding table information of all switches is high by the method for generating the network topology based on the MAC address forwarding table in the prior art, an effective solution is not provided at present.
Disclosure of Invention
The embodiment of the invention provides a method, a device, a storage medium and a processor for generating a network topology, which at least solve the technical problem that the completeness requirement on MAC address forwarding table information of all switches is high in the prior art and the method for generating the network topology based on an MAC address forwarding table.
According to an aspect of an embodiment of the present invention, there is provided a method for generating a network topology, including: acquiring equipment information of network equipment in a specified network segment, wherein the equipment information comprises at least one of the following: the device comprises a device identifier, a mapping table for mapping a network address of the network device into a physical address, and device forwarding information; generating a core switch connection equipment dictionary based on the network address of the core switch according to the equipment information, wherein the core switch connection equipment dictionary is used for recording the switch information directly connected with the core switch; generating a non-core switch connection relation dictionary according to the core switch connection equipment dictionary and the equipment information based on the network address of the non-core switch, wherein the non-core switch connection relation dictionary is used for recording the connection relation between the non-core switches; and generating a network topology map according to the core switch connection equipment dictionary and the non-core switch connection relation dictionary.
According to another aspect of the embodiments of the present invention, there is also provided an apparatus for generating a network topology, including: the device comprises a collecting unit and a processing unit, wherein the collecting unit is used for collecting the device information of the network device in the appointed network segment, and the device information comprises at least one of the following: the device comprises a device identifier, a mapping table for mapping a network address of the network device into a physical address, and device forwarding information; the core switch connection device dictionary is used for recording switch information directly connected with the core switch; a second generating unit, configured to generate a non-core switch connection relation dictionary according to the core switch connection device dictionary and the device information based on a network address of the non-core switch, where the non-core switch connection relation dictionary is used to record a connection relation between non-core switches; and a third generating unit, configured to generate a network topology map according to the core switch connection device dictionary and the non-core switch connection relationship dictionary.
According to another aspect of the embodiments of the present invention, there is also provided a storage medium including a stored program, wherein the program performs the above-mentioned method of generating a network topology.
According to another aspect of the embodiments of the present invention, there is also provided a processor, configured to execute a program, where the program executes the method for generating a network topology described above.
In the embodiment of the invention, the device information of the network device in the specified network segment is acquired, wherein the device information comprises at least one of the following: the device comprises a device identifier, a mapping table for mapping a network address of the network device into a physical address, and device forwarding information; generating a core switch connection equipment dictionary based on the network address of the core switch according to the equipment information, wherein the core switch connection equipment dictionary is used for recording the switch information directly connected with the core switch; generating a non-core switch connection relation dictionary according to the core switch connection equipment dictionary and the equipment information based on the network address of the non-core switch, wherein the non-core switch connection relation dictionary is used for recording the connection relation between the non-core switches; the network topology map is generated according to the core switch connection equipment dictionary and the non-core switch connection relation dictionary, the purpose of discovering the network topology based on the MAC address forwarding table is achieved under the condition that the MAC address forwarding table information of the network equipment is not required to be complete, the technical effect of generating the complete network topology is achieved, and the technical problem that in the prior art, the completeness requirement on the MAC address forwarding table information of all switches is high due to the method for generating the network topology based on the MAC address forwarding table is solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the invention and not to limit the invention. In the drawings:
fig. 1 is a flowchart of a method for generating a network topology according to an embodiment of the present invention; and
fig. 2 is a schematic diagram of an apparatus for generating a network topology according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
As can be seen from the contents recorded in the background section of the present application, the existing methods for generating a network topology mainly include two types: the related art of network topology discovery includes a technique of generating a network topology by a proximity device discovery protocol and a technique of generating a network topology based on a MAC address forwarding table.
In the technology for generating a network topology based on an adjacent device discovery protocol, because the support degree and the protocol type of network devices are different, a complete result cannot be obtained when network topology discovery and a network topology drawing are performed.
The network topology discovery algorithm based on the MAC address forwarding table has a key prerequisite that the MAC address forwarding table information of all switches is complete, that is, all the devices accessing the network must learn the MAC address through a certain port of a certain switch. This is a relatively demanding requirement, which is often not met. Such algorithms also often fail to yield a relatively complete network topology.
The scheme collects information of an ARP table and a forwarding table of network equipment through an SNMP protocol, collects the information, collects and analyzes the information, and generates the network topology. The method for generating the network topology based on the MAC address forwarding table does not have the conditions of incompatibility and incompatibility similar to the adjacent equipment discovery protocol, and meanwhile, the requirement on the completeness of the equipment MAC address forwarding table is relatively low.
In the above application scenarios, there is also provided an embodiment of a method for generating a network topology according to the embodiments of the present invention, it should be noted that the steps illustrated in the flowchart of the drawings may be executed in a computer system, such as a set of computer-executable instructions, and that although a logical order is illustrated in the flowchart, in some cases, the steps illustrated or described may be executed in an order different from the order presented herein.
Fig. 1 is a flowchart of a method for generating a network topology according to an embodiment of the present invention. As shown in fig. 1, the method comprises the following steps:
step S101, collecting equipment information of network equipment in a specified network segment, wherein the equipment information comprises at least one of the following: the device comprises a device identification, a mapping table for mapping the network address of the network device into a physical address, and device forwarding information.
In particular, the network devices include, but are not limited to, firewalls, routers, switches, and the like. Alternatively, the device identifier may be a device name of a network device, the network address may be an IP address of the network device, the mapping table for mapping the network address of the network device to a physical address may be an ARP table, and the specified network segment may be a given IP address segment.
As an optional implementation, scanning is performed on a given IP address segment, and for devices that can be connected, device names, ARP tables, port descriptions, and port forwarding table information are collected respectively through an SNMP protocol.
Alternatively, after step S101, the device information may be stored in a file with a predetermined format according to each network address in the designated network segment. That is, after the device information of the network device in the specified network segment is collected in step S101, the collected information is stored in a specific directory according to a network address (for example, an IP address), in an alternative embodiment, the storage format may be JSON, for example, the IP address of the collected device is 192.168.1.1, and the storage directory is/net, and the storage path is/net/192.168.1.1 JSON.
As an alternative implementation, after the device information is stored in a file with a predetermined format according to each network address in the designated network segment, the method further includes at least one of the following: reading a mapping table stored in a file with a preset format and used for mapping the network address of the network equipment into a physical address, and generating a first mapping table dictionary, wherein the first mapping table dictionary is used for mapping the network address of the network equipment into the physical address; reading device forwarding information stored in a file with a preset format, and generating a second mapping table dictionary, wherein the second mapping table dictionary is used for mapping a physical address of a source network device to a network port of a destination network device; and reading the device forwarding information stored in the file with the preset format, and generating a third mapping table dictionary, wherein the third mapping table dictionary is used for mapping the network port of the source network device to the physical address of the destination network device.
Specifically, the first mapping table dictionary may be an ARP information table dictionary, and the ARP information table dictionary is constructed by reading all pieces of stored ARP table information. The second mapping table dictionary may be an MAC address-IP port dictionary, and the MAC address-IP port field is constructed by reading all the saved device forwarding table information. The third mapping table dictionary may be an IP port-MAC address dictionary, which is constructed by reading all the saved device forwarding table information. Alternatively, the device name dictionary may also be constructed by reading all the saved device names.
Step S102, based on the network address of the core switch, according to the device information, a core switch connection device dictionary is generated, wherein the core switch connection device dictionary is used for recording the switch information directly connected with the core switch.
Specifically, the generating the core switch connection device dictionary according to the device information based on the network address of the core switch may include the following steps: acquiring a network address of a core switch; generating an uplink port dictionary according to the first mapping table dictionary, the second mapping table dictionary and the third mapping table dictionary based on the network address of the core switch, wherein the uplink port dictionary is used for recording port information of an uplink port of the non-core switch, and the uplink port is a port which is used for being connected with the core switch and is arranged on the non-core switch; generating a downlink port dictionary based on the network address of the core switch according to the first mapping table dictionary, the second mapping table dictionary, the third mapping table dictionary and the uplink port dictionary, wherein the downlink port dictionary is used for recording the mapping information of the physical address of a non-uplink port of the non-core switch and the network port, and the non-uplink port is a port which is not used for being connected with the core switch on the non-core switch; and generating a core switch connection equipment dictionary based on the network address of the core switch according to the first mapping table dictionary, the second mapping table dictionary, the third mapping table dictionary, the uplink port dictionary and the downlink port dictionary.
For example, after an IP address of a given core switch is given, all upstream ports (ports from the non-core switch to the core switch) are calculated from the address of the given core switch, the ARP dictionary, the IP port-MAC address dictionary, and the MAC address-IP port dictionary, and recorded in the upstream port dictionary. Then, calculating all MAC addresses learned from the non-uplink ports according to the given IP address of the core switch, the ARP dictionary, the IP port-MAC address dictionary, the MAC address-IP port dictionary and the uplink port dictionary, and recording the MAC addresses learned from the non-uplink ports to the MAC address-IP port dictionary table; calculating all downlink ports according to a given IP address of the core switch, an ARP dictionary, an IP port-MAC address dictionary, an MAC address-IP port dictionary and a non-uplink port MAC address-IP port dictionary table, and recording the downlink ports to the downlink port dictionary; and finally, according to the IP address, the ARP dictionary, the IP port-MAC address dictionary, the uplink port dictionary and the downlink port dictionary of the core switch, calculating to obtain a switch directly connected with the core switch, and recording the switch directly connected with the equipment dictionary of the core switch.
It should be noted that, before generating the core switch connection device dictionary according to the device information based on the network address of the core switch, the method for determining whether the switch in the specified network segment is directly connected to the core switch is as follows: judging whether the uplink port of the switch in the specified network segment and the downlink port of the core switch have the same physical address or not; and determining the switch directly connected with the core switch in the specified network segment according to the judgment result, wherein the uplink port of the switch directly connected with the core switch and the downlink port of the core switch do not have the same physical address. That is, if there is no same MAC address between the uplink port of a certain switch and the downlink port of the core switch, it indicates that the switch is directly connected to the core switch.
Optionally, if a plurality of identical physical addresses exist in the upstream port of any one switch in the specified network segment and the downstream port of the core switch, the physical addresses of the switches with the identical physical addresses exist in a physical address conflict table, where the physical address conflict table is used for generating a network topology after manual configuration, so that all the switches appear in the network topology map. That is, if there are multiple (it is easy to note that, the number of the same MAC addresses may be any number, and the application may be more than 1 but less than 3, after being tested for multiple times) the same MAC addresses on the upstream port of the switch and the downstream port of the core switch, these MAC addresses are recorded in the MAC address collision table.
Step S103, based on the network address of the non-core switch, generating a non-core switch connection relation dictionary according to the core switch connection equipment dictionary and the equipment information, wherein the non-core switch connection relation dictionary is used for recording the connection relation between the non-core switches.
Specifically, after the core switch connection device dictionary is generated through the above step S102, the non-core switch connection relationship dictionary may be generated from the first mapping table dictionary, the second mapping table dictionary, the third mapping table dictionary, the upstream port dictionary, the downstream port dictionary, and the core switch connection device dictionary based on the network address of the non-core switch.
For example, the connection relationship between other non-core switches is calculated according to the non-core switch IP address, the ARP dictionary, the IP port-MAC address dictionary, the uplink port dictionary, the non-uplink port MAC address-IP port dictionary, the core switch direct-connected device dictionary, and the MAC address-IP port dictionary, and recorded in the non-core switch connection relationship dictionary table.
And step S104, generating a network topology map according to the core switch connection equipment dictionary and the non-core switch connection relation dictionary.
Specifically, the network topology map may be generated by summarizing the core switch connection device dictionary and the non-core switch connection relationship dictionary. If the switch which can not be connected into the network topology map exists, the physical address conflict table can be displayed to an operator through an interface form, the operator chooses to ignore MAC addresses in the conflict table, and then the network topology is generated until all switches can appear in the network topology map. It can be seen that, for the switch which cannot find the association relationship, the mechanism for conflict resolution is provided by the generated physical address conflict table, so that a complete topological graph is generated as far as possible.
As can be seen from the above, in the above embodiments of the present application, by collecting the device information of the network device in the given network segment, and based on the network address of the given core switch, generating the core switch connection device dictionary for recording the switch information directly connected to the core switch according to the collected device information, and further based on the network address of the given core switch, according to the collected device information and the switch information directly connected to the core switch recorded in the core switch connection device dictionary, generating the non-core switch connection relationship dictionary for recording the connection relationship between the non-core switches, so as to generate the corresponding network topology map according to the core switch connection device dictionary and the non-core switch connection relationship dictionary, under the condition that the MAC address forwarding table information of the network device is not required to be complete, the purpose of discovering the network topology based on the MAC address forwarding table is achieved, the technical effect of generating the complete network topology is achieved, and the technical problem that in the prior art, the completeness requirement on the MAC address forwarding table information of all switches is high due to the method for generating the network topology based on the MAC address forwarding table is solved.
According to an embodiment of the present invention, an embodiment of an apparatus for implementing the method for generating a network topology is further provided, and fig. 2 is a schematic diagram of an apparatus for generating a network topology according to an embodiment of the present invention, as shown in fig. 2, the apparatus may include: an acquisition unit 201, a first generation unit 202, a second generation unit 203, and a third generation unit 204.
The acquiring unit 201 is configured to acquire device information of a network device in a specified network segment, where the device information includes at least one of the following: the device comprises a device identifier, a mapping table for mapping a network address of the network device into a physical address, and device forwarding information;
a first generating unit 202, configured to generate a core switch connection device dictionary according to device information based on a network address of a core switch, where the core switch connection device dictionary is used to record switch information directly connected to the core switch;
a second generating unit 203, configured to generate a non-core switch connection relation dictionary according to the core switch connection device dictionary and the device information based on the network address of the non-core switch, where the non-core switch connection relation dictionary is used to record a connection relation between non-core switches;
a third generating unit 204, configured to generate a network topology map according to the core switch connection device dictionary and the non-core switch connection relation dictionary.
It should be noted here that the above-mentioned acquisition unit 201, first generation unit 202, second generation unit 203, and third generation unit 204 correspond to steps S101 to S104 in the method embodiment, and the above-mentioned modules are the same as the examples and application scenarios realized by the corresponding steps, but are not limited to the disclosure of the above-mentioned method embodiment. It should be noted that the modules described above as part of an apparatus may be implemented in a computer system such as a set of computer-executable instructions.
As can be seen from the above, in the above embodiments of the present application, the device information of the network device in the given network segment is collected by the collection unit 201, the first generation unit 202 generates the core switch connection device dictionary for recording the switch information directly connected to the core switch according to the collected device information based on the network address of the given core switch, the second generation unit 203 generates the non-core switch connection relationship dictionary for recording the connection relationship between the non-core switches according to the collected device information and the switch information directly connected to the core switch recorded in the core switch connection device dictionary based on the network address of the given non-core switch, so as to generate the corresponding network topology map according to the core switch connection device dictionary and the non-core switch connection relationship dictionary by the third generation unit 204, the method achieves the purpose of discovering the network topology based on the MAC address forwarding table under the condition that the completeness of the MAC address forwarding table information of the network equipment is not required, thereby achieving the technical effect of generating the complete network topology, and further solving the technical problem that the completeness of the MAC address forwarding table information of all switches is required by the prior art and the method for generating the network topology based on the MAC address forwarding table.
In an alternative embodiment, the apparatus further includes: the judging unit is used for judging whether the uplink port of the switch in the specified network segment and the downlink port of the core switch have the same physical address or not; and the determining unit is used for determining the switch which is directly connected with the core switch in the appointed network segment according to the judgment result, wherein the uplink port of the switch which is directly connected with the core switch and the downlink port of the core switch do not have the same physical address.
In an alternative embodiment, the apparatus further comprises: and the recording unit is used for recording the physical addresses of the switches with the same physical addresses into a physical address conflict table if a plurality of same physical addresses exist in the uplink port of any switch in the specified network segment and the downlink port of the core switch, wherein the physical address conflict table is used for generating a network topology after manual configuration so that all the switches appear in the network topology diagram.
In an alternative embodiment, the apparatus further comprises: and the storage unit is used for storing the equipment information into a file with a preset format according to each network address in the specified network segment.
In an alternative embodiment, the apparatus further comprises at least one of: the device comprises a first reading unit, a second reading unit and a third reading unit, wherein the first reading unit is used for reading a mapping table which is stored in a file with a preset format and is used for mapping a network address of the network device into a physical address, and generating a first mapping table dictionary, and the first mapping table dictionary is used for mapping the network address of the network device into the physical address; a second reading unit, configured to read device forwarding information stored in a file with a predetermined format, and generate a second mapping table dictionary, where the second mapping table dictionary is used to map a physical address of a source network device to a network port of a destination network device; and the third reading unit is used for reading the device forwarding information stored in the file with the preset format and generating a third mapping table dictionary, wherein the third mapping table dictionary is used for mapping the network port of the source network device to the physical address of the destination network device.
In an alternative embodiment, the first generating unit includes: the acquisition module is used for acquiring the network address of the core switch; the first generation module is used for generating an uplink port dictionary based on the network address of the core switch according to the first mapping table dictionary, the second mapping table dictionary and the third mapping table dictionary, wherein the uplink port dictionary is used for recording port information of an uplink port of the non-core switch, and the uplink port is a port which is used for being connected with the core switch and is arranged on the non-core switch; a second generation module, configured to generate a downlink port dictionary according to the first mapping table dictionary, the second mapping table dictionary, the third mapping table dictionary, and the uplink port dictionary based on the network address of the core switch, where the downlink port dictionary is used to record mapping information between a physical address of a non-uplink port of the non-core switch and a network port, and the non-uplink port is a port on the non-core switch that is not used to connect to the core switch; and the third generation module is used for generating a core switch connection equipment dictionary according to the first mapping table dictionary, the second mapping table dictionary, the third mapping table dictionary, the uplink port dictionary and the downlink port dictionary based on the network address of the core switch.
Optionally, the second generating unit is configured to generate a non-core switch connection relation dictionary according to the first mapping table dictionary, the second mapping table dictionary, the third mapping table dictionary, the uplink port dictionary, the downlink port dictionary, and the core switch connection device dictionary based on the network address of the non-core switch.
According to another aspect of the embodiments of the present invention, there is also provided a storage medium including a stored program, where the program performs any one of the above-mentioned optional methods for generating a network topology.
According to another aspect of the embodiments of the present invention, there is also provided a processor, configured to execute a program, where the program executes any one of the above optional methods for generating a network topology.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present invention, it should be understood that the disclosed technical contents can be implemented in other manners. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (9)

1. A method of generating a network topology, comprising:
acquiring equipment information of network equipment in a specified network segment, wherein the equipment information comprises at least one of the following: the device comprises a device identifier, a mapping table for mapping a network address of the network device into a physical address, and device forwarding information;
generating a core switch connection device dictionary based on the network address of the core switch according to the device information, wherein the core switch connection device dictionary is used for recording switch information directly connected with the core switch;
generating a non-core switch connection relation dictionary according to the core switch connection equipment dictionary and the equipment information based on the network address of the non-core switch, wherein the non-core switch connection relation dictionary is used for recording the connection relation between the non-core switches;
generating a network topology map according to the core switch connection equipment dictionary and the non-core switch connection relation dictionary; and is
Before generating a core switch connection device dictionary based on the network address of the core switch according to the device information, the method further includes:
judging whether the uplink port of the switch in the specified network segment and the downlink port of the core switch have the same physical address or not;
and determining the switch directly connected with the core switch in the specified network segment according to the judgment result, wherein the uplink port of the switch directly connected with the core switch and the downlink port of the core switch do not have the same physical address.
2. The method of claim 1, wherein after determining whether the physical addresses of the upstream ports of the switches in the designated network segment are the same as the physical addresses of the downstream ports of the core switches, the method further comprises:
if a plurality of same physical addresses exist in the uplink port of any switch in the specified network segment and the downlink port of the core switch, recording the physical addresses of the switches with the same physical addresses into a physical address conflict table, wherein the physical address conflict table is used for generating a network topology after manual configuration, so that all the switches appear in the network topology graph.
3. The method of generating a network topology of claim 1, wherein after collecting device information for network devices within a specified network segment, the method further comprises:
and storing the equipment information into a file with a preset format according to each network address in the specified network segment.
4. The method of generating a network topology according to claim 3, wherein after storing said device information in a file of a predetermined format per each network address within said specified network segment, said method further comprises at least one of:
reading a mapping table stored in the file with the preset format and used for mapping the network address of the network equipment into a physical address, and generating a first mapping table dictionary, wherein the first mapping table dictionary is used for mapping the network address of the network equipment into the physical address;
reading the device forwarding information stored in the file with the preset format, and generating a second mapping table dictionary, wherein the second mapping table dictionary is used for mapping the physical address of the source network device to the network port of the destination network device;
and reading the device forwarding information stored in the file with the preset format, and generating a third mapping table dictionary, wherein the third mapping table dictionary is used for mapping the network port of the source network device to the physical address of the destination network device.
5. The method of generating a network topology according to claim 4, wherein generating a core switch connection device dictionary based on the device information based on a network address of a core switch comprises:
acquiring a network address of the core switch;
generating an uplink port dictionary according to the first mapping table dictionary, the second mapping table dictionary and the third mapping table dictionary based on the network address of the core switch, wherein the uplink port dictionary is used for recording port information of an uplink port of a non-core switch, and the uplink port is a port which is used for being connected with the core switch and is arranged on the non-core switch;
generating a downlink port dictionary according to the first mapping table dictionary, the second mapping table dictionary, the third mapping table dictionary and the uplink port dictionary based on the network address of the core switch, wherein the downlink port dictionary is used for recording mapping information of a physical address of a non-uplink port of a non-core switch and a network port, and the non-uplink port is a port which is not used for being connected with the core switch on the non-core switch;
and generating the core switch connection device dictionary according to the first mapping table dictionary, the second mapping table dictionary, the third mapping table dictionary, the uplink port dictionary and the downlink port dictionary based on the network address of the core switch.
6. The method of generating a network topology according to claim 5, wherein generating a non-core switch connection relation dictionary from the core switch connection device dictionary and the device information based on the network address of the non-core switch comprises:
and generating the non-core switch connection relation dictionary based on the network address of the core switch according to the first mapping table dictionary, the second mapping table dictionary, the third mapping table dictionary, the uplink port dictionary, the downlink port dictionary and the core switch connection equipment dictionary.
7. An apparatus for generating a network topology, comprising:
the device comprises a collecting unit and a processing unit, wherein the collecting unit is used for collecting the device information of the network device in the appointed network segment, and the device information comprises at least one of the following: the device comprises a device identifier, a mapping table for mapping a network address of the network device into a physical address, and device forwarding information;
a first generating unit, configured to generate a core switch connection device dictionary according to the device information based on a network address of a core switch, where the core switch connection device dictionary is used to record switch information directly connected to the core switch;
a second generating unit, configured to generate a non-core switch connection relation dictionary according to the core switch connection device dictionary and the device information based on a network address of a non-core switch, where the non-core switch connection relation dictionary is used to record a connection relation between non-core switches;
a third generating unit, configured to generate a network topology map according to the core switch connection device dictionary and the non-core switch connection relationship dictionary;
the judging unit is used for judging whether the uplink port of the switch in the specified network segment and the downlink port of the core switch have the same physical address or not;
and the determining unit is used for determining the switch which is directly connected with the core switch in the appointed network segment according to the judgment result, wherein the uplink port of the switch which is directly connected with the core switch and the downlink port of the core switch do not have the same physical address.
8. A computer-readable storage medium storing a computer program executable by a processor to implement the method of generating a network topology of any one of claims 1 to 6.
9. A processor, characterized in that the processor is configured to run a program, wherein the program when running performs the method of generating a network topology of any one of claims 1 to 6.
CN201811191139.3A 2018-10-12 2018-10-12 Method, device, storage medium and processor for generating network topology Active CN109257225B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201811191139.3A CN109257225B (en) 2018-10-12 2018-10-12 Method, device, storage medium and processor for generating network topology
CN202110850948.6A CN113572645B (en) 2018-10-12 2018-10-12 Method, device, storage medium and processor for generating network topology

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811191139.3A CN109257225B (en) 2018-10-12 2018-10-12 Method, device, storage medium and processor for generating network topology

Related Child Applications (1)

Application Number Title Priority Date Filing Date
CN202110850948.6A Division CN113572645B (en) 2018-10-12 2018-10-12 Method, device, storage medium and processor for generating network topology

Publications (2)

Publication Number Publication Date
CN109257225A CN109257225A (en) 2019-01-22
CN109257225B true CN109257225B (en) 2021-08-10

Family

ID=65046069

Family Applications (2)

Application Number Title Priority Date Filing Date
CN201811191139.3A Active CN109257225B (en) 2018-10-12 2018-10-12 Method, device, storage medium and processor for generating network topology
CN202110850948.6A Active CN113572645B (en) 2018-10-12 2018-10-12 Method, device, storage medium and processor for generating network topology

Family Applications After (1)

Application Number Title Priority Date Filing Date
CN202110850948.6A Active CN113572645B (en) 2018-10-12 2018-10-12 Method, device, storage medium and processor for generating network topology

Country Status (1)

Country Link
CN (2) CN109257225B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113572645B (en) * 2018-10-12 2024-04-05 北京信研汇智信息技术有限公司 Method, device, storage medium and processor for generating network topology

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7393264B2 (en) * 2020-03-24 2023-12-06 アズビル株式会社 Network devices and network configuration determination method
CN111464450B (en) * 2020-03-27 2022-03-25 杭州海康威视数字技术股份有限公司 Method and device for generating network topology structure
CN111600762B (en) * 2020-06-02 2023-04-07 山东中创软件商用中间件股份有限公司 Network topology structure generation method, device, equipment and medium
CN111934921B (en) * 2020-07-29 2023-11-07 深信服科技股份有限公司 Network topology discovery method and device, equipment and storage medium
CN117176588B (en) * 2023-11-03 2024-02-06 烽台科技(北京)有限公司 Method and device for constructing network topology, electronic equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6829641B2 (en) * 1995-11-16 2004-12-07 Peregrine Systems, Inc. Method of determining the topology of a network of objects
CN1558615A (en) * 2004-01-14 2004-12-29 中国科学院计算技术研究所 A physical network topological discovering system and method thereof
CN1791011A (en) * 2005-12-06 2006-06-21 电子科技大学 Network topology automatic forming method in network management system
CN101764709A (en) * 2009-12-29 2010-06-30 福建星网锐捷网络有限公司 Network physical topology discovering method and network management server based on SNMP
CN102143007A (en) * 2011-05-03 2011-08-03 中国南方电网有限责任公司 Distribution-based hierarchical network topology discovery method
CN103036725A (en) * 2012-12-17 2013-04-10 华为技术有限公司 Network administration device and method for discovery of network topology
CN105376163A (en) * 2015-10-14 2016-03-02 山东超越数控电子有限公司 Discovery method and device of network topological structure

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2372400B (en) * 2001-02-19 2003-05-28 3Com Corp Network management apparatus and method for determining the topology of a network
US7424021B2 (en) * 2003-01-31 2008-09-09 Hewlett-Packard Development Company, L.P. Method and apparatus for processing network topology data
CN1319338C (en) * 2003-11-06 2007-05-30 北京佳讯飞鸿电气有限责任公司 Method for soluting IP address conflicts in network communication
KR100674086B1 (en) * 2004-12-16 2007-01-24 한국전자통신연구원 Topology discovery method in ethernet network
CN104468365B (en) * 2014-07-09 2017-08-08 北京东土科技股份有限公司 A kind of method, system and device for obtaining equipment room topological connection relation
CN108282362B (en) * 2017-12-29 2021-05-14 武汉璞华大数据技术有限公司 Network topology generation method, device and equipment
CN109257225B (en) * 2018-10-12 2021-08-10 北京信研汇智信息技术有限公司 Method, device, storage medium and processor for generating network topology

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6829641B2 (en) * 1995-11-16 2004-12-07 Peregrine Systems, Inc. Method of determining the topology of a network of objects
CN1558615A (en) * 2004-01-14 2004-12-29 中国科学院计算技术研究所 A physical network topological discovering system and method thereof
CN1791011A (en) * 2005-12-06 2006-06-21 电子科技大学 Network topology automatic forming method in network management system
CN101764709A (en) * 2009-12-29 2010-06-30 福建星网锐捷网络有限公司 Network physical topology discovering method and network management server based on SNMP
CN102143007A (en) * 2011-05-03 2011-08-03 中国南方电网有限责任公司 Distribution-based hierarchical network topology discovery method
CN103036725A (en) * 2012-12-17 2013-04-10 华为技术有限公司 Network administration device and method for discovery of network topology
CN105376163A (en) * 2015-10-14 2016-03-02 山东超越数控电子有限公司 Discovery method and device of network topological structure

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113572645B (en) * 2018-10-12 2024-04-05 北京信研汇智信息技术有限公司 Method, device, storage medium and processor for generating network topology

Also Published As

Publication number Publication date
CN113572645A (en) 2021-10-29
CN109257225A (en) 2019-01-22
CN113572645B (en) 2024-04-05

Similar Documents

Publication Publication Date Title
CN109257225B (en) Method, device, storage medium and processor for generating network topology
US20210084009A1 (en) Route generation method and device
US10091274B2 (en) Method, device, and system for controlling network device auto-provisioning
US7380025B1 (en) Method and apparatus providing role-based configuration of a port of a network element
US8578034B2 (en) Optimized network device discovery
EP1639746B1 (en) System and method for synchronous configuration of dhcp server and router interfaces
US7742426B2 (en) System, method, and computer-readable medium for determining a layer 2 path trace in a heterogeneous network system
US8799444B2 (en) Automated host discovery and path tracing by network management server
JP2010514340A (en) How to discover the physical topology of a communication network
US7606884B2 (en) SNMP firewall for network identification
US20220086070A1 (en) Apparatus and process for monitoring network behaviour of internet-of-things (iot) devices
CN108206792B (en) Topological structure discovery method and device of switch
US7869382B2 (en) Network management assisted discovery
EP2033379B1 (en) Method and system for determining topology of a dynamic network
CN104579978B (en) A kind of dynamic network Datalink Layer Topology Discovery method
CN112953774B (en) Network topology generation method, system, equipment and computer storage medium
CN113452561A (en) Topology generation method, device and equipment and readable storage medium
US8914503B2 (en) Detected IP link and connectivity inference
CN114915561A (en) Network topological graph generation method and device
US20040215781A1 (en) Techniques for determining device connectivity in a network using protocol-specific connectivity information
CN107094187A (en) A kind of method of the access switch port of automatic lookup MAC Address
CN108833129B (en) Network topology discovery method and device
CN116719868A (en) Network asset identification method, device and equipment
CN103986600B (en) One kind is found automatically based on multi-protocols business network and filter method, system
Chiu et al. Design the dns-like smart switch for heterogeneous network base on sdn architecture

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant