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

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

Info

Publication number
CN116566832A
CN116566832A CN202310518893.8A CN202310518893A CN116566832A CN 116566832 A CN116566832 A CN 116566832A CN 202310518893 A CN202310518893 A CN 202310518893A CN 116566832 A CN116566832 A CN 116566832A
Authority
CN
China
Prior art keywords
access control
media access
network
address
traversed
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.)
Pending
Application number
CN202310518893.8A
Other languages
Chinese (zh)
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.)
Zhejiang Dahua Technology Co Ltd
Original Assignee
Zhejiang Dahua 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 Zhejiang Dahua Technology Co Ltd filed Critical Zhejiang Dahua Technology Co Ltd
Priority to CN202310518893.8A priority Critical patent/CN116566832A/en
Publication of CN116566832A publication Critical patent/CN116566832A/en
Pending legal-status Critical Current

Links

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
    • 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
    • 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/668Internet protocol [IP] address subnets
    • 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/695Types of network addresses using masks or ranges of 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Small-Scale Networks (AREA)

Abstract

The invention discloses a method, a device, a storage medium and a processor for generating network topology information. Wherein the method comprises the following steps: acquiring attribute information of equipment, wherein the attribute information is used for representing network attributes of the equipment; determining the network address of each device in the network segment where the device is located based on the subnet mask of the device in the attribute information; the topological connection relation between the devices is determined based on the network addresses of the devices. The invention solves the technical problem of low generation efficiency of network topology information in the related technology.

Description

