CN111600762B - Network topology structure generation method, device, equipment and medium - Google Patents

Network topology structure generation method, device, equipment and medium Download PDF

Info

Publication number
CN111600762B
CN111600762B CN202010489668.2A CN202010489668A CN111600762B CN 111600762 B CN111600762 B CN 111600762B CN 202010489668 A CN202010489668 A CN 202010489668A CN 111600762 B CN111600762 B CN 111600762B
Authority
CN
China
Prior art keywords
equipment
switch
mac address
target
information
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
CN202010489668.2A
Other languages
Chinese (zh)
Other versions
CN111600762A (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.)
Shandong Civic Se Commercial Middleware Co ltd
Original Assignee
Shandong Civic Se Commercial Middleware 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 Shandong Civic Se Commercial Middleware Co ltd filed Critical Shandong Civic Se Commercial Middleware Co ltd
Priority to CN202010489668.2A priority Critical patent/CN111600762B/en
Publication of CN111600762A publication Critical patent/CN111600762A/en
Application granted granted Critical
Publication of CN111600762B publication Critical patent/CN111600762B/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
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/02Standardisation; Integration
    • H04L41/0213Standardised network management protocols, e.g. simple network management protocol [SNMP]
    • 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/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0823Configuration setting characterised by the purposes of a change of settings, e.g. optimising configuration for enhancing reliability
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate

Abstract

The application discloses a method, a device, equipment and a medium for generating a network topology structure, wherein the method comprises the following steps: configuring an IP address field and SNMP parameters; acquiring equipment information of target equipment in the current network by using the IP address field and the SNMP parameter; the device information comprises a device type, an IP address and an MAC address; acquiring first switch information corresponding to switch equipment in the target equipment; the first switch information comprises an MAC address set and a switch port corresponding to each MAC address in the MAC address set; the MAC address set comprises MAC addresses of devices which can be connected with the corresponding switch device; determining a seed IP from the IP address; determining the connection relation of the target equipment by using the target port number corresponding to the seed IP and the first switch information; and binding the connection relation and the equipment information to generate a corresponding network topology structure. The generation efficiency of the network topology structure can be improved, and the workload of network management personnel is reduced.

Description

