CN113452561A - Topology generation method, device and equipment and readable storage medium - Google Patents

Topology generation method, device and equipment and readable storage medium Download PDF

Info

Publication number
CN113452561A
CN113452561A CN202110712154.3A CN202110712154A CN113452561A CN 113452561 A CN113452561 A CN 113452561A CN 202110712154 A CN202110712154 A CN 202110712154A CN 113452561 A CN113452561 A CN 113452561A
Authority
CN
China
Prior art keywords
network
information
router
switch
determining
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.)
Granted
Application number
CN202110712154.3A
Other languages
Chinese (zh)
Other versions
CN113452561B (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.)
Sangfor Technologies Co Ltd
Original Assignee
Sangfor Technologies 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 Sangfor Technologies Co Ltd filed Critical Sangfor Technologies Co Ltd
Priority to CN202110712154.3A priority Critical patent/CN113452561B/en
Publication of CN113452561A publication Critical patent/CN113452561A/en
Application granted granted Critical
Publication of CN113452561B publication Critical patent/CN113452561B/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
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/02Topology update or discovery
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/2866Architectures; Arrangements
    • H04L67/30Profiles

Abstract

The application discloses a topology generation method, a topology generation device, topology generation equipment and a readable storage medium. The method comprises the steps of determining a network corresponding to a mark to be scanned as the network to be scanned, then obtaining a network configuration file of the network to be scanned, classifying equipment information in the network configuration file into router information and switch information according to a preset class label, determining a connection relation between each piece of equipment in a target network based on the router information and the switch information to generate a network topological graph, and deleting the mark to be scanned to show that the network topological graph is generated for the current network. The scheme can timely discover the network topology of the network needing to generate the topological graph on the premise of not influencing the normal operation of the network. The topology generation device, the topology generation equipment and the readable storage medium have the technical effects.

Description