Method and device for generating network topology information, storage medium and processor
Technical Field
The present invention relates to the field of network topology technologies, and in particular, to a method, an apparatus, a storage medium, and a processor for generating network topology information.
Background
Currently, when determining a network topology connection relationship, the connection relationship between switches is calculated mainly through a link layer connection relationship in a switch, and the switch must start a link layer discovery protocol (Link Layer Discovery Protocol, abbreviated as LLDP), and when the switch is connected with a non-switch, the connection relationship cannot be perceived, which results in difficulty in generating network topology information.
Aiming at the technical problem of low generation efficiency of the network topology information, no effective solution is proposed at present.
Disclosure of Invention
The embodiment of the invention provides a method, a device, a storage medium and a processor for generating network topology information, which are used for at least solving the technical problem of poor network topology information generation efficiency in the related technology.
According to an aspect of an embodiment of the present invention, there is provided a method for generating network topology information, including: acquiring attribute information of equipment, wherein the attribute information is used for representing network attributes of the equipment; determining the network address of each device in the network segment where the device is located based on the subnet mask of the device in the attribute information; the topological connection relation between the devices is determined based on the network addresses of the devices.
According to another aspect of the embodiment of the present invention, there is also provided a device for generating network topology information, including: an acquisition unit configured to acquire attribute information of a device, where the attribute information is used to represent a network attribute of the device; a first determining unit, configured to determine a network address of each device in a network segment where the device is located, based on a subnet mask of the device in the attribute information; and a second determining unit configured to determine a topological connection relationship between the respective devices based on the network addresses of the respective devices.
According to another aspect of the embodiment of the present invention, there is further provided a computer readable storage medium, where the computer readable storage medium includes a stored program, and when the program runs, the device where the computer readable storage medium is controlled to execute the method for generating network topology information according to the embodiment of the present invention.
According to another aspect of an embodiment of the present invention, there is also provided a processor. The processor is used for running a program, wherein the program executes the method for generating the network topology information according to the embodiment of the invention when running.
In the embodiment of the invention, the attribute information of the equipment is acquired, wherein the attribute information is used for representing the network attribute of the equipment; determining the network address of each device in the network segment where the device is located based on the subnet mask of the device in the attribute information; the topological connection relation between the devices is determined based on the network addresses of the devices. That is, in the embodiment of the present invention, the network address of each device in the network segment where the device is located may be determined based on the subnet mask in the attribute information of the device, and after the network address of each device included in the network segment is determined, the network topology connection relationship of each device in the network segment may be determined based on the network address.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiments of the invention and together with the description serve to explain the invention and do not constitute a limitation on the invention. In the drawings:
fig. 1 is a flowchart of a method of generating network topology information according to an embodiment of the present invention;
fig. 2 is a flowchart of a method of generating network topology information according to an embodiment of the present invention;
FIG. 3 is a flow chart of a traversal method according to an embodiment of the invention;
fig. 4 is a schematic diagram of a network topology information generating apparatus according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
According to an embodiment of the present invention, there is provided an embodiment of a method for generating network topology information, it should be noted that the steps shown in the flowchart of the drawings may be performed in a computer system such as a set of computer executable instructions, and that although a logical order is shown in the flowchart, in some cases the steps shown or described may be performed in an order different from that herein.
Fig. 1 is a flowchart of a method for generating network topology information according to an embodiment of the present invention, and as shown in fig. 1, the method may include the steps of:
step S101, acquiring attribute information of a device, where the attribute information is used to represent network attribute information of the device.
In the technical solution provided in the above step S101 of the present invention, attribute information of a device may be obtained, where the device may be a server in a network, and the attribute information of the device includes a network protocol address (Internet Protocol, abbreviated as IP) of the device, a subnet mask of the device, and simple network management protocol (Simple Network Management Protocol, abbreviated as SNMP) information of the device, where the attribute information of the device is used to represent a network attribute of the device.
In this embodiment, the IP, subnet mask, and SNMP information of the device input by the user may be received, and after receiving the information input by the user, the information input by the user may be determined as attribute information of the device.
Step S102, based on the subnet mask of the device in the attribute information, the network address of each device in the network segment where the device is located is determined.
In the technical solution provided in the above step S102 of the present invention, as known from the description in the above step S101, the attribute information of the device includes a subnet mask, which is also referred to as a network mask, an address mask, and a subnet mask, and based on the subnet mask, a network segment where the device is located may be determined, and after the network segment where the device is located is determined, the network address of each device in the network segment may be determined based on the network segment where the device is located.
Optionally, after determining the attribute information of the device, the network address of each device in the network segment where the device is located may be calculated based on the IP address in the attribute information of the device, the subnet mask, and the SNMP information of the device, where the network address may be the IP address of each device in the network segment.
Step S103, determining a topological connection relationship between the devices based on the network addresses of the devices.
In the technical solution provided in the above step S103 of the present invention, because the network address of the device may be an IP address of the device, after determining the network address of each device in the network segment, the corresponding media access control address (Media Access Control, abbreviated as MAC) of each device may be determined in a media access control address mapping table based on the network address of each device, where the mapping relationship between the IP address and the MAC address is stored in the media access control address mapping table. After determining the MAC address of the device, the address resolution protocol mapping table may further search for the IP address corresponding to each determined MAC address, where the address resolution protocol mapping table stores a mapping relationship between the MAC address and the IP address. After determining the IP address of the device, the device interface corresponding to each IP address may be searched in an interface mapping relationship table, where the mapping relationship between the IP address and the device interface is stored in the interface mapping relationship table. Thereafter, a topological connection relationship between the respective devices may be determined based on the determined information.
In this embodiment, after determining the MAC addresses corresponding to the respective devices from the MAC address mapping table, the determined MAC addresses may be summarized to obtain a MAC address list, where the MAC address list may be denoted as MACList. And traversing each MAC address in the MAC address list, searching an IP address corresponding to each MAC address in the address resolution protocol mapping relation table, and summarizing the searched IP addresses to obtain an IP address list, wherein the IP address list can be expressed as ARPList. And then traversing each IP address in the IP address list, searching a device interface corresponding to each IP address in the interface mapping relation table, and summarizing the determined device interfaces to obtain a device interface list, wherein the device interface list can be expressed as an IfTableList.
After determining the MAC address list, the IP address list and the interface list may traverse each list to query connection relationships between devices, and after querying the connection relationships between devices, may further determine network topology connection relationships between devices.
In the above steps S101 to S103, attribute information of the device is acquired, wherein the attribute information is used to represent a network attribute of the device; determining the network address of each device in the network segment where the device is located based on the subnet mask of the device in the attribute information; the topological connection relation between the devices is determined based on the network addresses of the devices. That is, in the embodiment of the present invention, the network address of each device in the network segment where the device is located may be determined based on the subnet mask in the attribute information of the device, after the network address of each device included in the network segment is determined, the connection relationship of each device may be searched in the mapping relationship table based on the network address, and then the network topology information is generated based on the determined connection relationship.
The above-described method of this embodiment is further described below.
As an optional implementation manner, step S103, determining a topological connection relationship between the devices based on the network addresses of the devices, includes: acquiring a media access control address mapping relation table of each device based on the network address of each device, wherein the media access control address mapping relation table comprises the mapping relation between the media access control address and the device port; generating a media access control address list based on the acquired media access control address mapping relation table; based on the media access control address list, a topological connection relationship between the devices is determined.
In this embodiment, since the mapping relationship between the IP address and the MAC address is included in the medium access mapping relationship table, and the network address of the device may be an IP address, based on this, after determining the network address of each device, the medium access control address mapping relationship table of each device may be obtained based on the IP address of each device, where the mapping relationship between the MAC address and the device port is included in the medium access control address mapping relationship table. It should be noted that if the device type of the device is a switch device, the device may obtain the media access control address mapping relationship table of the device based on the IP address of the device, and if the device type of the device is a non-switch device, the device type based on the device may not obtain the media access control address mapping relationship table of the device.
After the acquired media access control address mapping relation table of the device is acquired, the acquired media access control address mapping relation table of the device may be summarized to generate a media access control address list, where the media access control address list may be represented as a MACList, and the media access control address list may include mapping relations between MAC addresses of various switch devices and device ports. Then, a correspondence between the MAC address of the device and the device port may be determined based on the medium access control address list, and if the MAC address of the device corresponds to one device interface and is the MAC address of another switch device, connection between the switch device and the other switch device may be confirmed, and the connection relationship may be determined as a network topology connection relationship of the device.
As an alternative embodiment, generating a media access control address list based on the acquired media access control address mapping relation table includes: in response to obtaining a media access control address mapping relation table of the equipment, determining the equipment type of the equipment as a switch; and generating a device set to be traversed based on the device with the device type being the switch, and summarizing the acquired media access control addresses in the media access control address mapping relation table to obtain a media access control address list.
In this embodiment, taking any device as an example, when acquiring the media access control address mapping relation table of the device based on the IP address of the device, in response to acquiring the media access control address mapping relation table of the device, the device type of the device may be determined as a switch, otherwise, in response to not acquiring the media access control address mapping relation table of the device, the device type of the device may be determined as a non-switch, according to the method, the device types of the devices may be determined, after determining the device types of the devices, the devices with the device types being switches may be summarized to obtain a device set to be traversed, where the device set to be traversed may be expressed as a SwitchList, and the device set to be traversed includes identification information of each switch device, where the identification information may be a device name of the device, an IP address of the device, or a MAC address of the device, and is not limited herein.
As an alternative embodiment, determining a topological connection relationship between devices based on the media access control address list includes: determining a media access control address of equipment to be traversed in a set of equipment to be traversed in a media access control address list, wherein the equipment to be traversed is equipment which is not traversed in the set of equipment to be traversed; determining a mapping relation between the media access control address and a port of the equipment to be traversed based on a media access control address mapping relation table corresponding to the media access control address of the equipment to be traversed; and determining the topological connection relation of the equipment to be traversed based on the mapping relation.
In this embodiment, after determining the device set to be traversed and the media access control address list, each device to be traversed in the device set to be traversed may be traversed, where the devices to be traversed are all switch devices, and the devices to be traversed are devices that are not traversed in the device set to be traversed. Taking one of the devices to be traversed as an example, whether the MAC address of the device to be traversed corresponds to one device interface or not may be determined in the media access control address list, if the MAC address of the device to be traversed corresponds to one device interface and the MAC address is the MAC address of another switch device, connection between the device to be traversed and the other switch device may be confirmed, and the connection relationship may be determined as a network topology connection relationship of the device to be traversed.
Optionally, when each device to be traversed in the set of devices to be traversed is traversed, each traversing one device may mark the traversed device, so as to avoid the occurrence of repeated traversal and missed traversal, and ensure that each device in the set of devices to be traversed may be traversed.
As an alternative embodiment, after generating the medium access control address list, the method further comprises: based on each media access control address in the media access control address list, searching a network address corresponding to each media access control address in the address resolution protocol mapping relation table; and summarizing the inquired network addresses to obtain a network address list.
In this embodiment, the MAC address list includes a mapping relationship between the MAC address of each switch device and the device port, based on which a network address corresponding to each MAC address may be found in an address resolution protocol mapping relationship table according to the MAC address of each switch device in the MAC address list, where the network address may be an IP address, and the address resolution protocol mapping relationship table stores a mapping relationship between the MAC address and the IP address. After determining the network address of each switch device, the determined network addresses may be summarized to obtain a network address list, where the network address list may be denoted as ARPList.
As an alternative embodiment, after obtaining the network address list, the method further comprises: inquiring a device interface corresponding to the network address in an interface mapping relation table based on each network address in the network address list, wherein the interface mapping relation table comprises a mapping relation between the network address and the device port; summarizing the inquired equipment interfaces to obtain an interface list.
In this embodiment, since the network address list includes the IP addresses of the respective devices, based on this, after obtaining the network address list, the device interfaces corresponding to the respective IP addresses may be searched in the interface mapping relationship table according to the IP addresses of the respective devices included in the network address list, where the interface mapping relationship table includes a mapping relationship between the IP addresses and the device interfaces. After determining the device interfaces corresponding to each IP address, the determined device interfaces may be summarized to obtain an interface list, where the interface list may be denoted as IfTableList.
As an optional implementation manner, in response to the mapping relationship between the media access control address of the device to be traversed and the port of the device to be traversed being a one-to-one relationship, the method further includes: inquiring a media access control address corresponding to a device port to be traversed in an interface mapping relation table; and storing the connection relation between the port of the device to be traversed and the media access control address of the device in response to the media access control address being the media access control address of the device type being the switch device.
In this embodiment, the one-to-one relationship is used to indicate that the media access control address of the device to be traversed corresponds to one device port, based on this, when the mapping relationship between the media access control address of the device to be traversed and the device port to be traversed is a one-to-one relationship, the media access control address corresponding to the device port to be traversed, that is, the MAC address corresponding to the device port to be traversed, may be further queried in the interface mapping relationship table, and it is determined whether the MAC address is the media access control address of the device with the device type being the switch, and if the MAC address is the device with the device type being the switch, it is determined that the device to be traversed is connected to the switch device, and then the connection relationship may be stored.
Example 2
The technical solution of the embodiment of the present invention is illustrated below in connection with the preferred embodiment.
In the related art, when determining a network topology connection relationship, the connection relationship between the switches is calculated mainly through the link layer connection relationship in the switches, and the switches must start the LLDP protocol, and when the switches are connected with the non-switches, the connection relationship cannot be perceived, so that it is difficult to generate network topology information.
However, in the embodiment of the present invention, the network address of each device in the network segment where the device is located may be determined by acquiring the attribute information of the device, and further based on the subnet mask of the device in the attribute information of the device, and based on the network address of each device, the topology connection relationship between each device is determined. That is, in the embodiment of the present invention, the network address of each device in the network segment where the device is located may be determined based on the subnet mask in the attribute information of the device, after the network address of each device included in the network segment is determined, the network topology connection relationship of each device in the network segment may be determined based on the network address.
The method for generating the network topology information in the embodiment of the invention is further described below.
Fig. 2 is a flowchart of a method for generating network topology information according to an embodiment of the present invention, and as shown in fig. 2, the method may include the steps of:
step S201, obtain the IP and subnet mask where the current server is located.
In this embodiment, the IP address of the current server, the subnet mask, and SNMP information entered by the user may be received.
Step S202, all IP addresses of the current subnet are calculated and stored in the IPList.
In this embodiment, after receiving the information input by the user, all IP addresses of the current subnet may be calculated, and all calculated IP addresses may be stored in the IPList.
Step S203, traversing each IP address in the IPList, and querying the MAC mapping table.
In this embodiment, each IP address in the IPList may be traversed, and the MAC mapping table is queried based on each IP address.
Step S204, determining whether the MAC mapping table can be queried.
In this embodiment, it may be determined that the MAC mapping table can be queried based on the IP address, and if the MAC mapping table can be queried based on the IP address, it is determined that the device corresponding to the IP address is a switch device, and step S205 is performed, otherwise step S206 is performed.
In step S205, the queried switch device is stored into a switch device set (switchlist), and the queried MAC mapping table is stored into a MAC mapping table set (MACList).
Step S206, storing the non-switch device into a non-switch device set (noswitchlist).
Step S207, the ARP table is searched and stored in ARPList, and the interface table is searched and stored in IfTableList.
In this embodiment, after determining the MAC mapping table set (MACList), the IP address corresponding to the MAC address may be queried in the ARP table based on each MAC address in the MAC mapping table set, and the queried IP address may be stored in the ARPList, or the interface table may be queried, and the interface queried in the interface table may be stored in the interface list (IfTableList).
Step S208, traversing the MAC table, ARPList and interface table, and calculating the end-to-end relationship.
Step S209, generating a network topological relation diagram based on the determined end-to-end relation.
In this embodiment, after determining the end-to-end relationship, the determined end-to-segment relationship may be stored, and the determined end-to-end relationship may be pushed to the server, so that the server draws the network topology connection relationship based on the determined end-to-end relationship.
FIG. 3 is a flow chart of a traversal method according to an embodiment of the invention, as shown in FIG. 3, comprising the steps of:
step S301, traversing the switchlist, and marking the traversed switch device.
In this embodiment, a plurality of switch devices are stored in the switch list, based on which each switch device in the switch list can be traversed in turn, and in order to avoid the situation of missing or repeated traversal, after each traversal of one switch device, the switch device can be marked, traversed again, without traversing the marked switch device.
Step S302, traversing the MACIST.
In this embodiment, after determining the switch device to be traversed, a MACList may be traversed, where a mapping relationship between a MAC address and a device port is stored, based on which a MAC address of the device to be traversed may be searched in the MACList, and then, the number of device ports corresponding to the MAC address may be determined.
Step S303, determining whether the device port and the MAC address are in a one-to-one relationship.
In this embodiment, if there is a one-to-one relationship between the device port and the MAC address, step S304 is performed, and if there is no one-to-one relationship between the device port and the MAC address, step S307 is performed, and the correspondence is stored in the waitplist topology.
Step S304, traversing the IfTableList to determine whether the MAC address is the MAC address of the switch.
In this embodiment, if there is a one-to-one relationship between the device port and the MAC address, the IfTableList may be further traversed to determine if the MAC address is the MAC address of the switch. If the MAC address is the MAC address of the switch, step S305 is performed to store the MAC address in the TPList topology, and if the MAC address is not the MAC address of the switch, step S306 is performed to determine that the device corresponding to the MAC address has marked a connection relationship in the noswitch list.
Step S308, determining whether the switch has more ports to traverse.
In this embodiment, it may be further determined whether the switch device currently being traversed is still to be traversed with a port, if there are more ports to be traversed, then the next port is continued to be traversed, and if not, then step S309 is performed.
Step S309, it is determined whether there are more switch devices to traverse.
In this embodiment, after traversing the switch device, it may be determined in the switch device set whether there are any more switch devices to be traversed, and if so, the next switch device is continuously traversed, that is, the above step S301 is performed.
Step S310, update the fuzzy connection.
In this embodiment, if there is no switch device to be traversed in the set of switch devices, the ambiguous connection may be updated, and the intersection of waitplist and TPList is determined to be waitplist.
Step S311, updates the TPList.
In this embodiment, the TPList may be updated after updating the fuzzy connection, preserving the physical port relationship.
Step S312, update TPList.
In this embodiment, the TPList is updated, and the IP address may be searched in the ARPList for the non-switch physical MAC, and the searched IP address may be stored in the TPList.
Example 3
According to the embodiment of the invention, a device for generating the network topology information is also provided. The generation device of the network topology information may be used to execute the generation method of the network topology information in embodiment 1.
Fig. 4 is a schematic diagram of a network topology information generating apparatus according to an embodiment of the present invention. As shown in fig. 4, the generating apparatus 400 of network topology information may include: an acquisition unit 401, a first determination unit 402, a second determination unit 403.
An obtaining unit 401, configured to obtain attribute information of a device, where the attribute information is used to represent a network attribute of the device;
a first determining unit 402, configured to determine, based on the subnet mask of the device in the attribute information, a network address of each device in the network segment where the device is located;
a second determining unit 403, configured to determine a topological connection relationship between the devices based on the network addresses of the devices.
Optionally, the second determining unit 403 includes: the acquisition module is used for acquiring a media access control address mapping relation table of each device based on the network address of each device, wherein the media access control address mapping relation table comprises the mapping relation between the media access control address and the device port; the generating module is used for generating a media access control address list based on the acquired media access control address mapping relation table; and the determining module is used for determining the topological connection relation among the devices based on the media access control address list.
Optionally, the generating module includes: the first determining submodule is used for determining that the equipment type of the equipment is a switch in response to the acquired media access control address mapping relation table of the equipment; the generating sub-module is used for generating a device set to be traversed based on the device with the device type being the switch, and summarizing the acquired media access control address mapping relation table to obtain a media access control address list.
Optionally, the determining module includes: a second determining submodule, configured to determine a media access control address of a device to be traversed in a device set to be traversed in a media access control address list, where the device to be traversed is a device not traversed in the device set to be traversed; a third determining submodule, configured to determine a mapping relationship between the media access control address and the port of the device to be traversed based on a media access control address mapping relationship table corresponding to the media access control address of the device to be traversed; and the fourth determination submodule is used for determining the topological connection relation of the equipment to be traversed based on the mapping relation.
Optionally, after generating the medium access control address, the apparatus 400 further includes: the first searching unit is used for searching the network address corresponding to each media access control address in the address resolution protocol mapping relation table based on each media access control address in the media access control address list; and the first summarizing unit is used for summarizing the inquired network addresses to obtain a network address list.
Optionally, after obtaining the network address list, the apparatus 400 further includes: the second searching unit is used for searching the equipment interface corresponding to the network address in the interface mapping relation table based on each network address in the network address list, wherein the interface mapping relation table comprises the mapping relation between the network address and the equipment port; and the second summarizing unit is used for summarizing the inquired equipment interfaces to obtain an interface list.
Optionally, the device is further configured to: inquiring a media access control address corresponding to a port of the equipment to be traversed in an interface mapping relation table in response to the fact that the mapping relation between the media access control address of the equipment to be traversed and the port of the equipment to be traversed is a one-to-one relation;
and storing the connection relation between the port of the device to be traversed and the media access control address of the device in response to the media access control address being the media access control address of the device of which the device type is a switch.
In this embodiment, an obtaining unit is configured to obtain attribute information of a device, where the attribute information is used to represent a network attribute of the device; a first determining unit, configured to determine a network address of each device in a network segment where the device is located, based on a subnet mask of the device in the attribute information; and a second determining unit configured to determine a topological connection relationship between the respective devices based on the network addresses of the respective devices. That is, in the embodiment of the present invention, the network address of each device in the network segment where the device is located may be determined based on the subnet mask in the attribute information of the device, and after the network address of each device included in the network segment is determined, the network topology connection relationship of each device in the network segment may be determined based on the network address.
Example 4
According to an embodiment of the present invention, there is also provided a computer-readable storage medium including a stored program, wherein the device in which the computer-readable storage medium is controlled to execute the method for generating network topology information in embodiment 1 when the program runs.
Example 5
According to an embodiment of the present invention, there is also provided a processor for running a program, where the program executes the method for generating network topology information in embodiment 1 when running.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
In the foregoing embodiments of the present invention, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed technology content may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and for example, the division of modules may be a logic function division, and there may be another division manner in actual implementation, for example, multiple modules or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method of the various embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely a preferred embodiment of the present invention and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present invention, which are intended to be comprehended within the scope of the present invention.

