CN108282362B - Network topology generation method, device and equipment - Google Patents

Network topology generation method, device and equipment Download PDF

Info

Publication number
CN108282362B
CN108282362B CN201711484354.8A CN201711484354A CN108282362B CN 108282362 B CN108282362 B CN 108282362B CN 201711484354 A CN201711484354 A CN 201711484354A CN 108282362 B CN108282362 B CN 108282362B
Authority
CN
China
Prior art keywords
network
direct connection
layer network
network equipment
interface
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
CN201711484354.8A
Other languages
Chinese (zh)
Other versions
CN108282362A (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.)
Wuhan Purvar Data Technology Co ltd
Original Assignee
Wuhan Purvar Data 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 Wuhan Purvar Data Technology Co ltd filed Critical Wuhan Purvar Data Technology Co ltd
Priority to CN201711484354.8A priority Critical patent/CN108282362B/en
Publication of CN108282362A publication Critical patent/CN108282362A/en
Application granted granted Critical
Publication of CN108282362B publication Critical patent/CN108282362B/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

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Small-Scale Networks (AREA)

Abstract

The invention provides a network topology generation method, a device and equipment, wherein the method comprises the following steps: collecting network information of three-layer network equipment in a target network; acquiring a direct connection interface set according to the IP address and the MAC address table corresponding to each interface; if the two-layer network equipment corresponding to the direct connection interface set exists in the target network according to the number of the interfaces in the direct connection interface set, adding a two-layer network equipment mark to the direct connection interface set; and drawing a network topology map of the target network according to the network information of the three-layer network equipment, the direct connection interface set and the two-layer network equipment mark. The invention estimates the two-layer network equipment by utilizing the direct connection interface in the three-layer network equipment, thereby leading the network topological graph to be more complete, leading the user to obtain more information, being easy for the manager to know the whole network architecture and accelerating the speed of eliminating faults.

Description