Topology generation method, device and equipment and readable storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a topology generation method, an apparatus, a device, and a readable storage medium.
Background
At present, network topology discovery can be generally performed by a method of sending a test packet, which increases traffic in a network and affects services originally assumed by the network. Meanwhile, the change of the devices in the network is not easy to be perceived, so that the topological graphs of which networks need to be updated cannot be known in time, and which networks do not have corresponding topological graphs. Therefore, on the premise of not affecting the normal operation of the network, how to timely discover the network topology of the network needing to generate the topological graph is a problem to be solved by technical personnel in the field.
Disclosure of Invention
In view of the above, an object of the present application is to provide a topology generation method, apparatus, device and readable storage medium, so as to discover a network topology of a network that needs to generate a topology map in time without affecting normal operation of the network. The specific scheme is as follows:
in a first aspect, the present application provides a topology generation method, including:
if the target network corresponds to the mark to be scanned, determining the target network as the network to be scanned;
acquiring a network configuration file of the network to be scanned;
classifying the equipment information in the network configuration file into router information and switch information according to a preset class label;
and determining the connection relation between each device in the target network based on the router information and the switch information to generate a network topological graph, and deleting the mark to be scanned.
Preferably, after the obtaining the network configuration file of the network to be scanned, the method further includes:
acquiring a scanning mode of the network to be scanned:
if the scanning mode is timing scanning, under the condition that the timing scanning time is reached, executing the classification of the equipment information in the network configuration file into router information and switch information according to a preset class label; and determining the connection relation between each device in the target network based on the router information and the switch information to generate a network topological graph, and deleting the mark to be scanned.
Preferably, the method further comprises the following steps:
if the scanning mode is real-time scanning, under the condition that a real-time scanning function is started and no topology file exists currently, executing the classification of the equipment information in the network configuration file into router information and switch information according to a preset class label; and determining the connection relation between each device in the target network based on the router information and the switch information to generate a network topological graph, and deleting the mark to be scanned.
Preferably, the determining a connection relationship between devices in the target network based on the router information and the switch information to generate a network topology map includes:
determining a subnet of each router, a connection relationship between different routers, a connection relationship between different switches, and a connection relationship between each switch and a host device based on the router information and the switch information to generate the network topology map.
Preferably, the determining a subnet of each router, a connection relationship between different routers, a connection relationship between different switches, and a connection relationship between each switch and a host device based on the router information and the switch information to generate the network topology map includes:
determining a subnet of each router and a connection relation between different routers based on the router information;
determining a connection relationship between different switches and a connection relationship between each switch and a host device based on the switch information and the subnet of each router;
and writing all the determined connection relations into a topology file, and generating the network topology map according to the topology file.
Preferably, the determining the connection relationship between the subnet of each router and different routers based on the router information includes:
determining a plurality of routers based on the router information;
for any router, if the type of the next hop recorded in the routing table of the router is the routing type and the IP address of the next hop is within the address range covered by the router, determining that the router is directly connected to another router; otherwise, determining the router directly connected to the subnet.
Preferably, the determining the connection relationship between different switches and the connection relationship between each switch and the host device based on the switch information and the subnet of each router includes:
determining a plurality of switches based on the switch information, and dividing each switch into corresponding subnets;
for any switch in any subnet, if the port mapping table of the switch records the address information of the host equipment, recording the connection relationship between the switch and the host equipment; if the forwarding table of the switch records the address information of other switches in the current subnet, the connection relationship between the switch and the other switches is recorded.
Preferably, the method further comprises the following steps:
and monitoring the state of each device in the network topological graph in real time by using the snmptrap.
Preferably, the method further comprises the following steps:
acquiring the update information of a user to the target network based on a human-computer interaction interface;
and updating the network configuration file according to the updating information and generating the mark to be scanned.
In a second aspect, the present application provides a topology generating apparatus, including:
the detection module is used for determining the target network as the network to be scanned if the target network corresponds to the mark to be scanned;
the acquisition module is used for acquiring the network configuration file of the network to be scanned;
the classification module is used for classifying the equipment information in the network configuration file into router information and switch information according to a preset class label;
and the topology generation module is used for determining the connection relationship among the devices in the target network based on the router information and the switch information so as to generate a network topology map and delete the mark to be scanned.
In a third aspect, the present application provides an electronic device, comprising:
a memory for storing a computer program;
a processor for executing the computer program to implement the topology generation method disclosed in the foregoing.
In a fourth aspect, the present application provides a readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the topology generation method disclosed in the foregoing.
According to the scheme, the application provides a topology generation method, which comprises the following steps: if the target network corresponds to the mark to be scanned, determining the target network as the network to be scanned; acquiring a network configuration file of the network to be scanned; classifying the equipment information in the network configuration file into router information and switch information according to a preset class label; and determining a subnet of each router, a connection relationship between different routers, a connection relationship between different switches and a connection relationship between each switch and the host equipment based on the router information and the switch information to generate a network topology map, and deleting the mark to be scanned.
Therefore, the method includes the steps that the device is marked with an updated or unscanned network to be scanned by the mark to be scanned, when a certain network is determined to correspond to the mark to be scanned, the network is determined to be the network to be scanned, then a network configuration file of the network to be scanned is obtained, and device information in the network configuration file is classified into router information and switch information according to the preset class label; and finally, determining the connection relation among all devices in the target network based on the router information and the switch information to generate a network topology map, and deleting the mark to be scanned to show that the corresponding network topology map is generated for the current network. Therefore, which networks need to generate the topological graph can be automatically discovered, and the automatic generation of the network topological graph is realized. According to the method and the device, the connection relation between the devices can be directly determined based on the router information and the switch information, the devices do not need to send test packets to each other, flow in the network cannot be increased, the network topology discovery can be timely carried out on the network needing to generate the topological graph on the premise that normal operation of the network is not affected, and efficiency is improved.
Accordingly, the topology generation device, the topology generation equipment and the readable storage medium provided by the application also have the technical effects.
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 topology generation method disclosed herein;
FIG. 2 is a flow chart of another topology generation method disclosed herein;
fig. 3 is a flowchart of discovering a direct connection relationship between a subnet of a router and different routers, according to the present disclosure;
fig. 4 is a flowchart illustrating a method for discovering a direct connection between a switch and a host device according to the present disclosure;
fig. 5 is a flowchart illustrating a method for discovering a direct connection between a switch and a switch according to the present disclosure;
FIG. 6 is a schematic diagram illustrating a method for determining a network topology according to the present disclosure;
FIG. 7 is a schematic diagram of a topology generation apparatus disclosed herein;
FIG. 8 is a schematic diagram of an electronic device disclosed herein;
fig. 9 is a schematic view of another electronic device 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, network topology discovery can be generally performed by a method of sending a test packet, which increases traffic in a network and affects services originally assumed by the network. Meanwhile, the change of the devices in the network is not easy to be perceived, so that the topological graphs of which networks need to be updated cannot be known in time, and which networks do not have corresponding topological graphs. Therefore, the topology generation scheme is provided, and the network topology discovery can be timely carried out on the network needing to generate the topology map on the premise of not influencing the normal operation of the network.
Referring to fig. 1, an embodiment of the present application discloses a topology generation method, including:
s101, if the target network corresponds to the to-be-scanned mark, determining the target network as the to-be-scanned network.
The present embodiment marks the network to be scanned with the logo to be scanned. The mark to be scanned may be recorded by a file or a variable, and may specifically be "1", "T", or the like.
S102, obtaining a network configuration file of the network to be scanned.
The network configuration file records relevant information of all routers and switches in the current network, such as: IP addresses, names of routers and switches, etc. The information is defined by the user based on the man-machine interaction interface, so that the user can change the information based on the man-machine interaction interface and can delete or add some information. Such as: when the network is deleted or newly added with equipment, corresponding information is deleted or newly added based on the human-computer interaction interface.
S103, classifying the equipment information in the network configuration file into router information and switch information according to the preset class label.
When the device information is deleted or added based on the human-computer interaction interface, different category labels (for example, the category label of the router information is uniformly marked as a, and the category label of the switch information is uniformly marked as B) can be preset for the router information and the switch information, so that all the device information can be classified into the router information and the switch information according to the category labels. After classification, the connection relation among all the devices in the target network can be conveniently found. Each device in the target network includes: routers, switches, host devices, etc., so the connection relationship among the devices includes: the sub-network to which the router is connected, the connection relationship between different routers, the connection relationship between different switches, and the connection relationship between each switch and the host device, and the like.
S104, determining the connection relation among the devices in the target network based on the router information and the switch information to generate a network topological graph, and deleting the mark to be scanned. .
It should be noted that step S104 may be implemented by using snmp (simple Network Management protocol). SNMP is a standard protocol for managing network nodes (servers, workstations, routers, switches, HUBS, etc.) and is an application layer protocol. SNMP enables a network administrator to manage network performance, discover and solve network problems, and plan network growth. The SNMP can also receive random messages (and event reports) and timely acquire network problems.
A network topology can specify the physical or logical arrangement between the members that make up the network. If the connection structure of two networks is the same, we say that their network topologies are the same, although their respective internal physical connections, inter-node distances, may be different.
In this embodiment, a to-be-scanned network with an updated or not-scanned device is marked by a to-be-scanned mark, and when it is determined that a certain network corresponds to the to-be-scanned mark, the network is determined as the to-be-scanned network, then a network configuration file of the to-be-scanned network is obtained, and device information in the network configuration file is classified into router information and switch information according to a preset class label; and finally, determining the subnet of each router, the connection relationship among different routers, the connection relationship among different switches and the connection relationship between each switch and the host equipment based on the router information and the switch information so as to generate a network topology map, and deleting the mark to be scanned to show that a corresponding network topology map is generated for the current network.
Therefore, according to the mark to be scanned in the embodiment, which networks need to generate the topological graph can be automatically discovered, so that the automatic generation of the network topological graph is realized. In this embodiment, the connection relationship between the devices can be directly determined based on the router information and the switch information, and the devices do not need to send test packets to each other, so that the traffic in the network is not increased, the network topology discovery for the network requiring the generation of the topology map can be performed in time on the premise of not affecting the normal operation of the network, and the efficiency is also improved.
Based on the above embodiments, it should be noted that, a scanning mode (timing scanning or real-time scanning) may be set in advance for each network, and therefore, the method further includes:
acquiring a scanning mode of a network to be scanned:
if the scanning mode is timing scanning, classifying the equipment information in the network configuration file into router information and switch information according to a preset class label under the condition that the timing scanning time is reached; and determining the connection relation among all devices in the target network based on the router information and the switch information to generate a network topology map, and deleting the mark to be scanned.
In a specific embodiment, the method further comprises the following steps:
if the scanning mode is real-time scanning, under the condition that the real-time scanning function is started and no topology file exists currently, classifying equipment information in the network configuration file into router information and switch information according to a preset class label; and determining the connection relation among all devices in the target network based on the router information and the switch information to generate a network topology map, and deleting the mark to be scanned.
It should be noted that the acquisition and the determination of the scanning mode may be performed after "acquiring the network configuration file of the network to be scanned", or may be performed before "acquiring the network configuration file of the network to be scanned", and the change of the execution sequence does not affect the implementation of the present invention.
Please refer to fig. 2. In fig. 2, snmp _ device.json is a network profile, scan _ time is a timing scanning time (for example, half an hour is a scanning unit), and if it is empty, it indicates that the timing scanning is not currently set; otherwise, the timing scan is currently set. If the timing scanning is set currently, judging whether the set scanning time is reached currently, if so, classifying the switch and the router, and executing the subsequent steps; otherwise, the flow ends. If the timing scanning is not set currently, further judging whether scan _ enable is True or not and whether change _ enable is existed or not (namely judging whether real-time scanning is set or not); if yes, classifying the switch and the router under the condition of starting real-time scanning and determining that no topology file exists (so as to avoid repeated scanning), and executing subsequent steps; otherwise, the flow ends. Wherein, the mark file is the mark to be scanned in the above.
Wherein, it can also use special scanning device to scan each area in the network, such as: each subnet corresponds to a scanning device. At this time, it should be noted that the IP address of the scanning device may not be the same as the IP address of the router interconnected in the subnet scanned by the scanning device, otherwise, a network topology drawing error may be caused.
As can be seen from the above embodiments, generating the network topology requires explicit specification of the subnet of each router, the connection relationship between different routers, the connection relationship between different switches, and the connection relationship between each switch and the host device, so the connection relationship related to the router and the connection relationship related to the switch can be determined separately. Therefore, in a specific embodiment, determining connection relationships between devices in a target network based on router information and switch information to generate a network topology map includes: the subnet of each router, the connection relationship between different routers, the connection relationship between different switches, and the connection relationship between each switch and the host device are determined based on the router information and the switch information to generate a network topology map.
Determining a subnet of each router, a connection relationship between different routers, a connection relationship between different switches, and a connection relationship between each switch and a host device based on the router information and the switch information to generate a network topology map, comprising: determining a subnet of each router and a connection relation between different routers based on the router information; determining a connection relationship between different switches and a connection relationship between each switch and the host device based on the switch information and the subnet of each router; and writing all the determined connection relations into a topology file, and generating a network topology map according to the topology file.
Wherein, the connection relation related to the router can be determined according to the following steps, therefore, in a specific embodiment, determining the connection relation between the subnet of each router and different routers based on the router information includes: determining a plurality of routers based on the router information; for any router, if the type of the next hop recorded in the routing table of the router is the routing type (namely 4) and the IP address of the next hop is within the address range covered by the router, determining that the router is directly connected with another router; otherwise, determining the router directly connected to the subnet.
It should be noted that, the routing table of each router records: iprouteDest, iprouteIfIndex, iprouteNoxtHop and iprouteType. Wherein, the ipRouteDest records the destination address range which can be reached by taking the router as a starting point; recording an interface index number corresponding to the iprouteldest by the iproutelflndx; the iRouteNoxtHop records the router address of the next hop corresponding to the router or the gateway address of the direct connection subnet; the method comprises the following steps that an iRouteType records the connection relation between an address represented by the iRouteNextHop and a router, and when the iRouteType is 4, the iRouteType and the router are directly connected; when it is 3, it indicates that the corresponding interface is connected to a subnet; a port can be discovered through the iproutelfindex of the routing table. Therefore, traversing the routing table of each router, the subnet of each router and the direct connection relationship between the current router and other routers can be known. The flow shown in fig. 3 can be designed according to the routing table to discover the connection relationship between the subnets of each router and different routers.
Wherein the connection relationship associated with the switch may be determined according to the following steps, and therefore in one embodiment, determining the connection relationship between different switches and the connection relationship between each switch and the host device based on the switch information and the subnet of each router includes: determining a plurality of switches based on the switch information, and dividing each switch into corresponding subnets; for any switch in any subnet, if the port mapping table of the switch records the address information (MAC address or IP address) of the host device, the connection relationship between the switch and the host device is recorded; if the address information of other switches in the current subnet is recorded in the forwarding table of the switch, the connection relationship between the switch and other switches is recorded.
The connection relationship between the switch and the host device can be discovered with reference to fig. 4. In FIG. 4, the ports of connect _ msg [ ip ] are used to connect switches. As in fig. 4, the node where the host device is located may be named with its MAC address or IP address. The connection relationship between the switches can be discovered with reference to fig. 5. SWA in fig. 5 denotes a certain switch in a certain subnet, and SWB is another switch in the subnet.
Based on the above embodiments, it should be noted that the snmptrap can be used to listen to the status of each device in the network topology in real time. Such as: whether the address of the device is changed, whether the device is added or deleted.
Of course, the state change may be implemented by the user based on the human-computer interaction interface, such as modifying the address of the device in the target network, adding a device, deleting a device, and the like, based on the human-computer interaction interface. Therefore, in one embodiment, the method further comprises: acquiring update information of a user to a target network based on a human-computer interaction interface; and updating the network configuration file according to the updating information and generating a mark to be scanned so as to find the network needing scanning in time. Wherein, the update information is: and the user modifies the address of the equipment, the related information of the newly added equipment, the related information of the deleted equipment and the like based on the man-machine interaction interface.
A specific scheme for determining a network topology is described below, and the scheme provided by this embodiment includes: the device comprises a network topology identification module and a device monitoring module.
The network topology identification module mainly uses SNMP to obtain a forwarding table, a routing table and a port mapping table, and then assembles the forwarding table, the routing table and the port mapping table through an algorithm to obtain a process of actual network topology in a network. Which comprises the following steps: the method comprises the steps of router relation identification, switch and host relation identification and switch relation identification.
Specifically, the router relationship identification is: the relationship between routers is identified by retrieving a routing table. And filtering out data with the routing types of direct routing and indirect routing.
The switch and host relationship identification is as follows: and acquiring a port mapping table of the switch through the SNMP to identify the relationship between the switch and the host, filtering the port where the switch is located, and obtaining the rest ports as the connection ports of the switch and the host.
Switch-to-switch relationship identification: the sub-networks separated by the route identification are grouped into switches, and the following steps can be determined according to the forwarding table of each switch after grouping: the data information of the opposite party exists in the forwarding tables of different switches with the communication relation. The communication relationship between the switches can be obtained through the principle.
The connection relation of the router of each subnet is obtained through the routing table among the routers, the network equipment under each subnet is divided through the identification of the router, the connection relation of the switch and the switch is obtained through the forwarding table, and finally the position of the host on the switch or the router is obtained through adding the port mapping table on the switch, so that the network topology structure chart is obtained.
The device monitoring module monitors the dynamics of connected devices on the network device through the snmptrap. If the device is offline, newly accessed or the device is counterfeited, the detailed dynamic change of the device can be monitored through the snmp trap, and then the system updates the network topology structure diagram and carries out alarm prompting by assembling and comparing the original network topology data.
As can be seen, in the embodiment, by scanning the network topology of the area where the network device is located, the device connection condition is automatically analyzed according to the scanning result, the network topology formed by the three-layer switch, the router and the like is calculated, and the scanned area topology is summarized to the foreground page for display. And meanwhile, dynamically monitoring the network equipment, and generating alarm information if the network equipment changes.
The scheme can display the network topology structure chart in time, can help users to know the deployment condition of the equipment in the network, and avoids the blindness of equipment deployment. And the state and the safety of the equipment in the network can be known in real time, and each equipment can be effectively controlled.
In the following, a topology generating apparatus provided in an embodiment of the present application is introduced, and a topology generating apparatus described below and a topology generating method described above may be referred to each other.
Referring to fig. 7, an embodiment of the present application discloses a topology generating apparatus, which is characterized by including:
a detection module 701, configured to determine a target network as a to-be-scanned network if the target network corresponds to the to-be-scanned mark;
an obtaining module 702, configured to obtain a network configuration file of a network to be scanned;
a classification module 703, configured to classify the device information in the network configuration file into router information and switch information according to a preset class label;
and a topology generating module 704, configured to determine a connection relationship between each device in the target network based on the router information and the switch information, so as to generate a network topology map, and delete the to-be-scanned flag.
In a specific embodiment, the method further comprises the following steps:
a scanning mode obtaining module, configured to obtain a scanning mode of a network to be scanned:
and the timing scanning module is used for executing the steps in the classification module and the topology generation module when the timing scanning time is reached if the scanning mode is timing scanning.
In a specific embodiment, the method further comprises the following steps:
and the real-time scanning module is used for executing the steps in the classification module and the topology generation module under the condition that the real-time scanning function is started and no topology file exists currently if the scanning mode is real-time scanning.
In a specific embodiment, the topology generation module is specifically configured to:
the subnet of each router, the connection relationship between different routers, the connection relationship between different switches, and the connection relationship between each switch and the host device are determined based on the router information and the switch information to generate a network topology map.
In one embodiment, the topology generation module includes:
a router relation determining unit, configured to determine, based on the router information, a connection relation between a subnet of each router and different routers;
a switch relationship determination unit for determining a connection relationship between different switches and a connection relationship between each switch and the host device based on the switch information and the subnet of each router;
and the generating unit is used for writing all the determined connection relations into the topology file and generating a network topology map according to the topology file.
In a specific embodiment, the router relation determining unit is specifically configured to:
determining a plurality of routers based on the router information;
for any router, if the type of the next hop recorded in the routing table of the router is the routing type and the IP address of the next hop is within the address range covered by the router, determining that the router is directly connected to another router; otherwise, determining the router directly connected to the subnet.
In an embodiment, the switch relationship determining unit is specifically configured to:
determining a plurality of switches based on the switch information, and dividing each switch into corresponding subnets;
for any switch in any subnet, if the port mapping table of the switch records the address information of the host device, recording the connection relationship between the switch and the host device; if the address information of other switches in the current subnet is recorded in the forwarding table of the switch, the connection relationship between the switch and other switches is recorded.
In a specific embodiment, the method further comprises the following steps:
and the monitoring module is used for monitoring the state of each device in the network topological graph in real time by utilizing the snmptrap.
In a specific embodiment, the method further comprises the following steps:
the updating module is used for acquiring the updating information of the user to the target network based on the human-computer interaction interface; and updating the network configuration file according to the updating information and generating a mark to be scanned.
For more specific working processes of each module and unit in this embodiment, reference may be made to corresponding contents disclosed in the foregoing embodiments, and details are not described here again.
Therefore, the embodiment provides a topology generation device, which can timely discover the network topology of the network needing to generate the topology map on the premise of not influencing the normal operation of the network.
In the following, an electronic device provided by an embodiment of the present application is introduced, and an electronic device described below and a topology generation method and apparatus described above may be referred to each other.
Referring to fig. 8, an embodiment of the present application discloses an electronic device, including:
a memory 801 for storing a computer program;
a processor 802 for executing the computer program to implement the method disclosed by any of the above embodiments.
Referring to fig. 9, fig. 9 is a schematic diagram of another electronic device provided in this embodiment, which may have a larger difference due to different configurations or performances, and may include one or more processors (CPUs) 322 (e.g., one or more processors) and a memory 332, and one or more storage media 330 (e.g., one or more mass storage devices) storing an application 342 or data 344. Memory 332 and storage media 330 may be, among other things, transient storage or persistent storage. The program stored on the storage medium 330 may include one or more modules (not shown), each of which may include a series of instructions operating on a data processing device. Still further, the central processor 322 may be configured to communicate with the storage medium 330 to execute a series of instruction operations in the storage medium 330 on the electronic device 301.
The electronic device 301 may also include one or more power sources 326, one or more wired or wireless network interfaces 350, one or more input-output interfaces 358, and/or one or more operating systems 341. Such as Windows Server, MacOSXTM, UnixTM, LinuxTM, FreeBSDTM, etc.
In fig. 9, the application 342 may be a program that performs the topology generation method, and the data 344 may be data required for or generated by performing the topology generation method.
The steps in the topology generation method described above may be implemented by the structure of an electronic device.
In the following, a readable storage medium provided by an embodiment of the present application is introduced, and a readable storage medium described below and a topology generation method, apparatus, and device described above may be referred to each other.
A readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the topology generation method disclosed in the foregoing embodiments. For the specific steps of the method, reference may be made to the corresponding contents disclosed in the foregoing embodiments, which are not described herein again.
References in this application to "first," "second," "third," "fourth," etc., if any, are intended to distinguish between similar elements and not necessarily to describe a particular order or sequence. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprises" and "comprising," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, 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, or apparatus.
It should be noted that the descriptions in this application referring to "first", "second", etc. are for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In addition, technical solutions between various embodiments may be combined with each other, but must be realized by a person skilled in the art, and when the technical solutions are contradictory or cannot be realized, such a combination should not be considered to exist, and is not within the protection scope of the present application.
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 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 readable storage medium known in the art.
The principle and the implementation of the present application are explained herein by applying specific examples, and the above description of the embodiments is only used to help understand the method and the core idea of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

