CN102045190B - Network topology discovery method and device - Google Patents
Network topology discovery method and device Download PDFInfo
- Publication number
- CN102045190B CN102045190B CN2009102364158A CN200910236415A CN102045190B CN 102045190 B CN102045190 B CN 102045190B CN 2009102364158 A CN2009102364158 A CN 2009102364158A CN 200910236415 A CN200910236415 A CN 200910236415A CN 102045190 B CN102045190 B CN 102045190B
- Authority
- CN
- China
- Prior art keywords
- route
- current
- layer network
- current routing
- routing
- 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.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims abstract description 48
- 230000008569 process Effects 0.000 claims abstract description 17
- 230000004044 response Effects 0.000 claims description 7
- 230000001960 triggered effect Effects 0.000 claims description 2
- 230000006870 function Effects 0.000 description 6
- 238000010586 diagram Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 2
- 238000002955 isolation Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
Images
Landscapes
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention provides a network topology discovery method and device. The method comprises the following steps of: (1) in the collection process of a three-layer network topology structure, acquiring an IP route table of the current routing device; (2) traversing routes in the IP route table, and judging whether the currently traversed route is a direct route, if yes, executing the step (3), wherein the direct route shows that the current routing device is directly connected with a two-layer network corresponding to the next hop IP address and the subnet mask of the current route; and (3) querying whether the current routing device has neighbor information, if yes, determining that the current routing device still stays in the two-layer network, wherein the current routing device is connected with at least one two-layer network device; and acquiring the topology structure of the two-layer network collected by the current routing device. By adopting the invention, the purpose of acquiring the topology structure of the entire network by using the unified network topology discovery mode is achieved.
Description
Technical Field
The present invention relates to network management technologies, and in particular, to a method and device for discovering a network topology.
Background
In network management technology, network topology is a method for expressing logical connection relation and physical connection relation of a network. Through the network topology, an administrator can intuitively know the current operation condition of the network, accurately position the fault in the network for isolation, and accurately analyze the bottleneck possibly existing in the whole network, so that the network is improved in a targeted manner, and the overall performance of the network is improved. Therefore, with the increasing network scale, higher requirements are put on the accuracy and real-time performance of network topology discovery.
The current network topology discovery is mainly network layer (L3: three layers) network topology discovery and data link layer (L2: two layers) network topology discovery. The discovery of the three-layer network topology is mainly used for acquiring a three-layer network topology structure, specifically, acquiring connection relationships between routing devices (such as routers or switches with a three-layer routing function) in a three-layer network and between the routing devices and a two-layer network (a data link layer network); the discovery of the two-layer network topology is mainly used for acquiring a two-layer network topology structure, specifically, acquiring connection relationships between two-layer network devices, such as switches (two-layer switches) or devices having a switch function, and between a two-layer network device and a bridge.
In the prior art, three-layer network topology discovery and two-layer network topology discovery are two mutually independent processes, and if a topology structure of the whole network needs to be obtained, the three-layer network topology discovery is started under the triggering of an external environment, such as a user, to collect the three-layer network topology structure; then, starting two-layer network topology discovery under the triggering of a user to collect two-layer network topology structures; and finally, drawing the collected three-layer network topological structure and two-layer network topological structure by adopting a certain algorithm to obtain the topological structure of the whole network.
As can be seen from the above description, in the prior art, the topology structure of the entire network is not obtained through a uniform network topology discovery manner, but two separate and different network topology discovery manners are respectively adopted to obtain the topology structure of the entire network, so that the complexity of network management is increased, and the prior art needs to be triggered by the outside, such as a user, to perform the network topology acquisition, which also increases the workload of the user. Therefore, a network topology discovery method for uniformly collecting network topology is a technical problem to be solved at present.
Disclosure of Invention
The invention provides a method and equipment for discovering network topology, which are used for acquiring the topology structure of the whole network by adopting a uniform network topology discovery mode.
The technical scheme provided by the invention is realized as follows:
a network topology discovery method comprises the following steps:
a, in the process of collecting a three-layer network topological structure, acquiring an IP routing table of current routing equipment, wherein each route in the IP routing table comprises a next hop IP address, a subnet mask and a route type;
b, traversing the route in the IP routing table, and judging whether the type of the currently traversed route is a direct route, wherein the direct route indicates that the current routing equipment is directly connected with a two-layer network corresponding to the next-hop IP address and the subnet mask of the current route, and if so, executing the step C;
c, inquiring whether the current routing equipment has neighbor information or not, if so, determining that the current routing equipment is in a two-layer network, and at least one two-layer network equipment is connected below the current routing equipment; and acquiring the topological structure of the two-layer network collected by the current routing equipment.
A network topology discovery device, comprising: the device comprises an acquisition unit, a judgment unit and a topology collection unit; wherein,
the acquiring unit is used for acquiring an IP routing table of the current routing equipment in the process of collecting the three-layer network topology structure, wherein each route in the IP routing table comprises a next hop IP address, a subnet mask and a route type;
the judging unit is used for traversing the route in the IP routing table and judging whether the type of the currently traversed route is a direct route, wherein the direct route is used for indicating that the current routing equipment is directly connected with a two-layer network corresponding to the next-hop IP address and the subnet mask of the route;
the topology collection unit queries whether the current routing device has neighbor information or not when the judgment result of the judgment unit is yes, and if yes, determines that the current routing device is in a two-layer network and at least one two-layer network device is connected below the current routing device; and acquiring the topological structure of the two-layer network collected by the current routing equipment.
According to the technical scheme, the network topology discovering method and the device provided by the invention can automatically collect the topology structure of the whole network through one method, avoid the situation that the prior art collects the topology structure of the whole network by adopting two network topology discovering modes which are mutually separated and depend on user triggering, and achieve the purpose of acquiring the topology structure of the whole network by adopting a uniform network topology discovering mode.
Drawings
FIG. 1 is a basic flow diagram provided by an embodiment of the present invention;
FIG. 2 is a detailed flow chart provided by an embodiment of the present invention;
fig. 3 is a block diagram of an apparatus according to an embodiment of the present invention.
Detailed Description
Because the nodes in the whole network are all interconnected, the topology structure of the whole network does not need two sets of network topology discovery modes which are separated from each other and all depend on user triggering to collect, as in the prior art. Based on this, the embodiment of the present invention provides a unified method for acquiring the entire network topology, and specifically refers to the flow illustrated in fig. 1.
Referring to fig. 1, fig. 1 is a basic flow chart provided by an embodiment of the present invention. As shown in fig. 1, the process may include the following steps:
Here, the IP routing table of the current routing device is generally stored in a standard information base (MIB) defined by a Simple Network Management Protocol (SNMP), and therefore, in this step 101, the IP routing table of the current routing device stored in the MIB can be obtained through a Get operation defined by SNMP.
The obtained IP routing table records all routing information passing through the current routing device, such as connection relationships between the current routing device and the subnet and between the current routing device and the next-hop routing device. Each row in the IP routing table identifies a route, each route at least includes a next hop IP address (iproutenxhop) of the route, a subnet mask (iproutemsk) of the route, and a type (IpRouteType) of the route, where the type of the route may include two types, namely a direct route (direct) and an indirect route (indirect), where when the type of the route is a direct route, it indicates that a destination network segment can be directly reached through a current routing device, and the destination network segment is specifically a two-layer network corresponding to the next hop IP address of the route and the subnet mask of the route, that is, when the type of the route is a direct route, the current routing device is directly connected to the two-layer network; when the type of the route is an indirect route, it indicates that a path from the current routing device to the two-layer network needs to pass through other routing devices, where the other routing devices are specifically routing devices corresponding to the next-hop IP address of the route, that is, when the type of the route is an indirect route, the current routing device is directly connected to the routing device corresponding to the next-hop IP address of the route.
103, inquiring whether the current routing equipment has neighbor information, and if yes, executing step 104; otherwise, the next route of the currently traversed route is executed according to the operation in step 102.
Here, the neighbor information existing in the current routing device is specifically information of a two-layer network device (such as a switch or other device with a switching function) directly connected to the current routing device, specifically an ID of the two-layer network device, an identifier and a MAC address of a port connected to the current routing device on the two-layer network device, and the like. Generally, if a current routing device is in a two-layer network and at least one two-layer network device is connected, the current routing device must have corresponding neighbor information, and if the current routing device is not in the two-layer network; or if no two-layer network device is connected, for example, a PC terminal in a two-layer network is connected, the current routing device does not have neighbor information, so that, in this step 103, it can be easily determined whether the current routing device is in the two-layer network, and whether the current routing device is connected to the two-layer network device or the PC terminal by querying whether the current routing device has neighbor information.
From the descriptions in step 101 to step 102, it can be seen that the current routing device is in a three-layer network, and from the description in step 103, if there is neighbor information in the current routing device, it indicates that the current routing device is still in a two-layer network. That is, if neighbor information exists in the current routing device, it indicates that the current routing device can be in two networks at the same time, i.e., in a three-layer network and a two-layer network at the same time.
And step 104, acquiring the two-layer network topology structure collected by the current routing equipment.
Here, the operation of collecting the two-layer network topology by the current routing device in step 104 may be implemented in various ways, for example, collecting according to the existing discovery of the two-layer network topology, or collecting according to the clustering protocol provided by H3C, and the embodiment of the present invention is not limited in particular.
As can be seen from the operations shown in fig. 1, the operations in steps 101 to 102 are collection of three-layer network topologies, and the operation in step 104 is collection of two-layer network topologies, and the collection of three-layer network topologies and the collection of two-layer network topologies can be integrated through step 103, thereby avoiding the prior art that two sets of network topology discovery methods which are separated from each other and both rely on user triggering are used for collecting the topology of the whole network.
The method provided by the embodiment of the invention is briefly described above, and in order to make the objects, technical solutions and advantages of the invention clearer, the invention is described in detail below with reference to the accompanying drawings and specific embodiments.
Referring to fig. 2, fig. 2 is a basic flow chart provided by the embodiment of the invention. As shown in fig. 2, the process may include the following steps:
Each routing device is generally represented by corresponding identification information, where the identification information may specifically be an IP address of the routing device or other information for uniquely identifying the routing device, and embodiments of the present invention are not limited in particular.
In the initial stage, identification information of a routing device serving as a default gateway in the network or identification information of a routing device specified in advance by a user is put in the U1, and the U2 and the U3 are empty sets.
Here, since U1 is not an empty set in the initial stage, if it is an empty set in U1, it indicates that the collection of the three-layer network topology is completed currently, as described in step 207 below.
At step 204, the current identification information is deleted from U1, and execution returns to step 202.
Here, step 204 is performed in step 203 in which it is determined that the current identification information exists in U2. Since U2 is the set of accessed router id information, and the current id information existing in U2 indicates the router (denoted as the current router) corresponding to the accessed current id information, the present step 204 does not repeat accessing the current router, i.e., the following operations from step 205 to step 216 are not repeated, but the process returns to step 202.
Here, step 205 is performed in step 203 in which it is determined that the current identification information does not exist in U2. U2 is a set of accessed router id information, and the absence of the current id information in U2 indicates that the router corresponding to the current id information (denoted as the current router) has not been accessed yet since the current id information does not exist in U2, and therefore, when the step 205 is executed, the current router needs to be accessed.
And step 206, traversing the routes in the acquired IP routing table, and recording the currently traversed routes as the current routes.
here, step 208 is executed when it is determined that the type of the current route is an indirect route, and since the indirect route indicates that the current routing device is directly connected to the routing device represented by the next-hop IP address of the current route, this step 208 acquires the next-hop IP address of the traversed route, mainly for convenience of determining a three-layer network topology, specifically: and determining which routing device the current routing device is directly connected with.
In this embodiment, if the IP address is used as the identification information of the routing device, in this step 208, it is not necessary to obtain the identification information of the routing device corresponding to the next-hop IP address of the current route, but it is directly determined whether the next-hop IP address of the current route exists in U1, and it can be seen that the implementation is relatively simple in this embodiment when the IP address is used as the identification information of the routing device.
In step 209, the acquired identification information of the routing device is put into U1, and then step 210 is executed.
So far, the operation performed when the type of the current route is the indirect route is finished.
Here, step 211 is executed when the type of the current route is determined to be the direct route, and since the direct route indicates that the current routing device is directly connected to the two-layer network, this step 211 needs to obtain the next-hop IP address and the subnet mask of the current route, so as to determine which two-layer network the current routing device is directly connected to at all.
In this step 213, if U3 is an empty set, the process returns to step 202.
Here, according to the description in step 103, it can be known that, if there is neighbor information on the current routing device, the current routing device is still in the two-layer network and a two-layer network device is definitely connected below the current routing device, otherwise, it can only be determined that a PC terminal is connected below the current routing device. Wherein, the neighbor information existing in the current routing device is sent by the two-layer network device connected downwards; there are various implementations of how to send, such as: the embodiment is not particularly limited according to the Neighbor Discovery Protocol (NDP) included in the cluster Protocol for collecting the two-layer network topology in H3C, or according to the Link Layer Discovery Protocol (LLDP), or according to the Neighbor Discovery Protocol (CDP) of cisco.
The NDP included in the clustering protocol for collecting two-layer network topologies from H3C is taken as an example to describe how to send neighbor information. In the network, if a device supports the NDP, the NDP starts to operate when the device is started, where the device may be a two-layer network device, or a routing device that is in a three-layer network and has a function of the two-layer network device (e.g., a function of a switch). Thus, when the device is started, if the device supports the NDP, the device running the NDP can regularly send the NDP messages carrying the NDP information through all activated ports included in the device, and simultaneously receive and store the NDP messages sent by the neighbor devices; the format of the NDP packet is shown in table 1 below: TABLE 1
Destination MAC Address (6bytes) | Source MAC Address (6bytes) | Protocol type value 0x88A7(2bytes) | NDP message (4bytes) | Message payload | Check word (4bytes) |
The packet payload may include an ID of a device that sends the NDP packet, an identifier of a port where the device currently sends the NDP packet, and the like, so that if the current routing device and a layer-two network device connected to the current routing device run the NDP, the current routing device may have neighbor information related to a layer-two network device connected to the current routing device.
Here, the value of the flag bit (hgmpCmdlanswitchFlag) defined in advance includes a first value indicating that the current routing device is a management device for collecting the two-layer network topology and a second value indicating that the current routing device is not a management device for collecting the two-layer network topology; for convenience of description, the present embodiment will be described by taking the first value as True and the second value as False as an example. Usually, the value of the flag is stored in the MIB defined by SNMP, so that, when the step 214 is executed, the value of the predefined flag stored in the MIB can be read by Get operation defined by SNMP. If the value of the flag bit read is True, it indicates that the current routing device is a management device that explicitly collects a two-layer network topology structure, and further indicates that the current routing device has collected a two-layer network topology structure, so step 215 may be directly performed; if the value of the flag bit is False, it indicates that the current routing device has not started the operation of collecting the two-layer network topology, and therefore step 216 needs to be executed.
It can be seen that step 214 may be substantially a specific implementation manner provided in this embodiment for determining whether the current routing device has collected the topology structure of the two-layer network, but of course, there are other implementation manners in this embodiment of the present invention, for example, directly reading the topology structure of the two-layer network, and if so, it indicates that the current routing device has collected the topology structure of the two-layer network; otherwise, it means that the current routing device has not collected the topology of the two-layer network by now. Accordingly, the illustration in FIG. 2 is for exemplary purposes only and is not intended to limit the application of embodiments of the present invention.
In step 215, the two-layer network topology structure collected by the current routing device is obtained, and then the process returns to execute step 202.
Here, after acquiring the two-tier network topology, in order to save memory resources, the IP address and subnet mask in U3 may be deleted, i.e., U3 is cleared. Thus, it can be seen that the illustration in FIG. 2 is only an example and is not limiting of the application of the embodiments of the present invention.
In this embodiment, if a cluster protocol of H3C is taken as an example to collect a two-layer network topology, the cluster protocol mainly includes: NDP and Neighbor Topology Discovery Protocol (NTDP), the specific operation of the current routing device to collect the two-layer network topology structure in step 215 may include: a, current routing equipment sends an NTDP request message to two-layer network equipment corresponding to a preset hop number through a port of the current routing equipment, wherein the NTDP request message carries a source address and a destination address, the source address is the address of the current routing equipment, and the destination address is the address of the equipment corresponding to the preset hop number; b, if the two-layer network equipment receiving the NTDP request message supports the NTDP, carrying neighbor information (particularly NDP information) currently existing per se in a response message and sending the response message to the current routing equipment, and copying the NTDP request message to all the neighbor equipment; and C, after the neighbor equipment receives the NTDP request message, if the neighbor equipment supports the NTDP, executing according to the operation of the two-layer network equipment in the step B, and repeating the steps, wherein each network equipment supporting the NTDP receives the NTDP request message and sends a response message responding to the NTDP request message to the current routing equipment. Thus, through the steps a to C, the current routing device can obtain the two-layer network topology structure according to the received response message.
For example, the current routing device determines, according to the NDP information in the response message, that the two-layer network topology is as follows:
wherein, the content in [ ] represents the identification information of the layer-two network device (such as the name and address of the layer-two network device), < - > represents the connection identification (connectitflag), () and is the port information, such as: [ kk _0.1sw1:000f-e223-2323] (p _0/21) < - > (p _0/21) [ kk _5.1sw6:00e0-fc3d-b89d ] indicates that the MAC address is 000f-e223-2323, and the two-layer network equipment with the name of kk _0.1sw1 is directly connected with ports p _0/21 on the two-layer network equipment with the names of kk _5.1sw6, wherein the ports p _0/21 on the two-layer network equipment are respectively provided with the MAC address of 00e 0-3 d-b89d and the name of kk _5.1sw 6.
Here, if the embodiment takes the cluster protocol of H3C as an example to collect the two-layer network topology, in this step 216, when the current routing device collects the two-layer network topology, the current routing device needs to be configured as follows, specifically: allocating an unused IP Address (IP Address) and an unused IP Address Mask (IP Address Mask) to the current routing device, so as to serve as a private Address (hgmpmngpiipsegsegcmip) and a private Mask (hgmpmngpiipslag) of the current routing device, and setting a name (hgmpCmdClusterName) of a cluster managed by the current routing device, so that a value of a flag bit on the current routing device is True, which may be described by the following codes:
and setting hgmpmngpisipsegcmip ═ IP Address > of the current routing equipment.
And setting hgmpmngpisipmack ═ IP Address Mask > of the current routing equipment.
And setting the hgmpCmdClusterName of the current routing equipment as < Cmd Cluster Name >.
And setting hgmpcmdleanswitchflag to True of the current router.
After the above setting is completed, the current routing device may start NTDP to collect the two-layer network topology, see the collection process in step 215. Since it takes a certain time for the current routing device to acquire the two-layer network topology structure by using the NTDP, when the step 216 is executed, a certain time needs to be waited, specifically, the time preset in the step 216, where the time may be the time required for collecting the two-layer network topology structure by using the NTDP.
It should be noted that, after acquiring the two-layer network topology in step 216, in order to save storage resources, the IP address and the subnet mask in U3 may be deleted, that is, U3 is cleared. Thus, it can be seen that the illustration in FIG. 2 is only an example and is not limiting of the application of the embodiments of the present invention.
Therefore, the network topology discovery process provided by the embodiment of the invention is realized.
As can be seen from the above description, the operations in steps 201 to 212 are mainly collection operations of a three-layer network topology, that is, connection relationships between the current routing device and other routing devices and between the current routing device and a two-layer network are determined, and steps 215 to 216 are collection operations of a two-layer network topology, that is, connection relationships between two-layer network devices and between a two-layer network device and a bridge are determined; and the step 213 to the step 214 are bridges formed by integrating the collecting operation of the three-layer network topology structure and the collecting operation of the two-layer network topology structure, so that the condition that two sets of network topology discovery modes which are separated from each other and depend on user triggering are adopted to collect the topology structure of the whole network in the prior art is avoided.
It should be noted that the above step 213 is executed after completing the traversal of all routes in the IP routing table. Preferably, in this embodiment, step 213 may also be executed when it is determined in step 211 that U3 does not have the acquired next hop IP address and subnet mask, or when the acquired next hop IP address and subnet mask are put into U3 in step 212, in which case step 213 is replaced with: directly using SNMP to inquire whether neighbor information exists on the current routing device, if yes, determining that a two-layer network device is connected under the current routing device, and then executing step 214; otherwise, it is determined that the PC terminal in the two-layer network is connected to the current routing device, the next route of the current route in the IP routing table is continuously traversed, the next route is taken as the current route, and the step 207 is executed. It will be appreciated that the illustration of FIG. 3 is merely an example and is not intended to limit the application of embodiments of the present invention.
The method provided by the embodiment of the invention is described above, and the device provided by the embodiment of the invention is described in detail below.
Referring to fig. 3, fig. 3 is a block diagram of an apparatus according to an embodiment of the present invention. As shown in fig. 3, the apparatus includes: an acquisition unit 301, a judgment unit 302 and a topology collection unit 303;
the acquiring unit 301 is configured to acquire an IP routing table of a current routing device in a process of collecting a three-layer network topology structure, where the IP routing table includes at least one route, and each route includes a next-hop IP address, a subnet mask, and a route type;
the determining unit 302 is configured to traverse the route in the IP routing table, and determine whether the type of the currently traversed route is a direct route, where the direct route indicates that the current routing device is directly connected to a two-layer network corresponding to the next-hop IP address and the subnet mask of the current route;
when the determination result of the determining unit 302 is yes, the topology collecting unit 303 queries whether the current routing device has neighbor information, and if so, determines that the current routing device is in a two-layer network and at least one two-layer network device is connected below the current routing device; and acquiring the topological structure of the two-layer network collected by the current routing equipment.
Here, the neighbor information existing in the current routing device is specifically information of a two-layer network device (such as a switch or other device with a switching function) directly connected to the current routing device, specifically an ID of the two-layer network device, an identifier and a MAC address of a port connected to the current routing device on the two-layer network device, and the like. In general, if a current routing device is connected to a two-layer network device, it will certainly have corresponding neighbor information, and if the current routing device is not connected to a two-layer network device but is connected to a PC terminal in a two-layer network, the current routing device will not have neighbor information, and therefore, the topology collecting unit 303 can easily determine whether the current routing device is currently connected to a two-layer network device or a PC terminal by inquiring whether the current routing device has neighbor information.
Preferably, as shown in fig. 3, the obtaining unit 301 may include: a first judging module 3011, a second judging module 3012, and a first obtaining module 3013.
The first determining module 3011 is configured to determine whether a predefined to-be-accessed routing device identification information set U1 is an empty set, and if not, determine first identification information in U1 as current identification information;
the second judging module 3012 is configured to judge whether the current identifier exists in a predefined set U2 of accessed routing device identifiers, and if so, delete the current identifier from U1, and trigger the first judging module 3011 to continue to execute the judging operation;
the first obtaining module 3013 is configured to, if the determination result of the second determining module 3112 is negative, put the current identification information in the U2, and read the IP routing table of the current routing device corresponding to the current identification information through SNMP.
In this embodiment, as shown in fig. 3, the apparatus may further include: a first processing unit 304.
The first processing unit 304 is configured to, when the determining unit 302 determines that the type of the current route is the direct route, obtain a next hop IP address and a subnet mask of the current route, determine whether the obtained next hop IP address and subnet mask exist in a predefined subnet set U3, if the obtained next hop IP address and subnet mask do not exist, put the obtained next hop IP address and subnet mask into U3, traverse the next route of the current route, and trigger the determining unit 302 to continue to determine whether the type of the currently traversed route is the operation of the direct route until all routes in the IP routing table are traversed; if the type of the currently traversed route is the direct route, traversing the next route of the currently traversed route, and triggering the judging unit 302 to continuously judge whether the type of the currently traversed route is the direct route until all the routes in the IP routing table are traversed;
the topology collection unit 303 may include: a query module 3031, a topology collection module 3032 and a processing module 3033.
The query module 3031 is configured to determine whether U3 is an empty set after the determining unit 302 completes traversal of all routes in the IP routing table, and if not, query whether neighbor information exists in the current routing device;
when the query module 3031 queries the neighbor information, the topology collection module 3032 determines whether the current routing device has collected a two-layer network topology structure, and if so, acquires the two-layer network topology structure collected by the current routing device, otherwise, enables the current routing device to collect the two-layer network topology structure and acquire the two-layer network topology structure collected by the current routing device;
the processing module 3033 is configured to delete the next-hop IP address and the subnet mask in U3 after the topology collection module 3032 obtains the two-layer network topology structure collected by the current routing device.
Preferably, if the query module 3031 queries that there is no neighbor information on the current routing device, it determines that a PC terminal in a two-layer network is connected below the current routing device, and triggers the first determining module 3011 to perform the determining operation.
In this embodiment, if the determining unit 302 determines that the type of the current route is an indirect route, the indirect route is used to indicate that the current routing device is directly connected to a routing device corresponding to a next hop IP address of the route; the apparatus further comprises: a second processing unit 305.
The second processing unit 305 determines whether the identification information of the routing device corresponding to the next hop IP address of the current route exists in U1, if not, the identification information is placed in U1, then the next route of the current route is traversed, and the trigger determining unit 302 continues to determine whether the type of the currently traversed route is a direct route until all routes in the IP routing table are traversed; otherwise, traverse the next route of the current route, and trigger the determining unit 302 to continue to determine whether the type of the currently traversed route is the operation of direct route, until all the routes in the IP routing table are traversed.
It can be seen from the foregoing technical solutions that, in the network topology discovery method and device provided in the embodiments of the present invention, the topology structure of the entire network can be automatically collected by a unified method, so that it is avoided that two sets of network topology discovery methods that are separated from each other and both depend on user triggering are used to collect the topology structure of the entire network in the prior art, and the purpose of obtaining the topology structure of the entire network by using a unified network topology discovery method is achieved.
Furthermore, when the whole network topology structure is obtained, the embodiment of the invention does not need to manually configure the IP information and the SNMP information for the two-layer network equipment, reduces the network management and configuration workload, and is very suitable for small and medium-sized enterprises to realize the mode of displaying the topology of the network equipment in a plug-and-play manner.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.
Claims (14)
1. A method for discovering a network topology, the method comprising the steps of:
a, in the process of collecting a three-layer network topological structure, acquiring an IP routing table of current routing equipment, wherein each route in the IP routing table comprises a next hop IP address, a subnet mask and a route type;
b, traversing the route in the IP routing table, and judging whether the type of the currently traversed route is a direct route, wherein the direct route indicates that the current routing equipment is directly connected with a two-layer network corresponding to the next-hop IP address and the subnet mask of the current route, and if so, executing the step C;
c, inquiring whether the current routing equipment has neighbor information, wherein the neighbor information is information of two-layer network equipment directly connected with the current routing equipment, if yes, determining that the current routing equipment is still in a two-layer network, and at least one two-layer network equipment is connected below the current routing equipment; and acquiring the topological structure of the two-layer network collected by the current routing equipment.
2. The method of claim 1, wherein a set of identification information U1 of routing devices to be accessed is predefined, and the U1 pre-sets identification information of routing devices serving as default gateways or identification information of pre-specified routing devices in the network;
the obtaining the IP routing table of the current routing device in the step a includes:
a1, judging whether U1 is an empty set, if not, determining the first identification information in U1 as the current identification information;
a2, judging whether the current identification information exists in a predefined accessed routing device identification information set U2, if yes, deleting the current identification information from U1, and returning to execute the step A1; otherwise, the current identification information is placed in U2, and step A3 is executed;
a3, reading the IP routing table of the current routing device corresponding to the current identification information through a Simple Network Management Protocol (SNMP).
3. The method according to claim 2, wherein in the step B, after determining that the type of the current route is the direct route, and before performing the step C, the method further comprises:
b00, obtaining the next hop IP address and the subnet mask of the current route, judging whether the obtained next hop IP address and the subnet mask exist in a predefined subnet set U3, if not, executing the step B01; if so, perform step B02;
b01, placing the obtained next hop IP address and subnet mask into U3, and then executing step B02;
b02, traversing the next route of the current route, and returning to the operation of judging whether the type of the currently traversed route is the direct route in the step B until all the routes in the IP routing table are traversed;
the query in the step C comprises: if all the routes in the IP routing table are traversed, judging whether the U3 is an empty set, if not, executing the query;
after the step C of obtaining the two-layer network topology structure collected by the current routing device, the method further includes: the next hop IP address and subnet mask in U3 are deleted.
4. The method according to claim 2, wherein in the step C, if it is queried that there is no neighbor information on the current routing device, it is determined that the current routing device is connected with a PC terminal in a two-layer network thereunder, and then the step a1 is executed in a returning manner.
5. The method according to claim 2, wherein in the step B, if it is determined that the type of the current route is an indirect route, the indirect route is used to indicate that the current routing device is directly connected to a routing device corresponding to a next hop IP address of the route; further comprising:
b11, judging whether the identification information of the routing device corresponding to the next hop IP address of the current route exists in U1, if not, executing the step B12; otherwise, go to step B13;
b12, placing the identification information into U1, and then executing step B13;
b13, traversing the next route of the current route, and returning to the operation of judging whether the type of the currently traversed route is the direct route in the step B until all the routes in the IP routing table are traversed.
6. The method according to any one of claims 1 to 5, wherein in step B, the neighbor information existing on the current routing device is sent by a layer-two network device connected to the current routing device according to a neighbor discovery protocol, and the neighbor information includes an ID of the layer-two network device, an address of a port where the layer-two network device sends the neighbor information, and an identifier of the port.
7. The method according to any one of claims 1 to 5, wherein the obtaining in step C comprises:
and judging whether the current routing equipment collects the two-layer network topology structure or not, if so, acquiring the two-layer network topology structure collected by the current routing equipment, otherwise, enabling the current routing equipment to collect the two-layer network topology structure, and acquiring the two-layer network topology structure collected by the current routing equipment.
8. The method of claim 7, wherein determining whether the current routing device has collected a two-tier network topology comprises:
reading a value of a flag bit predefined on the current routing equipment through the SNMP, wherein the value of the flag bit is a first value which represents that the current routing equipment is used as management equipment for collecting the two-layer network topology structure or a second value which represents that the current routing equipment is not used as the management equipment for collecting the two-layer network topology structure;
judging whether the value of the read zone bit is a first value or a second value, and if the value of the read zone bit is the first value, determining that the current routing equipment has collected a two-layer network topology structure; if the value is the second value, the current routing device is determined not to collect the two-layer network topology.
9. The method of claim 8, wherein the step C, collecting the two-tier network topology by the current routing device comprises:
c1, the current route device sends the request message of neighbor topology discovery protocol to the two-layer network device corresponding to the preset hop count;
c2, if the two-layer network device receiving the request message supports the neighbor topology discovery protocol, the two-layer network device carries the neighbor information in the response message and sends the response message to the current routing device, and copies the request message to all neighbor devices;
and C3, when the neighbor device receives the request message, if the neighbor topology discovery protocol is supported, executing according to the operation of the two-layer network device in the step C2 until the collection of the two-layer network topology structure is completed.
10. A network topology discovery device, the device comprising: the device comprises an acquisition unit, a judgment unit and a topology collection unit; wherein,
the acquiring unit is used for acquiring an IP routing table of the current routing equipment in the process of collecting the three-layer network topology structure, wherein each route in the IP routing table comprises a next hop IP address, a subnet mask and a route type;
the judging unit is used for traversing the route in the IP routing table and judging whether the type of the currently traversed route is a direct route, wherein the direct route is used for indicating that the current routing equipment is directly connected with a two-layer network corresponding to the next-hop IP address and the subnet mask of the route;
the topology collection unit queries whether the current routing device has neighbor information when the judgment result of the judgment unit is yes, wherein the neighbor information is information of two-layer network devices directly connected with the current routing device, and if yes, the topology collection unit determines that the current routing device is still in a two-layer network and at least one two-layer network device is connected below the current routing device; and acquiring the topological structure of the two-layer network collected by the current routing equipment.
11. The apparatus of claim 10, wherein the obtaining unit comprises:
the first judgment module is used for judging whether a predefined to-be-accessed routing device identification information set U1 is an empty set, and if not, determining the first identification information in U1 as the current identification information;
a second judging module, configured to judge whether the current identifier exists in a predefined visited routing device identifier set U2, and if so, delete the current identifier from U1, and trigger the first judging module to continue to execute the judging operation;
and the first obtaining module is configured to, if the determination result of the second determining module is negative, place the current identification information in U2, and read an IP routing table of the current routing device corresponding to the current identification information through a simple network management protocol SNMP.
12. The apparatus of claim 11, further comprising:
the first processing unit is used for acquiring a next hop IP address and a subnet mask of the current route when the judging unit judges that the type of the current route is the direct route, judging whether the acquired next hop IP address and the subnet mask exist in a predefined subnet set U3, if not, putting the acquired next hop IP address and the subnet mask into U3, traversing the next route of the current route, and triggering the judging unit to continuously judge whether the type of the currently traversed route is the direct route until all the routes in an IP route table are traversed; if the type of the currently traversed route is the direct route, traversing the next route of the currently traversed route, and triggering the judging unit to continuously judge whether the type of the currently traversed route is the direct route until all the routes in the IP routing table are traversed.
13. The apparatus of claim 12, wherein the topology collection unit comprises:
the query module is used for judging whether the U3 is an empty set or not after the judgment unit finishes traversing all the routes in the IP routing table, and if not, querying whether the current routing equipment has neighbor information or not; if the neighbor information does not exist on the current routing equipment, determining that the PC terminal in a two-layer network is connected below the current routing equipment, and triggering the first judgment module to execute judgment operation;
the topology collection module judges whether the current routing equipment collects a two-layer network topology structure or not when the query module queries neighbor information, and if so, the topology collection module acquires the two-layer network topology structure collected by the current routing equipment, otherwise, the topology collection module enables the current routing equipment to collect the two-layer network topology structure and acquires the two-layer network topology structure collected by the current routing equipment;
and the processing module is used for deleting the next hop IP address and the subnet mask in the U3 after the topology collection module acquires the two-layer network topology structure collected by the current routing device.
14. The apparatus according to claim 11, wherein if the determining unit determines that the type of the current route is an indirect route, the indirect route is used to indicate that the current routing apparatus is directly connected to a routing apparatus corresponding to a next hop IP address of the route; the apparatus further comprises:
the second processing unit is used for judging whether the identification information of the routing equipment corresponding to the next-hop IP address of the current route exists in the U1 or not, if not, the identification information is put into the U1, then the next route of the current route is traversed, and the judging unit is triggered to continuously judge whether the type of the currently traversed route is the direct route or not until all the routes in the IP routing table are traversed; otherwise, traversing the next route of the current route, and triggering the judging unit to continuously judge whether the type of the currently traversed route is the operation of direct route until all the routes in the IP routing table are traversed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2009102364158A CN102045190B (en) | 2009-10-21 | 2009-10-21 | Network topology discovery method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2009102364158A CN102045190B (en) | 2009-10-21 | 2009-10-21 | Network topology discovery method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102045190A CN102045190A (en) | 2011-05-04 |
CN102045190B true CN102045190B (en) | 2013-01-02 |
Family
ID=43911007
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2009102364158A Expired - Fee Related CN102045190B (en) | 2009-10-21 | 2009-10-21 | Network topology discovery method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102045190B (en) |
Families Citing this family (24)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2012149794A1 (en) * | 2011-09-30 | 2012-11-08 | 华为技术有限公司 | Automatic network topology discovery method, apparatus, and system |
CN102907052A (en) * | 2012-08-02 | 2013-01-30 | 华为技术有限公司 | Method and device for processing topology information |
CN102833113B (en) * | 2012-09-03 | 2015-08-19 | 南方电网科学研究院有限责任公司 | Substation Ethernet communication network monitoring method and system |
CN103874105B (en) * | 2012-12-10 | 2017-09-08 | 中国移动通信集团公司 | A kind of route tracing method, system and a kind of gateway device |
CN103905314A (en) * | 2012-12-28 | 2014-07-02 | 上海斐讯数据通信技术有限公司 | Comprehensive network topology discovery method |
CN103117880A (en) * | 2013-02-22 | 2013-05-22 | 浪潮电子信息产业股份有限公司 | Web technology based network topological generation method |
CN103532741B (en) * | 2013-09-27 | 2016-09-07 | 瑞斯康达科技发展股份有限公司 | A kind of access level network topology management method and system |
CN104486120A (en) * | 2014-12-16 | 2015-04-01 | 上海斐讯数据通信技术有限公司 | Network topology display method and device |
CN105187314B (en) * | 2015-06-15 | 2018-02-09 | 国家电网公司 | A kind of implementation method of the discovery reserve link based on three-layer network route |
CN105978815B (en) * | 2016-05-09 | 2020-01-07 | 上海斐讯数据通信技术有限公司 | A method for obtaining network distribution of routing equipment |
CN106411748B (en) * | 2016-10-08 | 2019-08-06 | 电子科技大学 | A Cross-Network Dynamic Topology Maintenance Method |
CN106789161B (en) * | 2016-11-24 | 2020-04-10 | 北京无线电测量研究所 | VPX system-based RapidIO route configuration device and method |
CN107104824B (en) * | 2017-03-31 | 2019-12-06 | 新华三信息技术有限公司 | Network topology determination method and device |
CN107612751A (en) * | 2017-10-27 | 2018-01-19 | 迈普通信技术股份有限公司 | Acquisition methods, device, the network equipment and the storage medium of gateway |
CN108282362B (en) * | 2017-12-29 | 2021-05-14 | 武汉璞华大数据技术有限公司 | Network topology generation method, device and equipment |
CN111355599B (en) * | 2018-12-20 | 2023-02-03 | 北京国基科技股份有限公司 | Hybrid network topology discovery method and device |
CN109951321A (en) * | 2019-02-25 | 2019-06-28 | 贵州电网有限责任公司 | A kind of substation's station level network topology analytical method, device and storage medium |
CN110912751A (en) * | 2019-12-03 | 2020-03-24 | 山东中创软件商用中间件股份有限公司 | Network equipment topological graph generation method and related device |
CN111565117A (en) * | 2020-04-09 | 2020-08-21 | 烽火通信科技股份有限公司 | Topology discovery method and system based on SNMP |
CN113542192B (en) * | 2020-04-14 | 2023-09-05 | 中国移动通信集团浙江有限公司 | Illegal network device access detection method, device, computing device and storage medium |
CN112751714B (en) * | 2020-12-31 | 2023-03-24 | 杭州海康威视系统技术有限公司 | Method, apparatus and computer storage medium for determining network topology |
CN113612646B (en) * | 2021-08-30 | 2022-08-02 | 复旦大学 | A campus network topology visualization method based on neighbor discovery |
CN114567590B (en) * | 2022-03-03 | 2023-06-16 | 锐捷网络股份有限公司 | Topology structure generation method, device, equipment and storage medium |
CN115695204B (en) * | 2022-10-09 | 2025-01-10 | 湖南天冠电子信息技术有限公司 | Method, system and storage medium for automatically discovering network device |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1756189A (en) * | 2004-09-30 | 2006-04-05 | 北京航空航天大学 | SNMP-based IP Network Topology Discovery Method |
EP1802048A1 (en) * | 2004-10-12 | 2007-06-27 | Huawei Technologies Co., Ltd. | A method for implementing topology structure automatic discovery in the mpls ring network |
CN101459534A (en) * | 2008-12-03 | 2009-06-17 | 福建星网锐捷网络有限公司 | Network topology collecting method for tree shaped network and network equipment |
-
2009
- 2009-10-21 CN CN2009102364158A patent/CN102045190B/en not_active Expired - Fee Related
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1756189A (en) * | 2004-09-30 | 2006-04-05 | 北京航空航天大学 | SNMP-based IP Network Topology Discovery Method |
EP1802048A1 (en) * | 2004-10-12 | 2007-06-27 | Huawei Technologies Co., Ltd. | A method for implementing topology structure automatic discovery in the mpls ring network |
CN101459534A (en) * | 2008-12-03 | 2009-06-17 | 福建星网锐捷网络有限公司 | Network topology collecting method for tree shaped network and network equipment |
Also Published As
Publication number | Publication date |
---|---|
CN102045190A (en) | 2011-05-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102045190B (en) | Network topology discovery method and device | |
WO2022037322A1 (en) | Network topology management system and method for home networking | |
CN107733670B (en) | A forwarding strategy configuration method and device | |
CN101330405B (en) | Method for discovering network topology and related equipment | |
CN103179228B (en) | Internet protocol address resolution method and edge node | |
CN101621414B (en) | Method and apparatus for discovering network resource and topology | |
CN105991334B (en) | A kind of network topology self-discovery method and device | |
CN108880899B (en) | A method and server for generating a network topology map | |
CN107733713B (en) | Method, system, device and storage medium for acquiring network topology in hybrid network | |
CN113452561B (en) | Topology generation method, device, equipment and readable storage medium | |
CN113098770B (en) | Message sending method, routing table item generation method, device and storage medium | |
TW200522587A (en) | Network device discovery system and method thereof | |
CN100425024C (en) | IPv6 Internet network topology automatic discovery method | |
EP1909437A1 (en) | A method for forwarding service of the data communication device and the forwarding apparatus | |
CN113542015A (en) | Method for automatically drawing network physical link | |
CN104579978B (en) | A kind of dynamic network Datalink Layer Topology Discovery method | |
CN1558615A (en) | A physical network topology discovery system and method thereof | |
JP5508273B2 (en) | Network location service | |
CN113098749B (en) | Message sending method, device and storage medium | |
CN102437960B (en) | Detection processing method and system of cluster mode, and network equipment | |
US20040215781A1 (en) | Techniques for determining device connectivity in a network using protocol-specific connectivity information | |
CN114666227B (en) | A method for network topology detection under non-cooperative conditions | |
US7733800B2 (en) | Method and mechanism for identifying an unmanaged switch in a network | |
CN101227336A (en) | Method and device for configuring link layer discovery protocol management address | |
CN104579979A (en) | Network topology discovery method based on MAC information |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CP03 | Change of name, title or address | ||
CP03 | Change of name, title or address |
Address after: 310052 Binjiang District Changhe Road, Zhejiang, China, No. 466, No. Patentee after: Xinhua three Technology Co., Ltd. Address before: 310053 Hangzhou hi tech Industrial Development Zone, Zhejiang province science and Technology Industrial Park, No. 310 and No. six road, HUAWEI, Hangzhou production base Patentee before: Huasan Communication Technology Co., Ltd. |
|
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20130102 Termination date: 20201021 |