Network topology generation method, device and equipment
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method, an apparatus, and a device for generating a network topology.
Background
In recent years, due to the rapid development of computer networks, effective network management has received more and more attention, and obtaining the latest network topology is crucial to network management. Because of the dynamic nature of networks and the increasing size of networks, it is almost impossible to maintain a topology map of a network manually. Therefore, research on the network topology auto-discovery technology is widely conducted.
In the prior art, a network topology generation method usually adopts a topology discovery method based on a third layer, which focuses on discovering a logical connection relationship between routing devices. The topology it finds does not represent the true connection of devices in the network, but rather the connection in the sense of "IP datagram forwarding". Therefore, since the generated topology map can only display the device nodes of the collected data, when the device does not collect the data, the device in the topology map is lost, so that when a problem occurs in the network, it is difficult to find the cause of the problem by checking the topology.
Disclosure of Invention
Aiming at the defects in the prior art, the invention provides a network topology generation method, a device and equipment.
One aspect of the present invention provides a network topology generating method, including: s1, collecting network information of three-layer network equipment in the target network; the network information comprises IP addresses and MAC address tables corresponding to all interfaces contained in the three-layer network equipment; s2, acquiring a direct connection interface set according to the IP address and the MAC address table corresponding to each interface; wherein, the direct connection interface set comprises a plurality of interfaces which are connected with each other; s3, if the existence of the two-layer network equipment corresponding to the direct connection interface set is confirmed in the target network according to the number of the interfaces in the direct connection interface set, adding a two-layer network equipment mark to the direct connection interface set; and S4, drawing a network topology map of the target network according to the network information of the three-layer network equipment, the direct connection interface set and the two-layer network equipment mark.
The step of acquiring the set of directly connected interfaces according to the IP address and MAC address table corresponding to each interface in S2 specifically includes: s21, according to the network segment corresponding to each interface IP address, dividing the interfaces belonging to the same network segment into the same network segment group; s22, acquiring a direct connection interface set in the network segment group according to the MAC address table corresponding to each interface in the same network segment group; and for any interface contained in the direct connection interface set, the MAC address table of the interface contains the MAC addresses of other interfaces in the direct connection interface set.
In S3, the determining, according to the number of interfaces in the direct connection interface set, that a two-layer network device corresponding to the direct connection interface set exists in the target network specifically includes: and if the number of the interfaces in the direct connection interface set is not less than 3, confirming that at least one two-layer network device exists between the direct connection interfaces contained in the direct connection interface set.
Wherein the step S3 further includes: collecting network information of two-layer network equipment in a target network; the network information comprises an MAC address table corresponding to each interface included in the two-layer network equipment; if the MAC address table length of the interface of the two-layer network equipment is not less than 2, the interface is determined to be an uplink interface of the two-layer network equipment; if the length of the MAC address table of the interface of the two-layer network equipment is equal to 1 and the MAC address does not belong to the upper-level equipment of the two-layer network equipment, the interface is confirmed to be an access layer interface of the two-layer network equipment; correspondingly, the step S4 further includes marking an uplink interface and an access layer interface of the two-layer network device.
The step of collecting network information of three-layer network devices in the target network in S1 specifically includes: and acquiring network information of three-layer network equipment in the target network through an SNMP protocol, wherein the network information also comprises three-layer network equipment ID.
Wherein, after step S2, the method further comprises: adding a direct connection mark to interfaces belonging to the same direct connection interface set; correspondingly, the step S4 specifically includes: drawing a three-layer network equipment icon according to the ID of the three-layer network equipment; adding a connection line to a three-layer network equipment icon corresponding to the interface according to the direct connection mark of the interface; and according to the mark of the two-layer network equipment, drawing the icon of the two-layer network equipment on the connecting line corresponding to the direct connection mark corresponding to the mark of the two-layer network equipment.
Another aspect of the present invention provides a network topology generating apparatus, including: the acquisition module is used for acquiring network information of three-layer network equipment in a target network; the network information comprises IP addresses and MAC address tables corresponding to all interfaces contained in the three-layer network equipment; the acquisition module is used for acquiring a direct connection interface set according to the IP address and the MAC address table corresponding to each interface; wherein, the direct connection interface set comprises a plurality of interfaces which are connected with each other; the confirming module is used for adding a two-layer network equipment mark to the direct connection interface set if confirming that two-layer network equipment corresponding to the direct connection interface set exists in the target network according to the number of the interfaces in the direct connection interface set; and the drawing module is used for drawing the network topological graph of the target network according to the network information of the three-layer network equipment, the direct connection interface set and the two-layer network equipment mark.
Wherein, the acquisition module specifically includes: the dividing unit is used for dividing the interfaces belonging to the same network segment into the same network segment group according to the network segments corresponding to the IP addresses of the interfaces; the network segment group comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a direct connection interface set in the network segment group according to an MAC address table corresponding to each interface in the same network segment group; and for any interface contained in the direct connection interface set, the MAC address table of the interface contains the MAC addresses of other interfaces in the direct connection interface set.
Yet another aspect of the present invention provides a network topology generating device, including: at least one processor; and at least one memory communicatively coupled to the processor, wherein: the memory stores program instructions executable by the processor, and the processor calls the program instructions to execute the network topology generating method provided by the above aspect of the present invention, for example, the method includes: s1, collecting network information of three-layer network equipment in the target network; the network information comprises IP addresses and MAC address tables corresponding to all interfaces contained in the three-layer network equipment; s2, acquiring a direct connection interface set according to the IP address and the MAC address table corresponding to each interface; wherein, the direct connection interface set comprises a plurality of interfaces which are connected with each other; s3, if the existence of the two-layer network equipment corresponding to the direct connection interface set is confirmed in the target network according to the number of the interfaces in the direct connection interface set, adding a two-layer network equipment mark to the direct connection interface set; and S4, drawing a network topology map of the target network according to the network information of the three-layer network equipment, the direct connection interface set and the two-layer network equipment mark.
Yet another aspect of the invention provides a non-transitory computer readable storage medium storing computer instructions that cause the computer to perform a network topology generation method provided by the above aspect of the invention, for example, comprising: s1, collecting network information of three-layer network equipment in the target network; the network information comprises IP addresses and MAC address tables corresponding to all interfaces contained in the three-layer network equipment; s2, acquiring a direct connection interface set according to the IP address and the MAC address table corresponding to each interface; wherein, the direct connection interface set comprises a plurality of interfaces which are connected with each other; s3, if the existence of the two-layer network equipment corresponding to the direct connection interface set is confirmed in the target network according to the number of the interfaces in the direct connection interface set, adding a two-layer network equipment mark to the direct connection interface set; and S4, drawing a network topology map of the target network according to the network information of the three-layer network equipment, the direct connection interface set and the two-layer network equipment mark.
According to the network topology generation method, the network topology generation device and the network topology generation equipment, the two-layer network equipment is estimated by utilizing the direct connection interface in the three-layer network equipment, so that a network topology graph is more complete, a user can obtain more information, and managers can easily know the whole network architecture and accelerate the speed of removing faults.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a network topology generation method according to an embodiment of the present invention;
fig. 2 is an interface schematic diagram of a network topology generation method according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a network topology generating apparatus according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a network topology generating device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some embodiments, but not all embodiments, of the present invention. 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.
Fig. 1 is a schematic flow chart of a network topology generation method provided in an embodiment of the present invention, as shown in fig. 1, including: s1, collecting network information of three-layer network equipment in the target network; the network information comprises IP addresses and MAC address tables corresponding to all interfaces contained in the three-layer network equipment; s2, acquiring a direct connection interface set according to the IP address and the MAC address table corresponding to each interface; wherein, the direct connection interface set comprises a plurality of interfaces which are connected with each other; s3, if the existence of the two-layer network equipment corresponding to the direct connection interface set is confirmed in the target network according to the number of the interfaces in the direct connection interface set, adding a two-layer network equipment mark to the direct connection interface set; and S4, drawing a network topology map of the target network according to the network information of the three-layer network equipment, the direct connection interface set and the two-layer network equipment mark.
Wherein, the Network Topology (Network Topology) structure refers to a physical layout for interconnecting various devices by using a transmission medium; refers to a particular physical, i.e., real, or logical, i.e., virtual, arrangement of members that make up a network.
Wherein the three-layer network device is a third-layer device in an OSI model; the OSI Model, Open System Interconnection (Open System Interconnection, OSI/RM, Open Systems Interconnection Reference Model), is a standard framework proposed by the international organization for standardization (ISO) that attempts to interconnect various computers as networks worldwide, referred to as OSI for short; wherein, layer 3 is a network layer, i.e. translating a network address into a corresponding physical address and deciding how to route data from a sender to a receiver; layer 2 is the data link layer, i.e. the communication between the control network layer and the physical layer, and its main function is how to reliably transfer data over unreliable physical lines.
In step S1, network information of a three-layer network device of a target network that needs to establish a network topology is collected; each three-layer network device comprises at least one interface, each interface is provided with at least one interface IP, each interface is provided with a MAC address table, and each interface is provided with a routing table; the MAC address table records the corresponding relation between the IP address and the MAC address of the interface.
In step S2, according to the IP address and MAC address table corresponding to each interface acquired in step S1, an interface directly connected to each other, that is, a direct connection interface, can be acquired; a direct connection interface means that two or more interfaces are directly and physically connected, for example, share a network cable or the same network segment or are connected to the same switch; specifically, there may be one or more sets of directly connected interfaces, each set of directly connected interfaces including a plurality of interfaces connected to each other.
In step S3, according to the sets of directly connected interfaces obtained in step S2, each set has a different number of interfaces; judging whether the direct connection interface set has corresponding two-layer network equipment or not according to the number of the interfaces; i.e. there are two-layer network devices between the interfaces contained in the set. In summary, under the condition that no two-layer network device can be obtained, whether the two-layer network device exists can be estimated according to the condition of the direct connection interface.
In step S4, based on the network information obtained in step S1, the set of direct-connected interfaces obtained in step S2, and the two-layer network tag obtained in step S3, the connection relationship between the three-layer network device and the two-layer network device can be obtained, so as to draw a network topology map.
The network topology generation method provided by the embodiment of the invention estimates the two-layer network equipment by utilizing the direct connection interface in the three-layer network equipment, so that the network topology graph is more complete, a user can obtain more information, and managers can easily know the whole network architecture and accelerate the speed of removing faults.
On the basis of any of the above embodiments, the step of obtaining the direct connection interface set according to the IP address and the MAC address table corresponding to each interface in S2 specifically includes: s21, according to the network segment corresponding to each interface IP address, dividing the interfaces belonging to the same network segment into the same network segment group; s22, acquiring a direct connection interface set in the network segment group according to the MAC address table corresponding to each interface in the same network segment group; and for any interface contained in the direct connection interface set, the MAC address table of the interface contains the MAC addresses of other interfaces in the direct connection interface set.
In step S21, a network segment generally refers to a part of a computer network that can directly communicate using the same physical layer device (transmission medium, repeater, hub, etc.); for example, a segment from 192.168.0.1 to 192.168.255.255; and the same network segment refers to the IP address and the subnet mask sum which obtain the same network address. According to the IP address of each interface, the interfaces belonging to the same network segment are divided into the same network segment group, so that at least one network segment group can be obtained.
In step S22, comparing each interface in the segment group according to each segment group in step S21, and if the MAC address table of the a interface has the MAC address of the B interface and the MAC address table of the B interface has the MAC address of the a interface, the a interface and the B interface may be directly connected; a plurality of interfaces may be mutually used as direct connection interfaces, thereby establishing a direct connection interface set.
On the basis of any of the foregoing embodiments, the determining, in S3, that there is a two-layer network device corresponding to the direct connection interface set in the target network according to the number of interfaces in the direct connection interface set specifically includes: and if the number of the interfaces in the direct connection interface set is not less than 3, confirming that at least one two-layer network device exists between the direct connection interfaces contained in the direct connection interface set.
Specifically, when judging whether a two-layer network device exists, the number of interfaces in the direct connection interface set is used; if 3 or more interfaces are directly connected, it can be determined that at least one two-layer network device exists between the interfaces; when the number of interfaces is two, the two interfaces may be directly connected by a network cable, and thus it is not possible to confirm that a two-layer network device exists between them.
On the basis of any of the above embodiments, the step S3 further includes: collecting network information of two-layer network equipment in a target network; the network information comprises an MAC address table corresponding to each interface included in the two-layer network equipment; if the MAC address table length of the interface of the two-layer network equipment is not less than 2, the interface is determined to be an uplink interface of the two-layer network equipment; if the length of the MAC address table of the interface of the two-layer network equipment is equal to 1 and the MAC address does not belong to the upper-level equipment of the two-layer network equipment, the interface is confirmed to be an access layer interface of the two-layer network equipment; correspondingly, the step S4 further includes marking an uplink interface and an access layer interface of the two-layer network device.
Specifically, if the data of the two-layer network device in the target network can be collected in step S3, the type of the interface may be determined based on the MAC address table of the two-layer network device interface, that is, the uplink interface or the access layer interface; the uplink interface is a port used when the switch and the switch are cascaded; and the access stratum refers to the part of the network directly facing the user connection or access, i.e. the interface to the devices such as the user computer.
In addition, in the case of acquiring the layer-two network device, the interface type of the layer-two network device (switch) may be marked when the network topology is drawn in S4.
On the basis of any of the foregoing embodiments, the step of collecting network information of a three-layer network device in a target network in S1 specifically includes: and acquiring network information of three-layer network equipment in the target network through an SNMP protocol, wherein the network information also comprises three-layer network equipment ID.
The Simple Network Management Protocol (SNMP), which is composed of a set of standards for network management, includes an application layer protocol (application layer protocol), a database model (database schema), and a set of resource objects, and can support a network management system to monitor whether any device connected to a network has any situation that may cause any administrative attention.
Specifically, the embodiment of the present invention may acquire network information of a three-layer network device by using an SNMP protocol, and various network information including a device ID may be acquired by using the protocol.
On the basis of any of the above embodiments, the step S2 is further followed by: adding a direct connection mark to interfaces belonging to the same direct connection interface set; correspondingly, the step S4 specifically includes: drawing a three-layer network equipment icon according to the ID of the three-layer network equipment; adding a connection line to a three-layer network equipment icon corresponding to the interface according to the direct connection mark of the interface; and according to the mark of the two-layer network equipment, drawing the icon of the two-layer network equipment on the connecting line corresponding to the direct connection mark corresponding to the mark of the two-layer network equipment.
Specifically, the direct connection mark indicates that two interfaces are connected, so that three layers of equipment are connected by using a connecting line according to the direct connection mark during drawing; and the two-layer network equipment mark indicates that two-layer network equipment exists between the interfaces, and a corresponding icon can be added on the connecting line, so that the drawing of the network topological graph of the target network is completed.
To illustrate the above method provided by the embodiments of the present invention, the following is exemplified with reference to fig. 2: the whole idea comprises a data acquisition part supported by an SNMP protocol; calculating direct connection marks of three-layer network equipment; presuming the two-layer network equipment under the condition of lacking the two-layer network equipment data; calculating the mark and type of the connection of the two-layer network equipment under the condition that the data of the two-layer network equipment is complete;
step 1, acquiring device IDs, routing tables, interfaces, MAC address tables and the like of three-layer and two-layer network devices in a target network through an SNMP (simple network management protocol);
step 2, judging a connection set of the three-layer network equipment through the equipment ID, the routing table and the interface IP;
step 2.1, the interface, the routing table and the MAC address table are classified and grouped by the equipment ID;
2.2, classifying and grouping the interfaces of which the IP addresses belong to the same network segment into same network segment groups NG1, … and NGn;
step 2.3, comparing the MAC address tables of the A.1 interface and the B.1 interface in the NG1 group, if the MAC address of the B.1 exists in the MAC address table of the A.1 and the MAC address of the A.1 exists in the MAC address table of the B.1, marking the A.1 and the B.1 as direct connection CG 1; all the direct connectors are marked on the NGn in the same way;
step 3, if no or insufficient two-layer network devices are acquired, determining whether there is at least one two-layer network device according to the length of the direct connection mark (i.e. the number of interfaces of the same direct connection mark), if the length of CG1 is 3 and is greater than 2, indicating that there is at least one two-layer device between 3 interfaces, inserting corresponding sw tags (switch tags) into the device ID list and CG 1;
step 3', if the data of the two-layer network equipment can be collected, the direct connection interface can be accurately judged, and the uplink interface and the access layer interface can be judged according to the number and the belongings of the MAC addresses in the MAC address table of each interface, namely, the MAC address table of the interface A.1 comprises the addresses in the MAC address tables of the B.1-B.24, and the A.1 is the uplink interface of the two-layer network equipment; if the MAC address table of A.2 only contains one MAC address and the MAC address does not belong to the MAC address of any three-layer network equipment, A.2 is an access layer interface;
and 4, drawing a topological graph according to the equipment ID and the direct connection mark.
Fig. 3 is a schematic structural diagram of a network topology generating device according to an embodiment of the present invention, as shown in fig. 3, including: the acquisition module 301 is configured to acquire network information of three-layer network devices in a target network; the network information comprises IP addresses and MAC address tables corresponding to all interfaces contained in the three-layer network equipment; an obtaining module 302, configured to obtain a direct connection interface set according to an IP address and an MAC address table corresponding to each interface; wherein, the direct connection interface set comprises a plurality of interfaces which are connected with each other; a confirming module 303, configured to add a two-layer network device label to the direct connection interface set if it is confirmed that a two-layer network device corresponding to the direct connection interface set exists in the target network according to the number of interfaces in the direct connection interface set; and the drawing module 304 is configured to draw a network topology map of the target network according to the network information of the three-layer network device, the direct connection interface set, and the two-layer network device label.
The acquisition module 301 acquires network information of a three-layer network device of a target network requiring network topology establishment; each three-layer network device comprises at least one interface, each interface is provided with at least one interface IP, each interface is provided with a MAC address table, and each interface is provided with a routing table; the MAC address table records the corresponding relation between the IP address and the MAC address of the interface.
The obtaining module 302 can obtain the interfaces that are directly connected to each other, that is, the direct connection interfaces, according to the IP addresses and the MAC address tables corresponding to the interfaces obtained by the collecting module 301; a direct connection interface means that two or more interfaces are directly and physically connected, for example, share a network cable or the same network segment or are connected to the same switch; specifically, there may be one or more sets of directly connected interfaces, each set of directly connected interfaces including a plurality of interfaces connected to each other.
The confirming module 303 obtains sets of direct connection interfaces from the obtaining module 302, where each set has a different number of interfaces; the determining module 303 determines whether the direct connection interface set has a corresponding two-layer network device according to the number of the interfaces; i.e. there are two-layer network devices between the interfaces contained in the set. In summary, in the case that a two-layer network device cannot be obtained, the determining module 303 may estimate whether the two-layer network device exists according to the condition of the direct connection interface.
The drawing module 304 can obtain the connection relationship between the three-layer network device and the two-layer network device according to the network information obtained by the acquisition module 301, the direct connection interface set obtained by the acquisition module 302, and the two-layer network tag obtained by the confirmation module 303, so as to draw a network topology map.
The network topology generating device provided by the embodiment of the invention estimates the two-layer network equipment by utilizing the direct connection interface in the three-layer network equipment, so that the network topology graph is more complete, a user can obtain more information, and managers can easily know the whole network architecture and accelerate the speed of removing faults.
On the basis of any one of the above embodiments, the obtaining module specifically includes: the dividing unit is used for dividing the interfaces belonging to the same network segment into the same network segment group according to the network segments corresponding to the IP addresses of the interfaces; the network segment group comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a direct connection interface set in the network segment group according to an MAC address table corresponding to each interface in the same network segment group; and for any interface contained in the direct connection interface set, the MAC address table of the interface contains the MAC addresses of other interfaces in the direct connection interface set.
On the basis of any of the above embodiments, the confirmation module 303 is specifically configured to: and if the number of the interfaces in the direct connection interface set is not less than 3, confirming that at least one two-layer network device exists between the direct connection interfaces contained in the direct connection interface set.
On the basis of any of the above embodiments, the confirmation module 303 further includes: the acquisition unit is used for acquiring network information of two-layer network equipment in a target network; the network information comprises an MAC address table corresponding to each interface included in the two-layer network equipment; a confirming unit, configured to confirm that an interface is an uplink interface of a two-layer network device if the MAC address table length of the interface of the two-layer network device is not less than 2; if the length of the MAC address table of the interface of the two-layer network equipment is equal to 1 and the MAC address does not belong to the upper-level equipment of the two-layer network equipment, the interface is confirmed to be an access layer interface of the two-layer network equipment; accordingly, the rendering module 304 is further configured to mark the uplink interface and the access layer interface of the two-layer network device.
On the basis of any of the above embodiments, the acquisition module 301 is specifically configured to: and acquiring network information of three-layer network equipment in the target network through an SNMP protocol, wherein the network information also comprises three-layer network equipment ID.
On the basis of any one of the above embodiments, the apparatus further comprises: the marking module is used for adding direct connection marks to the interfaces belonging to the same direct connection interface set; accordingly, the rendering module 304 is specifically configured to: drawing a three-layer network equipment icon according to the ID of the three-layer network equipment; adding a connection line to a three-layer network equipment icon corresponding to the interface according to the direct connection mark of the interface; and according to the mark of the two-layer network equipment, drawing the icon of the two-layer network equipment on the connecting line corresponding to the direct connection mark corresponding to the mark of the two-layer network equipment.
Fig. 4 is a schematic structural diagram of a network topology generating device according to an embodiment of the present invention, and as shown in fig. 4, the device includes: at least one processor 401; and at least one memory 402 communicatively coupled to the processor 401, wherein: the memory 402 stores program instructions executable by the processor 401, and the processor 401 calls the program instructions to perform the network topology generating method provided by the foregoing embodiments, for example, the method includes: s1, collecting network information of three-layer network equipment in the target network; the network information comprises IP addresses and MAC address tables corresponding to all interfaces contained in the three-layer network equipment; s2, acquiring a direct connection interface set according to the IP address and the MAC address table corresponding to each interface; wherein, the direct connection interface set comprises a plurality of interfaces which are connected with each other; s3, if the existence of the two-layer network equipment corresponding to the direct connection interface set is confirmed in the target network according to the number of the interfaces in the direct connection interface set, adding a two-layer network equipment mark to the direct connection interface set; and S4, drawing a network topology map of the target network according to the network information of the three-layer network equipment, the direct connection interface set and the two-layer network equipment mark.
An embodiment of the present invention further provides a non-transitory computer-readable storage medium, where the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions enable a computer to execute a network topology generation method provided in the corresponding embodiment, for example, the method includes: s1, collecting network information of three-layer network equipment in the target network; the network information comprises IP addresses and MAC address tables corresponding to all interfaces contained in the three-layer network equipment; s2, acquiring a direct connection interface set according to the IP address and the MAC address table corresponding to each interface; wherein, the direct connection interface set comprises a plurality of interfaces which are connected with each other; s3, if the existence of the two-layer network equipment corresponding to the direct connection interface set is confirmed in the target network according to the number of the interfaces in the direct connection interface set, adding a two-layer network equipment mark to the direct connection interface set; and S4, drawing a network topology map of the target network according to the network information of the three-layer network equipment, the direct connection interface set and the two-layer network equipment mark.
The above-described embodiments of the network topology generating device and the like are merely illustrative, where units illustrated as separate components may or may not be physically separate, and components displayed as units may or may not be physical units, may be located in one place, or may also be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute the various embodiments or some parts of the methods of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A method for generating a network topology, comprising:
s1, collecting network information of three-layer network equipment in the target network; the network information comprises IP addresses and MAC address tables corresponding to all interfaces contained in the three-layer network equipment;
s2, acquiring a direct connection interface set according to the IP address and the MAC address table corresponding to each interface; wherein, the direct connection interface set comprises a plurality of interfaces which are connected with each other;
s3, if the existence of the two-layer network equipment corresponding to the direct connection interface set is confirmed in the target network according to the number of the interfaces in the direct connection interface set, adding a two-layer network equipment mark to the direct connection interface set;
and S4, drawing a network topology map of the target network according to the network information of the three-layer network equipment, the direct connection interface set and the two-layer network equipment mark.
2. The method according to claim 1, wherein the step of obtaining the set of directly connected interfaces in S2 according to the IP addresses and MAC address tables corresponding to the interfaces specifically includes:
s21, according to the network segment corresponding to each interface IP address, dividing the interfaces belonging to the same network segment into the same network segment group;
s22, acquiring a direct connection interface set in the network segment group according to the MAC address table corresponding to each interface in the same network segment group; and for any interface contained in the direct connection interface set, the MAC address table of the interface contains the MAC addresses of other interfaces in the direct connection interface set.
3. The method according to claim 1, wherein the determining, in S3, that there is a two-layer network device corresponding to the set of direct interfaces in the target network according to the number of interfaces in the set of direct interfaces specifically includes:
and if the number of the interfaces in the direct connection interface set is not less than 3, confirming that at least one two-layer network device exists between the direct connection interfaces contained in the direct connection interface set.
4. The method according to claim 1, wherein the step S3 further comprises:
collecting network information of two-layer network equipment in a target network; the network information comprises an MAC address table corresponding to each interface included in the two-layer network equipment;
if the MAC address table length of the interface of the two-layer network equipment is not less than 2, the interface is determined to be an uplink interface of the two-layer network equipment; if the length of the MAC address table of the interface of the two-layer network equipment is equal to 1 and the MAC address does not belong to the upper-level equipment of the two-layer network equipment, the interface is confirmed to be an access layer interface of the two-layer network equipment;
correspondingly, the step S4 further includes marking an uplink interface and an access layer interface of the two-layer network device.
5. The method according to claim 1, wherein the step of collecting network information of three-layer network devices in the target network in S1 specifically includes:
and acquiring network information of three-layer network equipment in the target network through an SNMP protocol, wherein the network information also comprises three-layer network equipment ID.
6. The method according to claim 5, wherein the step S2 is further followed by:
adding a direct connection mark to interfaces belonging to the same direct connection interface set;
correspondingly, the step S4 specifically includes: drawing a three-layer network equipment icon according to the ID of the three-layer network equipment; adding a connection line to a three-layer network equipment icon corresponding to the interface according to the direct connection mark of the interface; and according to the mark of the two-layer network equipment, drawing the icon of the two-layer network equipment on the connecting line corresponding to the direct connection mark corresponding to the mark of the two-layer network equipment.
7. A network topology generation apparatus, comprising:
the acquisition module is used for acquiring network information of three-layer network equipment in a target network; the network information comprises IP addresses and MAC address tables corresponding to all interfaces contained in the three-layer network equipment;
the acquisition module is used for acquiring a direct connection interface set according to the IP address and the MAC address table corresponding to each interface; wherein, the direct connection interface set comprises a plurality of interfaces which are connected with each other;
the confirming module is used for adding a two-layer network equipment mark to the direct connection interface set if confirming that two-layer network equipment corresponding to the direct connection interface set exists in the target network according to the number of the interfaces in the direct connection interface set;
and the drawing module is used for drawing the network topological graph of the target network according to the network information of the three-layer network equipment, the direct connection interface set and the two-layer network equipment mark.
8. The apparatus according to claim 7, wherein the obtaining module specifically includes:
the dividing unit is used for dividing the interfaces belonging to the same network segment into the same network segment group according to the network segments corresponding to the IP addresses of the interfaces;
the network segment group comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a direct connection interface set in the network segment group according to an MAC address table corresponding to each interface in the same network segment group; and for any interface contained in the direct connection interface set, the MAC address table of the interface contains the MAC addresses of other interfaces in the direct connection interface set.
9. A network topology generation device, comprising:
at least one processor;
and at least one memory communicatively coupled to the processor, wherein: the memory stores program instructions executable by the processor, the processor invoking the program instructions to perform the method of any of claims 1 to 6.
10. A non-transitory computer-readable storage medium storing computer instructions that cause a computer to perform the method of any one of claims 1 to 6.
CN201711484354.8A 2017-12-29 2017-12-29 Network topology generation method, device and equipment Active CN108282362B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711484354.8A CN108282362B (en) 2017-12-29 2017-12-29 Network topology generation method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711484354.8A CN108282362B (en) 2017-12-29 2017-12-29 Network topology generation method, device and equipment

