CN107947994B - Network topology self-discovery method and device, network equipment and computer storage medium - Google Patents

Network topology self-discovery method and device, network equipment and computer storage medium Download PDF

Info

Publication number
CN107947994B
CN107947994B CN201711309405.3A CN201711309405A CN107947994B CN 107947994 B CN107947994 B CN 107947994B CN 201711309405 A CN201711309405 A CN 201711309405A CN 107947994 B CN107947994 B CN 107947994B
Authority
CN
China
Prior art keywords
network
network node
node
network nodes
nodes
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201711309405.3A
Other languages
Chinese (zh)
Other versions
CN107947994A (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.)
Hitachi Building Technology Guangzhou Co Ltd
Original Assignee
Hitachi Building Technology Guangzhou 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 Hitachi Building Technology Guangzhou Co Ltd filed Critical Hitachi Building Technology Guangzhou Co Ltd
Priority to CN201711309405.3A priority Critical patent/CN107947994B/en
Publication of CN107947994A publication Critical patent/CN107947994A/en
Application granted granted Critical
Publication of CN107947994B publication Critical patent/CN107947994B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/12Discovery or management of network topologies

Landscapes

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

Abstract

The invention discloses a network topology self-discovery method, which comprises the following steps: in a network where a plurality of network nodes are located, setting one network node as a source network node, and selecting the network nodes one by one from other network nodes as target network nodes; sending a path detection packet from a source network node to a target network node, so that the network node of the path detection packet and the target network node respectively send detection response packets to the source network node after receiving the path detection packet; marking the number of the detection response packets as coordinate values of the target network node; and drawing an interconnection topological graph corresponding to the network according to the coordinate values of all other network nodes in the network. Correspondingly, the invention also discloses a network topology self-discovery device, network equipment and a computer storage medium. The invention automatically completes topology self-discovery based on data packet transmission of MAC frame format, does not need to integrate spanning tree protocol, and is suitable for network system with high real-time requirement.

Description