Network topology structure generation method, device, equipment and medium
Technical Field
The present application relates to the field of communications technologies, and in particular, to a method, an apparatus, a device, and a medium for generating a network topology.
Background
With the continuous development of networks, local area networks are larger and larger, and maintenance work is more and more difficult for network managers. On one hand, the network environment changes at any time, and once problems occur, the analysis and positioning of the problems are difficult. On the other hand, the network environment is complicated, and it is time-consuming and laborious for a network manager to master the local area network topology.
At present, a network manager needs to maintain and draw a network topology structure, and comprehensively analyze the network topology structure according to an ARP table and an MAC table of a switch and actual conditions, so as to correspond the device type, the device IP and the device MAC of the device and generate a connection relation between the devices. In the prior art, a switch needs to be frequently and manually connected, an MAC table and an ARP table are obtained, and the IP and MAC of equipment, the equipment type of the equipment and the equipment type of the equipment are manually analyzed and a topological structure is drawn. Consumes a lot of manpower and time, has a large analysis amount, and is easy to cause errors.
Disclosure of Invention
In view of this, an object of the present application is to provide a method, an apparatus, a device and a medium for generating a network topology, which can improve the generation efficiency of the network topology, thereby reducing the workload of network managers. The specific scheme is as follows:
in a first aspect, the present application discloses a method for generating a network topology, including:
configuring an IP address field and SNMP parameters;
acquiring equipment information of target equipment in the current network by using the IP address field and the SNMP parameter; the device information comprises a device type, an IP address and an MAC address;
acquiring first switch information corresponding to switch equipment in the target equipment; the first switch information comprises an MAC address set and a switch port corresponding to each MAC address in the MAC address set; the MAC address set includes MAC addresses of devices connectable with the corresponding switch device;
determining a seed IP from the IP address;
determining the connection relation of the target equipment by using the target port number corresponding to the seed IP and the first switch information;
and binding the connection relation and the equipment information to generate a corresponding network topology structure.
Optionally, the obtaining, by using the IP address field and the SNMP parameter, device information of a target device in a current network includes:
resolving the IP address field into a corresponding IP address;
SNMP connection is carried out on the analyzed IP address;
and acquiring the MAC address and the equipment type of the target equipment connected to obtain the equipment information.
Optionally, after obtaining the device information of the target device in the current network by using the IP address field and the SNMP parameter, the method further includes:
and correcting the equipment type.
Optionally, after obtaining the device information of the target device in the current network by using the IP address field and the SNMP parameter, the method further includes:
and removing the devices which do not need to participate in the topology generation from the target device.
Optionally, the method for generating a network topology further includes:
acquiring second switch information of switch equipment in the target equipment; the second switch information comprises a switch port and a corresponding port type;
and eliminating the VLAN port in the first switch information and the MAC address corresponding to the VLAN port by using the second switch information.
Optionally, the determining, by using the target port number corresponding to the seed IP and the first switch information, a connection relationship of the target device includes:
deleting the MAC address corresponding to the target port number in the first switch information;
establishing a first topological data set; the first topology data set comprises the MAC address set corresponding to the first switch device; the first switch device is all switch devices except the device corresponding to the seed IP in the target device;
traversing the first topology data set, and determining first direct connection equipment connected with the seed IP; the first direct connection equipment corresponds to a target MAC address set; the target MAC address set is the MAC address set with the maximum number of MAC addresses in the first topological data set;
traversing the target MAC address set to obtain the equipment type corresponding to each MAC address in the target MAC address set;
establishing a second topological data set; the second topology data set comprises the MAC address set corresponding to second switch equipment, and the second switch equipment is equipment of which the equipment type corresponding to the MAC address in the target MAC address set is switch equipment; traversing the second topology data set, and determining second direct-connection equipment connected with the first direct-connection equipment;
if the device types corresponding to the MAC addresses in the target MAC address set are not switch devices, judging that the devices corresponding to the MAC addresses in the target MAC address set are directly connected with the first direct connection device;
and continuously iterating until the connection relation of all the target devices is determined.
Optionally, the establishing the first topology data set includes: establishing the first topology data set by taking the IP address of the switch equipment as KEY and taking the MAC address set corresponding to the switch equipment as VALUE; the establishing of the second topological data set comprises: and establishing the second topology data set by taking the IP address of the switch equipment as KEY and the MAC address set corresponding to the switch equipment as VALUE.
In a second aspect, the present application discloses a network topology generating apparatus, including:
the parameter configuration module is used for configuring the IP address field and the SNMP parameters;
the equipment information acquisition module is used for acquiring the equipment information of the target equipment in the current network by using the IP address field and the SNMP parameters; the device information comprises a device type, an IP address and an MAC address;
the switch information acquisition module is used for acquiring first switch information corresponding to switch equipment in the target equipment; the first switch information comprises an MAC address set and a switch port corresponding to each MAC address in the MAC address set; the MAC address set includes MAC addresses of devices connectable with the corresponding switch device;
the seed IP determining module is used for determining a seed IP from the IP address;
a connection relation determining module, configured to determine a connection relation of the target device by using the target port number corresponding to the seed IP and the first switch information;
and the topological structure generating module is used for binding the connection relation and the equipment information to generate a corresponding network topological structure.
In a third aspect, the application discloses a network topology generating device, comprising a processor and a memory; wherein the content of the first and second substances,
the memory is used for storing a computer program;
the processor is configured to execute the computer program to implement the foregoing network topology generation method.
In a fourth aspect, the present application discloses a computer readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the aforementioned network topology generating method.
Therefore, the IP address field and the SNMP parameters are firstly configured; acquiring equipment information of target equipment in the current network by using the IP address field and the SNMP parameter; the device information comprises a device type, an IP address and an MAC address; acquiring first switch information corresponding to switch equipment in the target equipment; the first switch information comprises an MAC address set and a switch port corresponding to each MAC address in the MAC address set; the MAC address set includes MAC addresses of devices connectable with the corresponding switch device; determining a seed IP from the IP address; determining the connection relation of the target equipment by using the target port number corresponding to the seed IP and the first switch information; and binding the connection relation and the equipment information to generate a corresponding network topology structure. Therefore, the IP address field and the SNMP parameters are configured firstly, then the equipment information of the target equipment and the first switch information are obtained, finally the connection relation of the target equipment is determined through the first switch information and the target port number of the seed IP, a corresponding network topology structure is generated, the generation efficiency of the network topology structure can be improved, and the workload of network managers is reduced.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a network topology generation method disclosed in the present application;
fig. 2 is a flowchart of a network topology generation method disclosed in the present application;
FIG. 3 is a schematic diagram of a specific network topology disclosed herein;
fig. 4 is a flowchart of a specific network topology generation method disclosed in the present application;
FIG. 5 is a flow diagram illustrating a specific switch topology data preparation process disclosed herein;
fig. 6 is a schematic structural diagram of a network topology generating apparatus disclosed in the present application;
fig. 7 is a diagram of a network topology generating device structure disclosed in the present application;
fig. 8 is a structural diagram of an electronic terminal disclosed in the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, 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 application.
At present, a network manager needs to comprehensively analyze a drawn network topology structure according to an ARP table and an MAC table of a switch and an actual situation, so as to correspond a device type, a device IP, and a device MAC of a device and generate a connection relationship between the devices. In the prior art, a switch needs to be frequently and manually connected, an MAC table and an ARP table are obtained, and the IP and MAC of equipment, the equipment type of the equipment and the equipment type of the equipment are manually analyzed, and a topological structure is drawn. Consumes a lot of manpower and time, has a large analysis amount, and is easy to cause errors. Therefore, the network topology generation scheme is provided, the generation efficiency of the network topology can be improved, and the workload of network management personnel is reduced.
Referring to fig. 1, an embodiment of the present application discloses a method for generating a network topology, including:
step S11: an IP address field and SNMP (simple network management protocol) parameters are configured.
In a specific implementation manner, this embodiment may configure an IP address segment according to an IP address specification, and flexibly configure SNMP parameters according to different V2c/V3 versions, where the necessary SNMP parameters include timeout time and retry times.
Step S12: acquiring equipment information of target equipment in the current network by using the IP address field and the SNMP parameter; the device information includes a device type, an IP address, and a MAC address.
In a specific implementation manner, this embodiment may resolve the IP address field into a corresponding IP address; SNMP connection is carried out on the analyzed IP address; and acquiring the MAC address and the device type of the connected target device to obtain the device information. That is, in this embodiment, through the configured IP address field and SNMP parameter, the device matched in the network environment is discovered and the type, IP, and MAC address of the device are determined and obtained. Specifically, the IP address field is first analyzed into an IP set composed of individual IPs, and an SNMP object creation method of SNMP4j. SNMP connections are then made for each IP in the IP set. The devices are primarily classified into servers and switches according to three switch-specific OIDs (object identifiers) of 1.3.6.1.2.1.17.1.2.6.0, 1.3.6.1.1.2.1.17.2.7.0. Obtaining the value of ipIndex by using 1.3.6.1.2.1.2.2.1.6+ IP, obtaining the MAC address of the equipment by using 1.3.6.1.2.1.4.20.1.2+ ipIndex, and encapsulating the obtained MAC address, equipment type, IP address and SNMP connection parameter information together. Finally, a device object (the device object contains IP, MAC, device type, SNMP connection parameter) set is obtained.
In addition, in a specific implementation manner, this embodiment may correct the device type, and remove devices that do not need to participate in the topology generation from the target device.
It should be noted that with the development of the computer industry, a plurality of equipment manufacturers are in the process of being transported, and all the manufacturers are in the same place. This also leads to problems, such as the server hardware devices being of substantially the same type but acting differently because of different software installations, etc. For these problems, the present embodiment may correct the device type, and remove the device that does not need to participate in the generation of the topology structure from the target device, specifically, may implement a function of manually modifying the device type, and provide a screening function, that is, remove the device that does not want to participate in the generation of the topology relationship.
For example, referring to fig. 2, fig. 2 is a flowchart of a network topology generation method disclosed in the embodiment of the present application.
Step S13: acquiring first switch information corresponding to switch equipment in the target equipment; the first switch information comprises an MAC address set and a switch port corresponding to each MAC address in the MAC address set; the MAC address set includes MAC addresses of devices that can be connected with the corresponding switch device.
That is, the present embodiment may acquire the MAC table of the switch device.
Step S14: and determining a seed IP from the IP address.
In a specific implementation manner, in this embodiment, an IP is selected from all device IPs participating in the generation of the topological relation, and the IP is used as an uplink direction of the network, so that the upper layer relation of the devices in the network environment is analyzed according to the port number of the switch device where the IP is located, so as to determine the connection relation between the devices.
Step S15: and determining the connection relation of the target equipment by using the target port number corresponding to the seed IP and the first switch information.
In a specific implementation manner, in this embodiment, the MAC address corresponding to the target port number is deleted in the first switch information; establishing a first topological data set; the first topology data set comprises the MAC address set corresponding to the first switch device; the first switch device is all switch devices except the device corresponding to the seed IP in the target device; traversing the first topology data set, and determining first direct connection equipment connected with the seed IP; the first direct connection equipment corresponds to a target MAC address set; the target MAC address set is the MAC address set with the maximum number of MAC addresses in the first topological data set; traversing the target MAC address set to obtain the equipment type corresponding to each MAC address in the target MAC address set; establishing a second topological data set; the second topology data set comprises the MAC address set corresponding to second switch equipment, and the second switch equipment is equipment of which the equipment type corresponding to the MAC address in the target MAC address set is the switch equipment; traversing the second topology data set, and determining second direct-connection equipment connected with the first direct-connection equipment; if the device types corresponding to the MAC addresses in the target MAC address set are not switch devices, judging that the devices corresponding to the MAC addresses in the target MAC address set are directly connected with the first direct connection device; and continuously iterating until the connection relation of all the target devices is determined.
It should be noted that, because of the characteristics of the switch MAC table, after deleting all MAC addresses of the port where the seed IP is located, the closer the device MAC table connected to the seed IP, i.e., the MAC addresses in the corresponding MAC address set, the more distant the device MAC table, the fewer MAC addresses in the MAC table. For example, as shown in fig. 3, fig. 3 is a schematic diagram of a specific network topology disclosed in an embodiment of the present application, where a seed IP is located on port 1 of a switch C, a MAC of port 1 is removed, a MAC table of a device C includes a, B, and D, the seed IP is located on port 1 of the device a while port 1 includes a MAC of the device C, a MAC address of port 1 of the device a is deleted, a MAC table of the device a includes B and D, and so on, the farther a switch device from the seed node E, the fewer MAC addresses included in the MAC table of the switch device are. From which the network topology is derived.
Step S16: and binding the connection relation and the equipment information to generate a corresponding network topology structure.
That is, in the embodiment of the present application, a simple network protocol of SNMP may be used to search for a device within a specified IP range, and the device type, the MAC address, and the IP address are obtained for the matched device through the OID in the MIB, and the MAC table of the found switch device is obtained. And taking an appointed seed IP (IP which can be reached arbitrarily in a network environment) as an uplink direction in the network, deeply traversing the MAC table acquired by the SNMP by using a tree traversal idea, thereby integrating the connection relation among the MAC addresses, and finally binding the connection relation among the MAC addresses with the IP addresses and the equipment types to acquire the network topology structure.
Therefore, the embodiment of the application firstly configures an IP address field and SNMP parameters; acquiring equipment information of target equipment in the current network by using the IP address field and the SNMP parameter; the device information comprises a device type, an IP address and an MAC address; acquiring first switch information corresponding to switch equipment in the target equipment; the first switch information comprises an MAC address set and a switch port corresponding to each MAC address in the MAC address set; the MAC address set includes MAC addresses of devices connectable with the corresponding switch device; determining a seed IP from the IP address; determining the connection relation of the target equipment by using the target port number corresponding to the seed IP and the first switch information; and binding the connection relation and the equipment information to generate a corresponding network topology structure. Therefore, the IP address field and the SNMP parameters are configured firstly, then the equipment information of the target equipment and the first switch information are obtained, finally the connection relation of the target equipment is determined through the first switch information and the target port number of the seed IP, a corresponding network topology structure is generated, the generation efficiency of the network topology structure can be improved, and the workload of network managers is reduced.
Referring to fig. 4, an embodiment of the present application discloses a method for generating a network topology, including:
step S21: and configuring an IP address field and SNMP parameters.
Step S22: acquiring equipment information of target equipment in the current network by using the IP address field and the SNMP parameter; the device information includes a device type, an IP address, and a MAC address.
Step S23: acquiring first switch information corresponding to switch equipment in the target equipment; the first switch information comprises an MAC address set and a switch port corresponding to each MAC address in the MAC address set; the MAC address set includes MAC addresses of devices that can be connected with the corresponding switch device.
In a specific embodiment, SNMP may be used to send a request to the switch via the oid1.3.6.1.2.1.17.7.1.2.2.1.2, and the returned value is processed as follows: and removing the character string 1.3.6.1.2.1.17.7.1.2.2.1.2 from the key, then converting the hexadecimal system to obtain the MAC address, wherein the value is the port number of the MAC address, and generating a Map set macaddresportTable with the MAC address as the key and the port number as the value.
Step S24: acquiring second switch information of switch equipment in the target equipment; the second switch information includes switch ports and corresponding port types.
In a specific embodiment, SNMP is used to send a request to the switch over the oid1.3.6.1.2.1.2.2.1.3, and the returned value is processed as follows: and removing the character string 1.3.6.1.2.1.2.2.2.1.3 from the key, then obtaining the port number, taking the value as the port type of the port, and generating a Map set switchPortTypeTable with the port number as the key and the port type as the value.
Step S25: and eliminating the VLAN port in the first switch information and the MAC address corresponding to the VLAN port by using the second switch information.
This embodiment may combine switchportTypeTable and macaddrespsPortTable to remove a port (VLAN port) with a port type value of 136 from the macaddrespsPortTable.
It can be understood that, filtering the VLAN ports can avoid the situation that the same network device generates multiple nodes, thereby greatly improving the reliability of the network topology.
Step S26: and determining a seed IP from the IP address.
This embodiment finds the port number where the seed IP is located from the macaddresporttable table, and deletes all MAC addresses belonging to the port from the macaddresporttable.
Step S27: and determining the connection relation of the target equipment by using the target port number corresponding to the seed IP and the first switch information.
In a specific implementation manner, the switch device IP may be used as a key, and all MAC addresses in the macaddresporttable are extracted to form a Set < String > as a value, and the Set < String > is placed in the topology Set topoxymap. For example, referring to fig. 5, fig. 5 is a flowchart for preparing specific switch topology data disclosed in an embodiment of the present application. Generating a topological relation by using a topological set topotaxyMap, wherein the topological relation comprises the following steps: step one, traversing all switch MAC address macSet sets in the topotaxyMap, finding out the macSet set with the largest size, and determining the macSet as a parentmatset. And in the second step, the device corresponding to the parenTMacSet is a direct-connection device of the seed IP. Traversing the parentmast, judging the device type of each device corresponding to each MAC, if the device type is a switch, acquiring macSet of the device from topotaxyMap, and putting the macSet into a new nextMap set, wherein the device IP is key, and the macSet is value. And thirdly, deleting the equipment data in the nextMap from the topoxyMap, and performing the operations of the first step and the second step on the nextMap, and continuously iterating. When a macSet does not contain a switch device and the MAC of the macSet is not in the hasnoductutermac, the MAC in the switch is considered that the server MAC is directly connected with the switch, and the MAC is stored in the set hasnoductutermac set.
Taking the topology of fig. 3 as an example, the macSet of C is found to be the largest in the first operation, and it is determined that C is directly connected to E. The macSet set of C comprises MAC addresses of the devices A, B and D, the devices A and B are found to be switch devices after traversal, the macSet of the devices A and B is deleted from the topotaxyMap, a new nextMap is formed, and iteration is carried out. And (3) determining that A is directly connected with C because the size of the macSet of A in the nextMap is maximum, so that the macSet of A is obtained and traversed, B contained in the macSet is found to be a switch, the macSet of B is deleted from the nextMap to form a new set, the connection between B and A is determined, and iteration is executed again. And B does not contain the switch MAC, D in the MAC table is judged to be directly connected with the switch MAC, and the iteration of B is finished. And if the iteration returned to A finds that the macSet of A does not have the MAC address meeting the condition of the direct connection server, the iteration of A is finished, and the iteration returned to C has the same C as A. The topology iteration is completed. Thus, the analysis of the connection relationship of the devices in the entire network environment is completed.
Step S28: and binding the connection relation and the equipment information to generate a corresponding network topology structure.
That is, according to the embodiment of the present application, the IP address range and the SNMP parameter are configured, and the IP and MAC addresses of the individual devices can be obtained through the SNMP without obtaining the device information from the switch MAC table and the ARP table, so that the topology structure of the network is obtained, and manpower, material resources, and time consumed by network maintenance are greatly reduced.
Referring to fig. 6, an embodiment of the present application discloses a network topology generating device, including:
the parameter configuration module 11 is used for configuring the IP address field and the SNMP parameters;
the device information acquiring module 12 is configured to acquire device information of a target device in a current network by using the IP address field and the SNMP parameter; the device information comprises a device type, an IP address and an MAC address;
the switch information obtaining module 13 is configured to obtain first switch information corresponding to a switch device in the target device; the first switch information comprises an MAC address set and a switch port corresponding to each MAC address in the MAC address set; the MAC address set includes MAC addresses of devices connectable with the corresponding switch device;
a seed IP determining module 14, configured to determine a seed IP from the IP address;
a connection relation determining module 15, configured to determine a connection relation of the target device by using the target port number corresponding to the seed IP and the first switch information;
a topology generating module 16, configured to bind the connection relationship and the device information to generate a corresponding network topology.
Therefore, the IP address field and the SNMP parameters are firstly configured in the embodiment of the application; acquiring equipment information of target equipment in the current network by using the IP address field and the SNMP parameter; the device information comprises a device type, an IP address and an MAC address; acquiring first switch information corresponding to switch equipment in the target equipment; the first switch information comprises an MAC address set and a switch port corresponding to each MAC address in the MAC address set; the MAC address set includes MAC addresses of devices connectable with the corresponding switch device; determining a seed IP from the IP address; determining the connection relation of the target equipment by using the target port number corresponding to the seed IP and the first switch information; and binding the connection relation and the equipment information to generate a corresponding network topology structure. Therefore, the IP address field and the SNMP parameters are configured firstly, then the equipment information of the target equipment and the first switch information are obtained, finally the connection relation of the target equipment is determined through the first switch information and the target port number of the seed IP, a corresponding network topology structure is generated, the generation efficiency of the network topology structure can be improved, and the workload of network managers is reduced.
The device information obtaining module 12 is specifically configured to resolve the IP address field into a corresponding IP address; SNMP connection is carried out on the analyzed IP address; and acquiring the MAC address and the device type of the connected target device to obtain the device information.
The network topology structure generation device further comprises an equipment type correction module used for correcting the equipment type.
The network topology structure generation device further comprises an equipment removing module, which is used for removing the equipment which does not need to participate in the topology structure generation from the target equipment.
The switch information obtaining module 13 may be further configured to obtain second switch information of a switch device in the target device; the second switch information includes switch ports and corresponding port types. Correspondingly, the network topology structure generating device further comprises a port filtering module, which is used for eliminating the VLAN port in the first switch information and the MAC address corresponding to the VLAN port by using the second switch information.
The connection relation determining module 15 is specifically configured to delete the MAC address corresponding to the target port number in the first switch information; establishing a first topological data set; the first topology data set comprises the MAC address set corresponding to the first switch device; the first switch device is all switch devices except the device corresponding to the seed IP in the target device; traversing the first topology data set, and determining first direct connection equipment connected with the seed IP; the first direct connection device corresponds to a target MAC address set; the target MAC address set is the MAC address set with the maximum number of MAC addresses in the first topological data set; traversing the target MAC address set to obtain the equipment type corresponding to each MAC address in the target MAC address set; establishing a second topological data set; the second topology data set comprises the MAC address set corresponding to second switch equipment, and the second switch equipment is equipment of which the equipment type corresponding to the MAC address in the target MAC address set is the switch equipment; traversing the second topology data set, and determining second direct-connection equipment connected with the first direct-connection equipment; if the device types corresponding to the MAC addresses in the target MAC address set are not switch devices, judging that the devices corresponding to the MAC addresses in the target MAC address set are directly connected with the first direct connection device; and continuously iterating until the connection relation of all the target devices is determined.
The connection relation determining module 15 includes a first topology data set establishing module, and is specifically configured to establish the first topology data set by using the IP address of the switch device as KEY and using the MAC address set corresponding to the switch device as VALUE. The connection relation determining module 15 includes a second topology data set establishing module, and is specifically configured to establish the second topology data set by using the IP address of the switch device as KEY and using the MAC address set corresponding to the switch device as VALUE.
Referring to fig. 7, an embodiment of the present application discloses a network topology generating device, which includes a processor 21 and a memory 22; wherein, the memory 22 is used for saving computer programs; the processor 21 is configured to execute the computer program to implement the network topology generation method disclosed in the foregoing embodiment.
For the specific process of the network topology generation method, reference may be made to corresponding contents disclosed in the foregoing embodiments, and details are not described herein again.
Referring to fig. 8, the embodiment of the present application discloses an electronic terminal 20, which includes a processor 21 and a memory 22 disclosed in the foregoing embodiments. For the steps that the processor 21 can specifically execute, reference may be made to corresponding contents disclosed in the foregoing embodiments, and details are not described herein again.
Further, the electronic terminal 20 in this embodiment may further specifically include a power supply 23, a communication interface 24, an input/output interface 25, and a communication bus 26; the power supply 23 is configured to provide a working voltage for each hardware device on the terminal 20; the communication interface 24 can create a data transmission channel with an external device for the terminal 20, and a communication protocol followed by the communication interface is any communication protocol applicable to the technical solution of the present application, and is not specifically limited herein; the input/output interface 25 is configured to acquire external input data or output data to the outside, and a specific interface type thereof may be selected according to specific application requirements, which is not specifically limited herein.
Further, an embodiment of the present application also discloses a computer-readable storage medium for storing a computer program, where the computer program is executed by a processor to implement the network topology generation method disclosed in the foregoing embodiment.
For the specific process of the network topology generation method, reference may be made to corresponding contents disclosed in the foregoing embodiments, and details are not described herein again.
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The method, apparatus, device and medium for generating a network topology provided by the present application are described in detail above, and specific examples are applied in the present disclosure to explain the principles and embodiments of the present application, and the description of the above embodiments is only used to help understand the method and core ideas of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, the specific implementation manner and the application scope may be changed, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (9)