1. A topology generation method, comprising:
if the target network corresponds to the mark to be scanned, determining the target network as the network to be scanned;
acquiring a network configuration file of the network to be scanned;
classifying the equipment information in the network configuration file into router information and switch information according to a preset class label;
and determining the connection relation between each device in the target network based on the router information and the switch information to generate a network topological graph, and deleting the mark to be scanned.
2. The method of claim 1, further comprising:
acquiring a scanning mode of the network to be scanned:
if the scanning mode is timing scanning, under the condition that the timing scanning time is reached, executing the classification of the equipment information in the network configuration file into router information and switch information according to a preset class label; determining the connection relation between each device in the target network based on the router information and the switch information to generate a network topological graph, and deleting the mark to be scanned;
if the scanning mode is real-time scanning, under the condition that a real-time scanning function is started and no topology file exists currently, executing the classification of the equipment information in the network configuration file into router information and switch information according to a preset class label; and determining the connection relation between each device in the target network based on the router information and the switch information to generate a network topological graph, and deleting the mark to be scanned.
3. The method of claim 1, wherein the determining the connection relationship between the devices in the target network based on the router information and the switch information to generate a network topology map comprises:
determining a subnet of each router, a connection relationship between different routers, a connection relationship between different switches, and a connection relationship between each switch and a host device based on the router information and the switch information to generate the network topology map.
4. The method of claim 3, wherein determining the subnet of each router, the connection relationship between different routers, the connection relationship between different switches, and the connection relationship between each switch and a host device based on the router information and the switch information to generate the network topology map comprises:
determining a subnet of each router and a connection relation between different routers based on the router information;
determining a connection relationship between different switches and a connection relationship between each switch and a host device based on the switch information and the subnet of each router;
and writing all the determined connection relations into a topology file, and generating the network topology map according to the topology file.
5. The method of claim 4, wherein the determining the connection relationship between the subnet and the different routers of each router based on the router information comprises:
determining a plurality of routers based on the router information;
for any router, if the type of the next hop recorded in the routing table of the router is the routing type and the IP address of the next hop is within the address range covered by the router, determining that the router is directly connected to another router; otherwise, determining the router directly connected to the subnet.
6. The method of claim 4, wherein determining the connection relationship between different switches and the connection relationship between each switch and the host device based on the switch information and the subnet of each router comprises:
determining a plurality of switches based on the switch information, and dividing each switch into corresponding subnets;
for any switch in any subnet, if the port mapping table of the switch records the address information of the host equipment, recording the connection relationship between the switch and the host equipment; if the forwarding table of the switch records the address information of other switches in the current subnet, the connection relationship between the switch and the other switches is recorded.
7. The method of any of claims 1 to 6, further comprising:
acquiring the update information of a user to the target network based on a human-computer interaction interface;
and updating the network configuration file according to the updating information and generating the mark to be scanned.
8. A topology generation apparatus, comprising:
the detection module is used for determining the target network as the network to be scanned if the target network corresponds to the mark to be scanned;
the acquisition module is used for acquiring the network configuration file of the network to be scanned;
the classification module is used for classifying the equipment information in the network configuration file into router information and switch information according to a preset class label;
and the topology generation module is used for determining the connection relationship among the devices in the target network based on the router information and the switch information so as to generate a network topology map and delete the mark to be scanned.
9. An electronic device, comprising:
a memory for storing a computer program;
a processor for executing the computer program to implement the method of any one of claims 1 to 7.
10. A readable storage medium for storing a computer program, wherein the computer program when executed by a processor implements the method of any one of claims 1 to 7.
CN202110712154.3A 2021-06-25 2021-06-25 Topology generation method, device, equipment and readable storage medium Active CN113452561B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110712154.3A CN113452561B (en) 2021-06-25 2021-06-25 Topology generation method, device, equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110712154.3A CN113452561B (en) 2021-06-25 2021-06-25 Topology generation method, device, equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN113452561A true CN113452561A (en) 2021-09-28
CN113452561B CN113452561B (en) 2023-05-16