Publications (2)

Publication Number Publication Date
CN108282362A CN108282362A (en) 2018-07-13
CN108282362B true CN108282362B (en) 2021-05-14

Family

ID=62802867

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711484354.8A Active CN108282362B (en) 2017-12-29 2017-12-29 Network topology generation method, device and equipment

Country Status (1)

Country Link
CN (1) CN108282362B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109150602A (en) * 2018-08-16 2019-01-04 郑州云海信息技术有限公司 A kind of method, apparatus, computer storage medium and the terminal of adaptation storage equipment
CN109257225B (en) * 2018-10-12 2021-08-10 北京信研汇智信息技术有限公司 Method, device, storage medium and processor for generating network topology
CN110572278B (en) * 2019-08-19 2023-02-21 中盈优创资讯科技有限公司 Method and device for positioning information of three-layer gateway of metropolitan area network
JP7393264B2 (en) * 2020-03-24 2023-12-06 アズビル株式会社 Network devices and network configuration determination method
CN114465904A (en) * 2020-10-21 2022-05-10 西门子(中国)有限公司 Network topology construction method and computing equipment
CN116319362B (en) * 2023-05-10 2023-07-28 湖南天冠电子信息技术有限公司 Network topology graph generation method

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1756189B (en) * 2004-09-30 2010-04-14 北京航空航天大学 IP network topology discovering method based on SNMP
JP4974848B2 (en) * 2007-10-30 2012-07-11 キヤノン株式会社 Network management device, network management method, and program for executing network management method
CN102045190B (en) * 2009-10-21 2013-01-02 杭州华三通信技术有限公司 Network topology discovery method and device
CN101764709B (en) * 2009-12-29 2012-02-22 福建星网锐捷网络有限公司 Network physical topology discovering method and network management server based on SNMP
CN101873229B (en) * 2010-06-24 2013-02-27 东软集团股份有限公司 Network topology discover method and device based on SNMP (Simple Network Management Protocol)
CN102801567B (en) * 2012-08-28 2015-07-08 北京傲天动联技术股份有限公司 Method for automatically discovering hierarchical network topology and method for establishing hierarchical network topology
CN104092576B (en) * 2014-07-30 2018-04-27 浙江宇视科技有限公司 A kind of network topology computational methods and device