1. A method for generating a network topology, comprising:
configuring an IP address field and SNMP parameters;
acquiring equipment information of target equipment in the current network by using the IP address field and the SNMP parameter; the device information comprises a device type, an IP address and an MAC address;
acquiring first switch information corresponding to switch equipment in the target equipment; the first switch information comprises an MAC address set and a switch port corresponding to each MAC address in the MAC address set; the MAC address set includes MAC addresses of devices connectable with the corresponding switch device;
determining a seed IP from the IP address;
determining the connection relation of the target equipment by using the target port number corresponding to the seed IP and the first switch information;
binding the connection relation and the equipment information to generate a corresponding network topology structure;
wherein, the determining the connection relationship of the target device by using the target port number corresponding to the seed IP and the first switch information includes: deleting the MAC address corresponding to the target port number in the first switch information; establishing a first topological data set; the first topology data set comprises the MAC address set corresponding to the first switch device; the first switch device is all switch devices except the device corresponding to the seed IP in the target device; traversing the first topology data set, and determining first direct connection equipment connected with the seed IP; the first direct connection equipment corresponds to a target MAC address set; the target MAC address set is the MAC address set with the maximum number of MAC addresses in the first topological data set; traversing the target MAC address set to obtain the equipment type corresponding to each MAC address in the target MAC address set; establishing a second topological data set; the second topology data set comprises the MAC address set corresponding to second switch equipment, and the second switch equipment is equipment of which the equipment type corresponding to the MAC address in the target MAC address set is the switch equipment; traversing the second topology data set, and determining second direct-connection equipment connected with the first direct-connection equipment; if the device types corresponding to the MAC addresses in the target MAC address set are not the switch devices, judging that the devices corresponding to the MAC addresses in the target MAC address set are directly connected with the first direct connection device; and continuously iterating until the connection relation of all the target devices is determined.
2. The method according to claim 1, wherein the obtaining device information of a target device in a current network using the IP address field and the SNMP parameter includes:
resolving the IP address segment into a corresponding IP address;
SNMP connection is carried out on the analyzed IP address;
and acquiring the MAC address and the equipment type of the target equipment connected to obtain the equipment information.
3. The method according to claim 1, wherein after obtaining the device information of the target device in the current network using the IP address field and the SNMP parameter, the method further comprises:
and correcting the equipment type.
4. The method according to claim 1, wherein after obtaining the device information of the target device in the current network using the IP address field and the SNMP parameter, the method further comprises:
and removing the devices which do not need to participate in the topology generation from the target device.
5. The method of generating a network topology according to claim 1, further comprising:
acquiring second switch information of switch equipment in the target equipment; the second switch information comprises switch ports and corresponding port types;
and eliminating the VLAN port in the first switch information and the MAC address corresponding to the VLAN port by using the second switch information.
6. The network topology generation method of claim 1,
the establishing of the first topological data set comprises the following steps: establishing the first topology data set by taking the IP address of the switch equipment as KEY and taking the MAC address set corresponding to the switch equipment as VALUE;
the establishing of the second topological data set comprises: and establishing the second topology data set by taking the IP address of the switch equipment as KEY and taking the MAC address set corresponding to the switch equipment as VALUE.
7. A network topology generation apparatus, comprising:
the parameter configuration module is used for configuring the IP address field and the SNMP parameters;
the equipment information acquisition module is used for acquiring the equipment information of the target equipment in the current network by using the IP address field and the SNMP parameters; the device information comprises a device type, an IP address and an MAC address;
the switch information acquisition module is used for acquiring first switch information corresponding to switch equipment in the target equipment; the first switch information comprises an MAC address set and a switch port corresponding to each MAC address in the MAC address set; the MAC address set comprises MAC addresses of devices which can be connected with the corresponding switch device;
a seed IP determining module used for determining a seed IP from the IP address;
a connection relation determining module, configured to determine a connection relation of the target device by using the target port number corresponding to the seed IP and the first switch information;
a topology generating module, configured to bind the connection relationship and the device information to generate a corresponding network topology;
the connection relation determining module is specifically configured to delete the MAC address corresponding to the target port number in the first switch information; establishing a first topological data set; the first topology data set comprises the MAC address set corresponding to the first switch device; the first switch device is all switch devices except the device corresponding to the seed IP in the target device; traversing the first topology data set, and determining first direct connection equipment connected with the seed IP; the first direct connection equipment corresponds to a target MAC address set; the target MAC address set is the MAC address set with the maximum number of MAC addresses in the first topological data set; traversing the target MAC address set to obtain the equipment type corresponding to each MAC address in the target MAC address set; establishing a second topological data set; the second topology data set comprises the MAC address set corresponding to second switch equipment, and the second switch equipment is equipment of which the equipment type corresponding to the MAC address in the target MAC address set is the switch equipment; traversing the second topology data set, and determining second direct-connection equipment connected with the first direct-connection equipment; if the device types corresponding to the MAC addresses in the target MAC address set are not switch devices, judging that the devices corresponding to the MAC addresses in the target MAC address set are directly connected with the first direct connection device; and continuously iterating until the connection relation of all the target devices is determined.
8. A network topology generation device, comprising a processor and a memory; wherein the content of the first and second substances,
the memory is used for storing a computer program;
the processor for executing the computer program to implement the network topology generation method of any of claims 1 to 6.
9. A computer-readable storage medium for storing a computer program, wherein the computer program when executed by a processor implements the network topology generating method of any of claims 1 to 6.
CN202010489668.2A 2020-06-02 2020-06-02 Network topology structure generation method, device, equipment and medium Active CN111600762B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010489668.2A CN111600762B (en) 2020-06-02 2020-06-02 Network topology structure generation method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010489668.2A CN111600762B (en) 2020-06-02 2020-06-02 Network topology structure generation method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN111600762A CN111600762A (en) 2020-08-28
CN111600762B true CN111600762B (en) 2023-04-07