Family

ID=77812868

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110712154.3A Active CN113452561B (en) 2021-06-25 2021-06-25 Topology generation method, device, equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN113452561B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114285718A (en) * 2021-12-28 2022-04-05 北京航天数据股份有限公司 Topology generation method and device, electronic equipment and storage medium
CN114338410A (en) * 2021-12-09 2022-04-12 海光信息技术股份有限公司 Method, device and system for generating routing path file and related equipment
CN114430364A (en) * 2022-01-21 2022-05-03 京东科技信息技术有限公司 Information display method and device, electronic equipment and computer readable medium
CN114520770A (en) * 2022-02-16 2022-05-20 浪潮思科网络科技有限公司 Topological graph generation method, device, equipment and medium for network equipment
CN114615066A (en) * 2022-03-17 2022-06-10 浙江网商银行股份有限公司 Target path determination method and device
CN114915561A (en) * 2022-04-19 2022-08-16 北京宝兰德软件股份有限公司 Network topological graph generation method and device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070201385A1 (en) * 2006-02-24 2007-08-30 Fujitsu Limited Apparatus, method, and computer product for topology-information collection
CN105227383A (en) * 2015-11-06 2016-01-06 广东电网有限责任公司电力科学研究院 A kind of device of network topology investigation
CN105450442A (en) * 2015-11-06 2016-03-30 广东电网有限责任公司电力科学研究院 Network topology checking method and system thereof
US20180139104A1 (en) * 2016-11-12 2018-05-17 Solana Networks Inc. Method and System for Discovery and Mapping of a Network Topology
CN108055207A (en) * 2017-10-26 2018-05-18 北京天元创新科技有限公司 A kind of network topology cognitive method and device
CN111934921A (en) * 2020-07-29 2020-11-13 深信服科技股份有限公司 Network topology discovery method and device, equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070201385A1 (en) * 2006-02-24 2007-08-30 Fujitsu Limited Apparatus, method, and computer product for topology-information collection
CN105227383A (en) * 2015-11-06 2016-01-06 广东电网有限责任公司电力科学研究院 A kind of device of network topology investigation
CN105450442A (en) * 2015-11-06 2016-03-30 广东电网有限责任公司电力科学研究院 Network topology checking method and system thereof
US20180139104A1 (en) * 2016-11-12 2018-05-17 Solana Networks Inc. Method and System for Discovery and Mapping of a Network Topology
CN108055207A (en) * 2017-10-26 2018-05-18 北京天元创新科技有限公司 A kind of network topology cognitive method and device
CN111934921A (en) * 2020-07-29 2020-11-13 深信服科技股份有限公司 Network topology discovery method and device, equipment and storage medium

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114338410A (en) * 2021-12-09 2022-04-12 海光信息技术股份有限公司 Method, device and system for generating routing path file and related equipment
CN114285718A (en) * 2021-12-28 2022-04-05 北京航天数据股份有限公司 Topology generation method and device, electronic equipment and storage medium
CN114285718B (en) * 2021-12-28 2024-02-09 北京航天数据股份有限公司 Topology generation method and device, electronic equipment and storage medium
CN114430364A (en) * 2022-01-21 2022-05-03 京东科技信息技术有限公司 Information display method and device, electronic equipment and computer readable medium
CN114520770A (en) * 2022-02-16 2022-05-20 浪潮思科网络科技有限公司 Topological graph generation method, device, equipment and medium for network equipment
CN114615066A (en) * 2022-03-17 2022-06-10 浙江网商银行股份有限公司 Target path determination method and device
CN114915561A (en) * 2022-04-19 2022-08-16 北京宝兰德软件股份有限公司 Network topological graph generation method and device
CN114915561B (en) * 2022-04-19 2024-02-20 北京宝兰德软件股份有限公司 Network topology graph generation method and device