Claims (10)

1. A method for generating network topology information, comprising:
acquiring attribute information of equipment, wherein the attribute information is used for representing network attributes of the equipment;
determining the network address of each device in the network segment where the device is located based on the subnet mask of the device in the attribute information;
and determining the topological connection relation among the devices based on the network addresses of the devices.
2. The method of claim 1, wherein the determining the topological connection relationship between the respective devices based on the network addresses of the respective devices comprises:
acquiring a media access control address mapping relation table of each device based on the network address of each device, wherein the media access control address mapping relation table comprises a mapping relation between a media access control address and a device port;
generating a media access control address list based on the acquired media access control address mapping relation table;
and determining the topological connection relation among the devices based on the media access control address list.
3. The method of claim 2, wherein generating a list of medium access control addresses based on the obtained list of medium access control address mappings comprises:
determining the equipment type of equipment as a switch in response to acquiring a media access control address mapping relation table of the equipment;
and generating a device set to be traversed based on the device with the device type being the switch, and summarizing the acquired media access control address mapping relation table to obtain the media access control address list.
4. The method of claim 2, wherein the determining the topological connection relationship between the devices based on the list of media access control addresses comprises:
determining a media access control address of equipment to be traversed in a set of equipment to be traversed in the media access control address list, wherein the equipment to be traversed is equipment which is not traversed in the set of equipment to be traversed;
determining a mapping relation between the media access control address and the port of the equipment to be traversed based on a media access control address mapping relation table corresponding to the media access control address of the equipment to be traversed;
and determining the topological connection relation of the equipment to be traversed based on the mapping relation.
5. The method of claim 1, wherein after generating the list of media access control addresses, the method further comprises:
searching network addresses corresponding to the media access control addresses in an address resolution protocol mapping relation table based on the media access control addresses in the media access control address list;
and summarizing the inquired network addresses to obtain a network address list.
6. The method of claim 5, wherein after obtaining the list of network addresses, the method further comprises:
inquiring a device interface corresponding to the network address in an interface mapping relation table based on each network address in the network address list, wherein the interface mapping relation table comprises mapping relations between the network addresses and device ports;
and summarizing the queried equipment interfaces to obtain the interface list.
7. The method of claim 6, wherein in response to the mapping between the media access control address of the device to be traversed and the port of the device to be traversed being a one-to-one relationship, the method further comprises:
inquiring the media access control address corresponding to the equipment port to be traversed in the interface mapping relation table;
and responding to the media access control address which is the media access control address of the equipment with the equipment type being the switch, and storing the connection relation between the port of the equipment to be traversed and the media access control address of the equipment.
8. A network topology information generation apparatus, comprising:
an obtaining unit, configured to obtain attribute information of a device, where the attribute information is used to represent a network attribute of the device;
a first determining unit, configured to determine a network address of each device in a network segment where the device is located, based on a subnet mask of the device in the attribute information;
and the second determining unit is used for determining the topological connection relation among the devices based on the network addresses of the devices.
9. A computer readable storage medium, characterized in that the computer readable storage medium comprises a stored program, wherein the program, when run by a processor, controls a device in which the storage medium is located to perform the method of any one of claims 1 to 7.
10. A processor for running a program, wherein the program when run performs the method of any one of claims 1 to 7.
CN202310518893.8A 2023-05-09 2023-05-09 Method and device for generating network topology information, storage medium and processor Pending CN116566832A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310518893.8A CN116566832A (en) 2023-05-09 2023-05-09 Method and device for generating network topology information, storage medium and processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310518893.8A CN116566832A (en) 2023-05-09 2023-05-09 Method and device for generating network topology information, storage medium and processor