Network topology self-discovery method and device, network equipment and computer storage medium
Technical Field
Embodiments of the present invention relate to network management technologies, and in particular, to a method and an apparatus for network topology self-discovery, a network device, and a computer storage medium.
Background
The main purpose of network topology self-discovery is to acquire and maintain the existence information of network nodes and the connection relationship information between the network nodes, and draw a whole network topology graph on the basis, and network managers can quickly check fault nodes on the basis of the network topology graph.
The prior art provides network layer based and data link layer based network topology self-discovery methods. The network layer topology self-discovery method can only obtain the logical connection relation between the routes or the hosts through analyzing the routing information of the network equipment, and cannot discover the actual physical connection condition. The network topology self-discovery method of the data link layer needs a network node to support a spanning tree STP protocol, and in some industrial control automation systems, because of high real-time requirement, in order to ensure the high efficiency of industrial control data processing, a more complex STP software protocol is not generally integrated, so the network topology method in the prior art is not suitable for the network system with high real-time requirement.
Disclosure of Invention
The invention provides a network topology self-discovery method, a device, network equipment and a computer storage medium, which can automatically complete topology self-discovery in a mode of transmitting based on MAC frames without integrating spanning tree protocols and is suitable for a network system with high real-time requirement.
In a first aspect, an embodiment of the present invention provides a method for network topology self-discovery, including:
in a network where a plurality of network nodes are located, setting one network node as a source network node, and selecting the network nodes one by one from other network nodes as target network nodes;
sending a path detection packet from the source network node to a target network node, wherein the destination address of the path detection packet is the MAC address of the target network node; enabling the network node of the path detection packet path and the target network node to respectively send detection response packets to the source network node after receiving the path detection packets, wherein the destination address of each detection response packet is the MAC address of the source network node;
marking the number of the detection response packets as the coordinate value of the target network node;
and drawing an interconnection topological graph corresponding to the network according to the coordinate values of all other network nodes in the network, wherein the difference value between the coordinate values of two connected network nodes in the interconnection topological graph is 1.
In a second aspect, an embodiment of the present invention provides a network topology self-discovery apparatus, including:
the node selection module is used for setting one network node as a source network node in a network where a plurality of network nodes are located and selecting the network nodes from other network nodes one by one as target network nodes;
a path detection module, configured to send a path detection packet from the source network node to a target network node, where a destination address of the path detection packet is an MAC address of the target network node; enabling the network node of the path detection packet path and the target network node to respectively send detection response packets to the source network node after receiving the path detection packets, wherein the destination address of each detection response packet is the MAC address of the source network node;
the coordinate recording module is used for marking the number of the detection response packets as the coordinate value of the target network node;
and the node interconnection module is used for drawing an interconnection topological graph corresponding to the network according to the coordinate values of all other network nodes in the network, and the difference value between the coordinate values of two network nodes connected in the interconnection topological graph is 1. In a third aspect, an embodiment of the present invention further provides a network device, where the network device includes:
one or more processors;
a memory for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the network topology self-discovery method provided by any of the embodiments of the invention.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the network topology self-discovery method provided in any embodiment of the present invention.
The embodiment of the invention obtains the coordinate values of other network nodes by sending the path detection packet to other network nodes in the network through the source network node, and the difference value of the coordinate values of the network nodes connected in the network topology relative to a specific network node is 1, so that a topological graph can be drawn according to the distance between each network node and the source network node, the problem that the prior art needs to support the spanning tree STP protocol to carry out topology self-discovery and cannot be applied to a network system with high real-time requirement is solved, the effect that the topology self-discovery can be automatically completed based on the transmission of the data packet in the MAC frame format is realized, and the method is suitable for the network system with high real-time requirement.
Drawings
Fig. 1 is a flowchart of a network topology self-discovery method according to an embodiment of the present invention;
FIG. 2 is an exemplary interconnect topology in one embodiment of the present invention;
fig. 3 is an application scenario diagram of a network topology self-discovery method in the first embodiment of the present invention;
fig. 4 is a flowchart of a network topology self-discovery method according to a second embodiment of the present invention;
FIG. 5 is an exemplary interconnect topology of a second embodiment of the present invention;
fig. 6 is a flowchart of a network topology self-discovery method provided by a third embodiment of the present invention;
fig. 7 is a schematic structural diagram of a network topology self-discovery apparatus according to a fourth embodiment of the present invention;
fig. 8 is a schematic structural diagram of a network device according to a fifth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of a network topology self-discovery method according to an embodiment of the present invention, which specifically includes the following steps:
step 110, in the network where the plurality of network nodes are located, one of the network nodes is set as a source network node, and the network nodes are selected one by one from other network nodes as target network nodes.
Step 120, sending a path detection packet from the source network node to a target network node, wherein a destination address of the path detection packet is an MAC address of the target network node; and respectively sending detection response packets to the source network node after the network node of the path detection packet path and the target network node receive the path detection packet, wherein the destination address of each detection response packet is the MAC address of the source network node.
Each network node generally creates and maintains an MAC address forwarding table through an MAC address learning function, so that when the network node receives a path detection packet, whether a destination address of the path detection packet is the same as the MAC address of the network node, if so, a detection response packet with a path detection packet source address, namely, a source network node MAC address as the destination address, is directly sent, and if not, the MAC address forwarding table is queried, and the path detection packet is forwarded from a port indicated by the MAC address forwarding table.
And step 130, marking the number of the detection response packets as the coordinate value of the target network node.
Step 140, drawing an interconnection topological graph corresponding to the network according to the coordinate values of all other network nodes in the network, wherein the difference value between the coordinate values of two network nodes connected in the interconnection topological graph is 1.
The steps of the method are based on data packet transmission of the MAC frame format, and topology self-discovery is automatically completed. In specific implementation, step 140 may be implemented in different specific schemes according to the topology type of the network.
Simply, for a linear network whose network topology is a plurality of network nodes connected in sequence, as shown in fig. 2, fig. 2 is an interconnection topology diagram of an example of this embodiment, a gateway network shown in the interconnection topology diagram is a linear network, if a set source network node is a first gateway 31 or a last gateway in the linear network, all network nodes are connected to one port side of the source network node, the source network node is connected to a network node whose coordinate value is 1, and the network nodes are connected in order of the coordinate value from small to large, that is, the interconnection topology diagram is obtained.
If the network topology is a linear network in which a plurality of network nodes are sequentially connected as shown in fig. 2, and the set source network node is not the first network node or the last network node in the linear network, such as the gateway 32 in the figure, the MAC address forwarding table of the source network node is queried to obtain two network node groups corresponding to two port sides of the source network node, where each network node in the network node groups is connected to the same port side of the source network node; and sequentially connecting the network nodes in the network node group according to the coordinate values, and respectively connecting the source network node with the two network nodes with the coordinate values of 1 to obtain the interconnection topological graph.
For a linear network, a port of any network node connected with an adjacent network node can be determined by inquiring the MAC address forwarding table of the network node.
The embodiment also provides a further scheme, and the connection topology among the plurality of specified network nodes can be drawn. In some practical application scenarios, an interconnection topology between network nodes (e.g., network nodes that are gateways or routers) in a network that implement the same function may be drawn, while excluding interference of other network nodes in the drawing process. Specifically, step 110, in a network where a plurality of network nodes are located, setting one of the network nodes as a source network node, and selecting one network node from other network nodes as a target network node one by one, includes:
adding the network nodes into a multicast group, receiving the MAC addresses of the network nodes sent by the network nodes in the multicast group, and acquiring an MAC address set of the network nodes in the multicast group;
acquiring an MAC address forwarding table of a network node; the MAC address forwarding table is used for recording other network node MAC address sets connected with Ethernet ports of the network nodes;
comparing the MAC address set of the network nodes in the multicast group with other network node MAC address sets connected with each Ethernet port of the network nodes, and judging whether each Ethernet port of the network nodes is connected with the network nodes in the multicast group;
if the Ethernet port of the network node is not connected with the network node in the multicast group, closing the Ethernet port;
and setting one network node in the network nodes in the multicast group as a source network node, and selecting the network nodes one by one from other network nodes in the multicast group as target network nodes.
According to the further scheme, the port which is not connected with the network nodes in the multicast group is closed, so that the disconnection of the network nodes in the non-multicast group is realized, the source network node only communicates with the network nodes in the multicast group, the interconnection topology of the network nodes in the multicast group can only be found, and the interference of other non-specified network nodes is eliminated.
In order to better embody the beneficial effects of the present embodiment, the following describes the principle of the network topology self-discovery method provided by the present embodiment through a specific application scenario.
Referring to fig. 3, fig. 3 is a schematic view of an application scenario of the network topology self-discovery method in the first embodiment of the present invention, where the application scenario is a fully-mechanized mining centralized control system for a mine. The comprehensive mining centralized control system for the mine is the forefront and most complex link of coal mine production and is also the core for realizing the automation of the coal mine production. The system generally comprises fully mechanized mining equipment 23 (such as bottom layer equipment as a mobile substation, a megaphone, a coal mining machine monitor, a pump station and the like shown in fig. 3) arranged on a working face site, a central host 21 (including a centralized monitoring host of a ground dispatching platform or a video monitoring host and the like) for carrying out working condition monitoring, sensing acquisition, remote and automatic control and visual monitoring on the fully mechanized mining equipment, and a gateway 22 serving as a communication substation or a data acquisition substation. The gateway is connected between the central host and the fully mechanized mining equipment, so that the central host can access a data transfer station of the fully mechanized mining equipment and perform data protocol conversion and other work. Specifically, the gateway is connected to the switch 24 of the backbone ring network, and the backbone ring network includes a plurality of switch nodes, which are respectively used for realizing the gateway access of the fully mechanized coal mining face, the gateway of the gateway equipment train lane or the belt transportation lane and the like, and the connection with the central host.
In the fully-mechanized mining centralized control system for the mine, the central host to the gateway generally adopts an Ethernet link, the Ethernet link is arranged between the gateways, and the field bus link is mostly adopted from the gateway to fully-mechanized mining equipment. Specifically, the gateway includes an ethernet port and an industrial fieldbus port; the Ethernet port of the gateway is used for connecting a central host, other gateways or fully mechanized mining equipment with the Ethernet port, and the industrial field bus port is used for connecting fully mechanized mining equipment with the industrial field bus port. Due to the continuous improvement of the automation degree of mines in recent years, the number of fully mechanized mining equipment is increased, the positions are scattered, the number of gateways is increased, the docking configuration relation of the gateways is complicated, and the gateway management and fault location are more difficult. The method is limited by the field environment, the gateways cannot be arranged according to the topological graph laid in advance, and the physical arrangement and interconnection of the gateways need to be freely determined on the field according to actual requirements and the distance from the fully mechanized mining equipment, so that the interconnection topological graph of the gateways needs to be constructed after the gateways are arranged, a large amount of human resources are consumed by manual drawing, and therefore, the topology self-discovery among the gateways has important significance. Because the ethernet port of the gateway is not only used for connecting other gateways, but also used for connecting fully mechanized mining equipment and a central host (i.e. non-gateway network equipment), at the stage of topology self-discovery, a data packet may enter the non-gateway network equipment, and the non-gateway network equipment may also send network data to the gateway at random, so that the port where the non-gateway network equipment is connected with the gateway equipment also has data transceiving behavior during topology path detection, so that the non-gateway network equipment can be misjudged as the gateway, thereby making the topology inaccurate and causing troubles for implementing fault location and troubleshooting.
In this embodiment, after all gateways are started, the gateways automatically join the multicast group, and automatically identify gateway interconnection ports and non-gateway interconnection ports by comparing the full set of network node MAC addresses in the multicast group with the set of network node MAC addresses connected to the ports in the MAC address forwarding table of each network node. And then data receiving and transmitting of the non-gateway interconnection port are eliminated in the topology self-discovery stage, so that the random data receiving and transmitting behaviors of the non-gateway network equipment connected with the non-gateway interconnection port cannot cause misjudgment of the passing gateway.
In specific implementation, the industrial fieldbus port of the gateway includes an RS458 port, an RS422 port, a LAN port or a CAN port.
In specific implementation, one gateway may be selected from the gateways as a source network node according to a preset rule, and a path detection packet is sent to other gateways, for example, after each gateway obtains MAC addresses of all network nodes in a multicast group, the gateway with the smallest MAC address value is selected as the source network node. Or, one of the gateways is designated as the source network node before the gateways are manually arranged on site.
In order to utilize the address forwarding table resources to the maximum extent and dynamically reflect the real connection state of the network, the ethernet network node updates the MAC address forwarding table by using an aging mechanism, which specifically comprises the following steps: when creating the table entry (i.e. the corresponding relationship between the port and the MAC address) of the MAC address forwarding table, the network node starts the aging timer, and if the message from the MAC address in the table entry is not received within the aging time, the network node deletes the MAC address table entry.
In the network communication process, the timely aging of the MAC address forwarding table can actually achieve the effects of high resource utilization rate and dynamic reflection of a network connection state, but in the embodiment, the network node interconnection ports of the same service type are identified based on comparison between the MAC address forwarding table and the MAC address set of the network nodes in the multicast group, if the table entry of the MAC address forwarding table is missing, the interconnection ports between gateways can be identified as the interconnection ports between non-gateways, and therefore the topological graph is incompletely drawn. In order to avoid that, when identifying the interconnection ports between the gateways, an entry in the MAC address table is missing due to the processing time of the processor being longer than the aging time, this embodiment further includes, before comparing the MAC address set of the network node in the multicast group with the MAC address sets of other network nodes connected to each ethernet port of the network node:
and adjusting the aging time of the MAC address forwarding table of the network node to a preset maximum value.
In summary, in the technical solution of this embodiment, the source network node sends the path detection packet to other network nodes in the network to obtain coordinate values of the other network nodes, and since the difference value between the coordinate values of the network nodes connected in the network topology with respect to a specific network node is 1, a topology graph can be drawn according to the distance from each network node to the source network node, so as to solve the problem that the prior art needs to support the spanning tree STP protocol for topology self-discovery and cannot be applied to a network system with a high real-time requirement, thereby achieving the effect that the topology self-discovery can be automatically completed based on the packet propagation in the MAC frame format, and being suitable for a network system with a high real-time requirement.
Example two
Fig. 4 is a flowchart of a network topology self-discovery method according to a second embodiment of the present invention. The embodiment provides a specific scheme for drawing an interconnection topological graph, which is suitable for a nonlinear network, on the basis of the first embodiment. The method specifically comprises the following steps:
step 110, in the network where the plurality of network nodes are located, one of the network nodes is set as a source network node, and the network nodes are selected one by one from other network nodes as target network nodes.
Step 120, sending a path detection packet from the source network node to a target network node, wherein a destination address of the path detection packet is an MAC address of the target network node; and respectively sending detection response packets to the source network node after the network node of the path detection packet path and the target network node receive the path detection packet, wherein the destination address of each detection response packet is the MAC address of the source network node.
Each network node generally creates and maintains an MAC address forwarding table through an MAC address learning function, so that when the network node receives a path detection packet, whether a destination address of the path detection packet is the same as the MAC address of the network node, if so, a detection response packet with a path detection packet source address, namely, a source network node MAC address as the destination address, is directly sent, and if not, the MAC address forwarding table is queried, and the path detection packet is forwarded from a port indicated by the MAC address forwarding table.
And step 130, marking the number of the detection response packets as the coordinate value of the target network node.
And step 410, reading the network node with the maximum coordinate value as the farthest node from the isolated network nodes in the interconnection topological graph corresponding to the network.
Step 420, searching the source address of each detection response packet received by the source network node when the farthest node is used as the target network node to send the path detection packet, and obtaining the coordinate value of the network node corresponding to each source address.
And step 430, sequentially connecting the network nodes corresponding to the obtained source addresses according to the coordinate values.
The method for drawing the interconnection topology map in steps 410 to 430 is explained below with reference to the interconnection topology map of the present embodiment example, fig. 5.
In fig. 5, the gateway with MAC-a address is the set source network node, and through steps 110 to 130, it is determined that the gateway 61 is the network node with coordinate value 1 (including the gateway with MAC address MAC-B, MAC-C, MAC-J, MAC-N), the gateway 62 is the network node with coordinate value 2 (including the gateway with MAC address MAC-D, MAC-G, MAC-H, MAC-K, MAC-M and MAC-O), and the gateway 63 is the network node with coordinate value 3 (including the gateway with MAC address MAC-E, MAC-F, MAC-I, MAC-L).
When the interconnection topology has not yet begun to be drawn, all network nodes are isolated, and the farthest node is the gateway 63. And sequentially taking any gateway included in the gateways 63 as the farthest node, for example, a gateway with an MAC address of MAC-E, and searching for the source address of the probe response packet received by the source network node when the gateway is the target network node. Since the path from the source network node to the network node with MAC address MAC-E is: and MAC-A, MAC-C, MAC-D, MAC-E, so that the source address of the detection response packet comprises MAC-C, MAC-D and MAC-E, the source network node cannot receive the detection response packet sent by the source network node, the coordinate value of the source network node can be set to 0, and the network node corresponding to the obtained source address and the source network node are sequentially connected according to the coordinate value, so that the path from MAC-A to MAC-E can be drawn and reflected on the interconnection topological graph. By analogy, after the gateway 63 is used as the farthest node and the corresponding path is connected, the gateways with the MAC addresses of MAC-G, MAC-M, MAC-O, MAC-N and MAC-B are isolated, and the farthest gateway is selected to execute the steps, so that all paths can be drawn one by one. And by querying the MAC address forwarding table, the interconnect ports between adjacent gateways can be determined.
In summary, in the technical solution of this embodiment, the source network node sends the path detection packet to other network nodes in the network to obtain coordinate values of the other network nodes, and since the difference value between the coordinate values of the network nodes connected in the network topology with respect to a specific network node is 1, according to the distance from each network node to the source network node, a topology map can be drawn, so as to solve the problem that the prior art needs to support the spanning tree STP protocol for topology self-discovery and cannot be applied to a network system with high real-time requirement, achieve the effect that the topology self-discovery can be automatically completed based on the packet propagation in the MAC frame format, and be suitable for a network system with high real-time requirement, and extend the network type adapted to the topology self-discovery from a linear network to a non-linear network.
EXAMPLE III
Fig. 6 is a flowchart of a network topology self-discovery method according to a third embodiment of the present invention. The present embodiment provides a specific solution for drawing an interconnection topology map applicable to a nonlinear network, which is different from the first embodiment. The method specifically comprises the following steps:
step 610, in the network where the plurality of network nodes are located, one of the network nodes is set as a source network node, and the network nodes are selected from other network nodes one by one as target network nodes.
Step 620, sending a path detection packet from the source network node to a target network node, wherein a destination address of the path detection packet is an MAC address of the target network node; enabling the network node of the path detection packet path and the target network node to respectively send detection response packets to the source network node after receiving the path detection packets, wherein the destination address of each detection response packet is the MAC address of the source network node;
the detection response packet sent by the network node of the path detection packet path comprises a downlink port number of the network node of the path, and the detection response packet sent by the target network node comprises an uplink port number of the target network node; the uplink port number is the number of a port for sending a detection response packet to a source network node, and the downlink port number is the number of a port for forwarding a path detection packet to a target network node by the network node in the path. As shown in fig. 5, when the gateway with the MAC address as MAC-a is used as a source network node and the gateway with the MAC address as MAC-G is used as a target network node, a port 1 of the MAC-G gateway and a port 1 of the MAC-C are marked as uplink ports, that is, ports of the gateway in a direction close to the source network node, and a port 3 of the MAC-C is marked as downlink ports, that is, ports of the gateway growing topologically in a direction far from the source network node.
Step 630, marking the number of the detection response packets as the coordinate value of the target network node;
step 640, if the coordinate value of the target network node is n and n is not equal to 1, acquiring an intersection between the MAC address set of each network node of which the coordinate value is n-1 and the MAC address set of the network node of the path corresponding to the target network node, connecting the network node corresponding to the intersection with the target network node, and marking an uplink port of the target network node and a downlink port of the network node corresponding to the intersection as connection ports.
Step 650, if the coordinate value of the target network node is 1, connecting the target network node and the source network node, and marking an uplink port of the target network node and a port of the source network node for sending the path detection packet to the target network node as connection ports.
According to the technical scheme of the embodiment, the network type adaptive to the self-discovery of the topology is expanded from a linear network to a non-linear network, and the classified port number of the network node response is added in the detection response packet, so that the content of the detection response packet can be directly inquired to obtain the connection port of the network node in the interconnection topological graph, the MAC address forwarding table of each network node does not need to be obtained, the transmission data volume in the network is reduced, and the data analysis volume is reduced.
Example four
Fig. 7 is a schematic structural diagram of a network topology self-discovery apparatus according to a fourth embodiment of the present invention.
The network topology self-discovery device of the embodiment comprises:
a node selection module 710, configured to set one of the network nodes as a source network node in a network where multiple network nodes are located, and select one network node from other network nodes as a target network node one by one;
a path detection module 720, configured to send a path detection packet from the source network node to a target network node, where a destination address of the path detection packet is a MAC address of the target network node; enabling the network node of the path detection packet path and the target network node to respectively send detection response packets to the source network node after receiving the path detection packets, wherein the destination address of each detection response packet is the MAC address of the source network node;
a coordinate recording module 730, configured to mark the number of the probe response packets as a coordinate value of the target network node;
the node interconnection module 740 is configured to draw an interconnection topology map corresponding to the network according to the coordinate values of all other network nodes in the network, where a difference between the coordinate values of two network nodes connected in the interconnection topology map is 1.
As an embodiment, the node interconnection module 740 includes:
an isolated node reading unit, configured to read, as a farthest node, a network node with a largest coordinate value from isolated network nodes in an interconnection topology corresponding to the network;
the path coordinate acquisition unit is used for searching the source address of each detection response packet received by the source network node when the farthest node is taken as the target network node to send the path detection packet, and acquiring the coordinate value of the network node corresponding to each source address;
and the connecting unit is used for sequentially connecting the network nodes corresponding to the obtained source addresses according to the coordinate values.
Further, the target selecting module 710 includes:
the first set acquisition unit is used for joining a multicast group, receiving own MAC addresses sent by a plurality of network nodes in the multicast group and acquiring an MAC address set of the network nodes in the multicast group;
a second set acquiring unit, configured to acquire an MAC address forwarding table of a network node; the MAC address forwarding table is used for recording other network node MAC address sets connected with Ethernet ports of the network nodes;
a comparing unit, configured to compare the MAC address set of the network node in the multicast group with other network node MAC address sets to which each ethernet port of the network node is connected, and determine whether each ethernet port of the network node is connected to a network node in the multicast group;
a port management unit, configured to close an ethernet port of a network node if the ethernet port is not connected to a network node in the multicast group;
and the node confirmation unit is used for setting one network node in the network nodes in the multicast group as a source network node and selecting the network nodes one by one from other network nodes in the multicast group as target network nodes.
Further, the network nodes in the multicast group are gateways connected between an upper computer and fully mechanized mining equipment in the mine centralized control system;
the gateway comprises an Ethernet port and an industrial field bus port; the Ethernet port of the gateway is used for connecting the upper computer, other gateways or fully mechanized mining equipment with the Ethernet port, and the industrial field bus port is used for connecting fully mechanized mining equipment with the industrial field bus port.
Further, the node selecting module 710 further includes:
and the aging adjusting unit is used for adjusting the aging time of the MAC address forwarding table of the network node to a preset maximum value before comparing the MAC address set of the network node in the multicast group with the MAC address sets of other network nodes connected with each Ethernet port of the network node.
As another embodiment, a probe response packet sent by a network node of the path probe packet path includes a downlink port number of the network node of the path, and a probe response packet sent by the target network node includes an uplink port number of the target network node; the uplink port number is the number of a port for sending a detection response packet to a source network node, and the downlink port number is the number of a port for forwarding a path detection packet to a target network node by the network node in the path.
The node interconnect module 740 includes:
the first interconnection unit is used for acquiring an intersection between an MAC address set of each network node with a coordinate value of n-1 and an MAC address set of a network node of a path corresponding to the target network node if the coordinate value of the target network node is n, wherein n is not equal to 1, connecting the network node corresponding to the intersection with the target network node in an interconnection topological graph, and marking an uplink port of the target network node and a downlink port of the network node corresponding to the intersection as connection ports;
and the second interconnection unit is used for connecting the target network node and the source network node in the interconnection topological graph if the coordinate value of the target network node is 1, and marking an uplink port of the target network node and a port of the source network node for sending the path detection packet to the target network node as connection ports.
The network topology self-discovery device provided by the embodiment of the invention can execute the network topology self-discovery method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
EXAMPLE five
Fig. 8 is a schematic structural diagram of a network device according to a fifth embodiment of the present invention, as shown in fig. 8, the network device includes a processor 820, a memory 810, an input device 830, and an output device 840; the number of the processors 820 in the network node may be one or more, and one processor 820 is taken as an example in fig. 8; the processor 820, memory 810, input device 830, and output device 840 in the network device may be connected by a bus or other means, such as by a bus connection in fig. 8.
The memory 810 may be used as a computer-readable storage medium for storing software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the network topology self-discovery method in the embodiment of the present invention (for example, a node selection module, a path detection module, a coordinate recording module, and a node interconnection module in the network topology self-discovery apparatus). The processor 820 executes software programs, instructions and modules stored in the memory 810 so as to execute various functional applications of the network device and data processing, that is, implement the network topology self-discovery method described above.
The memory 810 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 810 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, memory 810 may further include memory located remotely from processor 820, which may be connected to a network node via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 830 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the network device. The output device 840 may include a display device such as a display screen.
EXAMPLE six
An embodiment of the present invention further provides a computer-readable storage medium storing a computer program, which when executed by a computer processor is configured to perform a network topology self-discovery method, the method including:
in a network where a plurality of network nodes are located, setting one network node as a source network node, and selecting the network nodes one by one from other network nodes as target network nodes;
sending a path detection packet from the source network node to a target network node, wherein the destination address of the path detection packet is the MAC address of the target network node; enabling the network node of the path detection packet path and the target network node to respectively send detection response packets to the source network node after receiving the path detection packets, wherein the destination address of each detection response packet is the MAC address of the source network node;
marking the number of the detection response packets as the coordinate value of the target network node;
and drawing an interconnection topological graph corresponding to the network according to the coordinate values of all other network nodes in the network, wherein the difference value between the coordinate values of two connected network nodes in the interconnection topological graph is 1.
Of course, the storage medium provided by the embodiment of the present invention contains computer-executable instructions, and the computer-executable instructions are not limited to the method operations described above, and may also perform related operations in the search method provided by any embodiment of the present invention.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.
It should be noted that, in the embodiment of the network topology self-discovery apparatus, each included unit and module are only divided according to functional logic, but are not limited to the above division as long as the corresponding function can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (8)