Also Published As

Publication number Publication date
CN113452561B (en) 2023-05-16

Similar Documents

Publication Publication Date Title
CN113452561B (en) Topology generation method, device, equipment and readable storage medium
US6377987B1 (en) Mechanism for determining actual physical topology of network based on gathered configuration information representing true neighboring devices
US9391886B2 (en) Identification of the paths taken through a network of interconnected devices
US20140211805A1 (en) Network multi-path discovery
US9544217B2 (en) Identification of paths in a network of mixed routing/switching devices
US20050105475A1 (en) Method for providing topology awareness information within an ip network
EP2451125B1 (en) Method and system for realizing network topology discovery
US9559909B2 (en) Identifying an egress port of a device
US9531598B2 (en) Querying a traffic forwarding table
EP2316192A1 (en) Incremental and targeted auto-discovery of network devices
JP7416919B2 (en) Data processing methods and devices and computer storage media
US8914503B2 (en) Detected IP link and connectivity inference
CN111786857B (en) Network asset active detection method and system based on distribution
CN112953774B (en) Network topology generation method, system, equipment and computer storage medium
CN107465621B (en) Router discovery method, SDN controller, router and network system
CN116545861A (en) Network topology graph generation method, device and equipment
CN116827801B (en) Network topology construction method, device, computer equipment and readable storage medium
CN112866116B (en) Network access detection method, device, equipment and storage medium
US7733800B2 (en) Method and mechanism for identifying an unmanaged switch in a network
CN107040423B (en) Method and system for discovering network topology
CN107666444B (en) Method and system for routing data flow
CN113300880B (en) Ethernet switch topology generation and drawing method based on Tarjan algorithm
CN117176639B (en) Multi-protocol-based network topology automatic discovery method and device
CN102075364A (en) Method and equipment for determining direct link
Peng et al. Analysis and research of network topology discovery method

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