Family

ID=72184528

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010489668.2A Active CN111600762B (en) 2020-06-02 2020-06-02 Network topology structure generation method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN111600762B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114465904A (en) * 2020-10-21 2022-05-10 西门子(中国)有限公司 Network topology construction method and computing equipment
CN112866011B (en) * 2021-01-04 2023-09-26 北京全路通信信号研究设计院集团有限公司 Method, device, equipment and medium for determining network topology structure
CN112968837A (en) * 2021-02-04 2021-06-15 杭州和利时自动化有限公司 Network structure analysis method, device, equipment and storage medium
CN116132299A (en) * 2021-08-03 2023-05-16 华为技术有限公司 Processing method and device
CN114124782B (en) * 2021-11-24 2023-02-28 北京鼎兴达信息科技股份有限公司 Method for determining IP service path of terminal
CN116827801B (en) * 2023-08-25 2023-12-15 武汉吧哒科技股份有限公司 Network topology construction method, device, computer equipment and readable storage medium
CN117176588B (en) * 2023-11-03 2024-02-06 烽台科技(北京)有限公司 Method and device for constructing network topology, electronic equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101330405A (en) * 2008-07-02 2008-12-24 北京亿阳信通软件研究院有限公司 Method for discovering network topology and related equipment
CN102694689A (en) * 2012-06-06 2012-09-26 杭州华三通信技术有限公司 Method and device for discovering network topology
CN104468365A (en) * 2014-07-09 2015-03-25 北京东土科技股份有限公司 Method, system and device for obtaining topology connection relationship between devices