1. A method for network topology discovery, comprising:
in a network where a plurality of network nodes are located, setting one network node as a source network node, and selecting the network nodes one by one from other network nodes as target network nodes;
sending a path detection packet from the source network node to a target network node, wherein the destination address of the path detection packet is the MAC address of the target network node; enabling the network node of the path detection packet path and the target network node to respectively send detection response packets to the source network node after receiving the path detection packets, wherein the destination address of each detection response packet is the MAC address of the source network node;
marking the number of the detection response packets as the coordinate value of the target network node;
drawing an interconnection topological graph corresponding to the network according to coordinate values of all other network nodes in the network, wherein the difference value between the coordinate values of two network nodes connected in the interconnection topological graph is 1;
the drawing an interconnection topological graph corresponding to the network according to the coordinate values of all other network nodes in the network specifically includes:
reading a network node with the maximum coordinate value as a farthest node from isolated network nodes in an interconnection topological graph corresponding to the network;
searching a source address of each detection response packet received by a source network node when a path detection packet is sent by taking the farthest node as a target network node, and obtaining a coordinate value of a network node corresponding to each source address;
sequentially connecting the network nodes corresponding to the obtained source addresses according to the coordinate values;
before the interconnection topological graph corresponding to the network is not drawn, all the network nodes belong to isolated network nodes.
2. The method according to claim 1, wherein in a network in which the plurality of network nodes are located, one of the network nodes is set as a source network node, and the network nodes are selected one by one from other network nodes as target network nodes, and specifically comprises:
adding the network nodes into a multicast group, receiving the MAC addresses of the network nodes sent by the network nodes in the multicast group, and acquiring an MAC address set of the network nodes in the multicast group;
acquiring an MAC address forwarding table of a network node; the MAC address forwarding table is used for recording other network node MAC address sets connected with Ethernet ports of the network nodes;
comparing the MAC address set of the network nodes in the multicast group with other network node MAC address sets connected with each Ethernet port of the network nodes, and judging whether each Ethernet port of the network nodes is connected with the network nodes in the multicast group;
if the Ethernet port of the network node is not connected with the network node in the multicast group, closing the Ethernet port;
and setting one network node in the network nodes in the multicast group as a source network node, and selecting the network nodes one by one from other network nodes in the multicast group as target network nodes.
3. The network topology self-discovery method according to claim 2, wherein the network node in the multicast group is a gateway connected between an upper computer and fully mechanized equipment in a mine centralized control system;
the gateway comprises an Ethernet port and an industrial field bus port; the Ethernet port of the gateway is used for connecting the upper computer, other gateways or fully mechanized mining equipment with the Ethernet port, and the industrial field bus port is used for connecting fully mechanized mining equipment with the industrial field bus port.
4. The method of claim 2, wherein before comparing the MAC address set of the network node in the multicast group with the MAC address sets of other network nodes connected to each ethernet port of the network node, the method further comprises:
and adjusting the aging time of the MAC address forwarding table of the network node to a preset maximum value.
5. The network topology self-discovery method according to claim 1, wherein the probe response packet sent by the network node of the path probe packet path includes a downlink port number of the network node of the path, and the probe response packet sent by the target network node includes an uplink port number of the target network node; the uplink port number is the number of a port for sending a detection response packet to a source network node, and the downlink port number is the number of a port for forwarding a path detection packet to a target network node by the network node in the path;
the drawing an interconnection topological graph corresponding to the network according to the coordinate values of all other network nodes in the network specifically includes:
if the coordinate value of the target network node is n and n is not equal to 1, acquiring an intersection between the MAC address set of each network node with the coordinate value of n-1 and the MAC address set of the network node of the path corresponding to the target network node, connecting the network node corresponding to the intersection with the target network node in an interconnection topological graph, and marking an uplink port of the target network node and a downlink port of the network node corresponding to the intersection as connection ports;
if the coordinate value of the target network node is 1, connecting the target network node and the source network node in the interconnection topological graph, and marking an uplink port of the target network node and a port of the source network node for sending the path detection packet to the target network node as connection ports.
6. A network topology self-discovery apparatus, comprising:
the node selection module is used for setting one network node as a source network node in a network where a plurality of network nodes are located and selecting the network nodes from other network nodes one by one as target network nodes;
a path detection module, configured to send a path detection packet from the source network node to a target network node, where a destination address of the path detection packet is an MAC address of the target network node; enabling the network node of the path detection packet path and the target network node to respectively send detection response packets to the source network node after receiving the path detection packets, wherein the destination address of each detection response packet is the MAC address of the source network node;
the coordinate recording module is used for marking the number of the detection response packets as the coordinate value of the target network node;
the node interconnection module is used for drawing an interconnection topological graph corresponding to the network according to the coordinate values of all other network nodes in the network, and the difference value between the coordinate values of two network nodes connected in the interconnection topological graph is 1;
the node interconnect module includes:
an isolated node reading unit, configured to read, as a farthest node, a network node with a largest coordinate value from isolated network nodes in an interconnection topology corresponding to the network;
the path coordinate acquisition unit is used for searching the source address of each detection response packet received by the source network node when the farthest node is taken as the target network node to send the path detection packet, and acquiring the coordinate value of the network node corresponding to each source address;
the connecting unit is used for sequentially connecting the network nodes corresponding to the obtained source addresses according to the coordinate values;
before the interconnection topological graph corresponding to the network is not drawn, all the network nodes belong to isolated network nodes.
7. A network device, comprising:
one or more processors;
a memory for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the network topology self-discovery method of any of claims 1-5.
8. A computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, is adapted to carry out the network topology self-discovery method of any one of claims 1 to 5.
CN201711309405.3A 2017-12-11 2017-12-11 Network topology self-discovery method and device, network equipment and computer storage medium Active CN107947994B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711309405.3A CN107947994B (en) 2017-12-11 2017-12-11 Network topology self-discovery method and device, network equipment and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711309405.3A CN107947994B (en) 2017-12-11 2017-12-11 Network topology self-discovery method and device, network equipment and computer storage medium