Publications (1)

Publication Number Publication Date
CN116566832A true CN116566832A (en) 2023-08-08

Family

ID=87499564

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310518893.8A Pending CN116566832A (en) 2023-05-09 2023-05-09 Method and device for generating network topology information, storage medium and processor

Country Status (1)

Country Link
CN (1) CN116566832A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116827801A (en) * 2023-08-25 2023-09-29 武汉吧哒科技股份有限公司 Network topology construction method, device, computer equipment and readable storage medium
CN117895657A (en) * 2024-03-13 2024-04-16 国网山东省电力公司诸城市供电公司 Automatic debugging device and method for safe and intelligent power system

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116827801A (en) * 2023-08-25 2023-09-29 武汉吧哒科技股份有限公司 Network topology construction method, device, computer equipment and readable storage medium
CN116827801B (en) * 2023-08-25 2023-12-15 武汉吧哒科技股份有限公司 Network topology construction method, device, computer equipment and readable storage medium
CN117895657A (en) * 2024-03-13 2024-04-16 国网山东省电力公司诸城市供电公司 Automatic debugging device and method for safe and intelligent power system

Similar Documents

Publication Publication Date Title
CN116566832A (en) Method and device for generating network topology information, storage medium and processor
EP3311544B1 (en) Managing dynamic ip address assignments
JP4647234B2 (en) Method and apparatus for discovering network devices
CN110635971A (en) Industrial control asset detection and management method and device and electronic equipment
EP3117571B1 (en) Executing loops
CN110061921B (en) Cloud platform data packet distribution method and system
CN102325163B (en) Routing updating method, device and relevant equipment
CN111245662B (en) Method and device for displaying network topology
US20230041395A1 (en) Method and Device for Processing Routing Table Entries
CN111935334B (en) Method, system, server and readable storage medium for intelligently allocating network addresses
CN115334146A (en) Resource publishing method, device, equipment and storage medium of Internet of things
CN111553669B (en) Transaction routing method, device and computer readable storage medium
JP2016503267A (en) Method and processing device for handling network protocol addresses
CN110730093B (en) Metropolitan area network topology mapping method and device
CN111352938A (en) Data processing method, computer device and storage medium
CN113098776A (en) Method, device, equipment and storage medium for determining network topology
CN114244763B (en) Dynamic network topology management method and system based on rule engine
CN113452763B (en) Smart home business registration method and device and smart home system
CN115065735A (en) Message processing method and electronic equipment
CN109088767B (en) Route updating method and device
CN108712316B (en) Access configuration method, device and system of virtual machine
CN112468400A (en) Fault positioning method, device, equipment and medium
CN111147618B (en) Communication method, communication device, electronic equipment and storage medium
CN113923188B (en) Stateless flexible mapping algorithm for IPv6/IPv4 access
JP6155954B2 (en) Information processing apparatus and method for generating network configuration information thereof

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