Family Cites Families (4)

* 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
CN100372308C (en) * 2005-10-14 2008-02-27 杭州华三通信技术有限公司 Network topological graph updation and management
US8125927B2 (en) * 2008-06-18 2012-02-28 Solana Networks Inc. Method and system for network topology discovery
CN109257225B (en) * 2018-10-12 2021-08-10 北京信研汇智信息技术有限公司 Method, device, storage medium and processor for generating network topology

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101330405A (en) * 2008-07-02 2008-12-24 北京亿阳信通软件研究院有限公司 Method for discovering network topology and related equipment
CN102694689A (en) * 2012-06-06 2012-09-26 杭州华三通信技术有限公司 Method and device for discovering network topology
CN104468365A (en) * 2014-07-09 2015-03-25 北京东土科技股份有限公司 Method, system and device for obtaining topology connection relationship between devices

Also Published As

Publication number Publication date
CN111600762A (en) 2020-08-28

Similar Documents

Publication Publication Date Title
CN111600762B (en) Network topology structure generation method, device, equipment and medium
US8565119B2 (en) Network discovery and data transfer using SNMP in an electric power transmission or distribution system
WO2020010887A1 (en) Network deployment method and apparatus
US7821966B2 (en) Method and apparatus for network topology discovery using closure approach
CN107733713B (en) Method, system, device and storage medium for acquiring network topology in hybrid network
CN108880844B (en) Method and device for constructing network topology
US20050135274A1 (en) Centralized link-scope configuration of an internet protocol (IP) network
US20140317313A1 (en) Nat sub-topology management server
CN110474816B (en) Method for discovering network topology and storage medium
CN114553752A (en) Network performance testing method and device based on simulation software and computer equipment
CN110557292A (en) Topological graph obtaining method, device and equipment based on distributed routing Internet of things
CN109510717B (en) Method, device, equipment and storage medium for acquiring information of node equipment
CN112272244B (en) Router WAN end IPv6 internet mode configuration method and device
CN111416732B (en) Method and device for automatically configuring service for capacity expansion of network equipment in SDN
CN110768870B (en) Quality monitoring method and device for intelligent special line
CN112866011B (en) Method, device, equipment and medium for determining network topology structure
CN110995483A (en) Network topology discovery method and device
US8144627B2 (en) Inferring connectivity in the presence of conflicting network data
CN107018007A (en) A kind of method that network management protocol finds the network equipment automatically
CN113079049B (en) Automatic network message aggregation analysis method, equipment and medium for intelligent substation
US10200445B2 (en) Method for analyzing performance of network application program in software defined networking environment, apparatus therefor, and computer program therefor
CN112087322B (en) Method, device and equipment for configuring basic information of network element and readable storage medium
CN116260726A (en) Topology discovery method, device, terminal and storage medium
CN110601892B (en) Main module access method, device and equipment based on object-oriented protocol
CN114024859A (en) Network topology generation method based on equipment and link discovery, storage medium and terminal

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