Also Published As

Publication number Publication date
CN108282362A (en) 2018-07-13

Similar Documents

Publication Publication Date Title
CN108282362B (en) Network topology generation method, device and equipment
CN112787841B (en) Fault root cause positioning method and device and computer storage medium
CN101707537B (en) Positioning method of failed link and alarm root cause analyzing method, equipment and system
CN112491636B (en) Data processing method and device and computer storage medium
JP2013511207A5 (en)
CN109428749A (en) Network management and relevant device
CN103905251A (en) Network topology obtaining method and device
US8914503B2 (en) Detected IP link and connectivity inference
CN105207909B (en) A kind of method and network equipment sending information
US10069715B2 (en) Method for deploying resource in cloud computing environment
CN101945110B (en) Configuration method and device of address resolution protocol entry
CN111193731A (en) Method and device for generating network shooting range scene description file
US9893979B2 (en) Network topology discovery by resolving loops
CN104506405B (en) The method and device of cross-domain access
CN113423120A (en) Data distribution processing method and device based on private network terminal and electronic equipment
CN105323128A (en) Method, device and system for connecting front-end device to server
WO2017143935A1 (en) Connectivity testing method and device
CN108089968A (en) A kind of method of host's machine monitoring virtual-machine data storehouse state
CN106506375B (en) A kind of route renewing method and device
CN105227334A (en) A kind of Fabric method for discovering network topology and device
US20160344571A1 (en) Determining Connections Between Disconnected Partial Trees
US20160344591A1 (en) Determining Connections of Non-External Network Facing Ports
CN111416762B (en) Method, device, system and storage medium for establishing network tunnel
US20190207804A1 (en) Node fault isolation
CN111865640A (en) Network architecture description method and device

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