Publications (2)

Publication Number Publication Date
CN107947994A CN107947994A (en) 2018-04-20
CN107947994B true CN107947994B (en) 2020-11-10

Family

ID=61946499

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711309405.3A Active CN107947994B (en) 2017-12-11 2017-12-11 Network topology self-discovery method and device, network equipment and computer storage medium

Country Status (1)

Country Link
CN (1) CN107947994B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109672557A (en) * 2018-11-20 2019-04-23 广东联迪信息科技有限公司 A kind of network device management method and system
CN110022219B (en) * 2019-04-12 2021-09-24 深圳市网心科技有限公司 Network cluster detection method and system, electronic device and storage medium
CN113055238B (en) * 2019-12-26 2023-02-03 深信服科技股份有限公司 Network detection method, platform and computer readable storage medium
CN115225510B (en) * 2022-07-19 2024-01-23 北京天融信网络安全技术有限公司 Method and device for acquiring block chain public chain network structure and electronic equipment
CN115550193B (en) * 2022-12-01 2023-03-17 北京广通优云科技股份有限公司 Network topology calculation method combining static structure chart and dynamic flow analysis data

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6973023B1 (en) * 2000-12-30 2005-12-06 Cisco Technology, Inc. Method for routing information over a network employing centralized control
CN101771604B (en) * 2008-12-31 2013-01-09 华为技术有限公司 Routing detection method, system and intermediate routing device
CN103368856A (en) * 2013-07-10 2013-10-23 杭州华三通信技术有限公司 Topology management method and device
CN103905276A (en) * 2014-03-27 2014-07-02 国家电网公司 Fast network topology detecting method
CN105656790B (en) * 2016-01-28 2019-03-05 东智安通(北京)科技有限公司 Multi-path data transmission method and device
CN105721318B (en) * 2016-02-29 2018-12-25 华为技术有限公司 The method and apparatus of network topology are found in a kind of software defined network SDN
CN106067862A (en) * 2016-06-14 2016-11-02 乐视控股(北京)有限公司 The construction method of network topology and device

Also Published As

Publication number Publication date
CN107947994A (en) 2018-04-20

Similar Documents

Publication Publication Date Title
CN107947994B (en) Network topology self-discovery method and device, network equipment and computer storage medium
US10484206B2 (en) Path detection method in VxLAN, controller, and network device
CN106656801B (en) Reorientation method, device and the Business Stream repeater system of the forward-path of Business Stream
CN102647355B (en) LACP (Link Aggregation Control Protocol) consultation processing method, relay node and system
CN108737272B (en) High-performance route forwarding method in cloud computing
CN113411260B (en) Method and device for sending data message in IPv6 network
CN107959620B (en) Fully mechanized mining equipment identification method, device, system, gateway and storage medium
CN102938794A (en) Address resolution protocol (ARP) message forwarding method, exchanger and controller
CN105227466B (en) Communication processing method and device
CN103354509B (en) The acquisition methods of a kind of link connection information and equipment
CN104320278A (en) Wide area network realizing method and device based on software-defined network
WO2020007372A1 (en) Control method and device employing industrial ethernet
CN104601394A (en) Business chain connectivity detection method, device and system
CN104168209A (en) Multi-access SDN message forwarding method and controller
CN102326370B (en) Message processing method, apparatus and system
CN105187311A (en) Message forwarding method and message forwarding device
CN105516025A (en) End-to-end path control and data transmission method, OpenFlow controller and a switch
CN105471747A (en) Intelligent router routing method and apparatus thereof
CN104135548A (en) Static NAT realization method and device based on FPGA
CN107517130B (en) OPNET-based seamless redundancy protocol network performance equivalent simulation method
CN105162703A (en) Multi-level network topology intelligent discovery and generation method and system based on hybrid protocol
CN105207909A (en) Method for transmitting information and network apparatus
CN107465621A (en) A kind of router finds method, SDN controllers, router and network system
WO2016101600A1 (en) Line card determination, determination processing method and device, and line card determination system
CN108055151B (en) Port management method and device of network node, network node and storage medium

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