Disclosure of Invention
The invention provides a method and a device for discovering MPLS VPN network topology, which can show the overall topology structure of a network and facilitate management personnel to manage the network.
In order to achieve the purpose, the invention adopts the following technical scheme:
in a first aspect, the present invention provides a method for discovering a topology of an MPLS VPN network, where the method includes:
acquiring configuration information of each network device; the configuration information includes: LDP (Label distribution protocol) configuration information and VRF (Virtual Routing Forwarding Instance) configuration information; the VRF configuration information includes: interface information and RT parameters;
determining the type of network equipment according to configuration information of the network equipment, wherein the type of the network equipment comprises a backbone network core router P and a backbone network edge router PE;
determining the connection relation between P and PE and different P in the network according to the type of each network device and the LDP configuration information of each network device;
when the network equipment is a PE, determining a customer edge router (CE) connected with the PE according to interface information in VRF configuration information of the PE; determining the connection relation between different PEs according to the RT parameters in the VRF configuration information of the PEs;
and generating a topological graph according to the connection relation among the P, the PE and the CE in the network.
In a second aspect, the present invention provides an apparatus for MPLS VPN network topology discovery, the apparatus comprising:
the acquisition module is used for acquiring the configuration information of each network device; the configuration information includes: LDP configuration information and VRF configuration information; the VRF configuration information includes: interface information and RT parameters;
the identification module is used for determining the type of the network equipment according to the configuration information of the network equipment acquired by the acquisition module, wherein the type of the network equipment comprises a backbone network core router P and a backbone network edge router PE;
the determining module is used for determining the connection relation between P and PE and different P in the network according to the type of each network device and the LDP configuration information of each network device; when the network equipment is a PE, determining a customer edge router (CE) connected with the PE according to interface information in VRF configuration information of the PE; determining the connection relation between different PEs according to the RT parameters in the VRF configuration information of the PEs;
and the generating module is used for generating a topological graph according to the connection relation among the P, the PE and the CE in the network.
The invention provides a method and a device for discovering MPLS VPN network topology, which determine the type of network equipment by acquiring the configuration information of the network equipment and according to the configuration information of the network equipment; determining the connection relation between P and PE and different P according to the type of the network equipment and the LDP configuration information of the network equipment; determining a connection relationship between a PE and a CE (Customer Edge, Customer Edge router) according to interface information of VRF configuration information of network equipment; determining the connection relation between different PEs according to the RT parameters in the VRF configuration information of the network equipment; therefore, a topological graph is generated according to the connection relation among the P, the PE and the CE. Compared with the prior art that the generated topological graph can only show part of the connection relation of the network equipment, the topological graph generated by the invention contains all the connection relations of the network equipment in the network, so that a manager can realize comprehensive management on the MPLS VPN according to the topological graph generated by the invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As shown in fig. 1, the MPLS VPN includes: backbone core router 11, backbone edge router 12, customer side edge router 13. The backbone network core router 11 is responsible for forwarding data packets in the network. The backbone edge router 12 is used for storing VRF and processing VPN-IPv4 routing, and is the main body of VPN service processing. The core router of the backbone network and the edge router of the backbone network form a VPN backbone network. And the user side edge router 13 is used for issuing user network routes and connecting user sites (sites) with the VPN backbone network.
As shown in fig. 2, an embodiment of the present invention provides a method for discovering a topology of an MPLS VPN network, which is applied to the MPLS VPN shown in fig. 1, and an execution subject of the method is a network management system. The network management system is used for displaying a topological graph, detecting and analyzing the port state of the network equipment, diagnosing and alarming when the network equipment fails, and the like. The method comprises the following steps:
101. configuration information of each network device is obtained.
Wherein the configuration information comprises: LDP configuration information and VRF configuration information; the VRF configuration information includes: interface information and RT parameters.
In the specific implementation process, through a Simple Network Management Protocol (SNMP), the Network Management system accesses a Management Information Base (MIB) corresponding to each Network device, so as to obtain configuration information of each Network device.
102. And determining the type of the network equipment according to the configuration information of the network equipment.
Wherein the types of the network equipment comprise a backbone core router P and a backbone edge router PE.
In the specific implementation process, because the PE needs to store the VRF and is responsible for processing the VPN service, the configuration information of the PE contains VRF configuration information; and P is only responsible for forwarding the data message and is not responsible for processing the VPN service, so that the configuration information of P does not contain VRF configuration information. Therefore, a decision can be made based on the above analysis: when the configuration information of the network equipment contains VRF configuration information and LDP configuration information, determining that the type of the network equipment is PE; and when the configuration information of the network equipment contains LDP configuration information and does not contain VRF configuration information, determining that the type of the network equipment is P.
103. And determining the connection relation between P and PE and different P in the network according to the type of each network device and the LDP configuration information of each network device.
Wherein the LDP configuration information includes a routing table. The routing table includes: the next hop IP address.
In a specific implementation process, the adjacent network device can be determined according to the next hop IP address in the routing table of the network device. The network device has a connection relationship with an adjacent network device. Since the type of the network device has been determined in step 102, it can be determined whether the connection relationship is a connection relationship between a P and a PE or a connection relationship between different ps.
Illustratively, if the next hop address of the routing table of P determines that the neighboring network device is a PE, it is determined that a connection relationship exists between P and PE. Or, if the next hop address of the routing table of P determines that the neighboring network device is P, it determines that a connection relationship exists between the two different ps.
104. When the network equipment is a PE, determining a customer edge router (CE) connected with the PE according to interface information in VRF configuration information of the PE.
In a specific implementation process, since the interface information in the VRF configuration information of the PE is the interface information of the CE connected to the PE, the CE connected to the PE can be determined.
105. And determining the connection relation between different PEs according to the RT parameters in the VRF configuration information of the PEs.
Wherein, the RT parameter comprises: an export attribute and an import attribute.
In a specific implementation process, checking an export attribute and an import attribute of an RT parameter of the PE; and when the export attribute of one PE is the same as the import attribute of the other PE, determining that a connection relationship exists between the two PEs.
It should be noted that steps 103, 104, and 105 are not different from each other in order of execution.
106. And generating a topological graph according to the connection relation among the P, the PE and the CE in the network.
In a specific implementation process, different icons in the generated topological graph according to the embodiment of the present invention may represent P, PE, and CE, and different line segments may represent connection relationships between P and PE, between PE and CE, between different P, and between different PEs.
The embodiment of the invention provides a method for discovering the topology of an MPLS VPN network, which comprises the steps of obtaining configuration information of network equipment and determining the type of the network equipment according to the configuration information of the network equipment; determining the connection relation between P and PE and different P according to the type of the network equipment and the LDP configuration information of the network equipment; determining the connection relationship between the PE and the CE according to the interface information of the VRF configuration information of the network equipment; determining the connection relation between different PEs according to the RT parameters in the VRF configuration information of the network equipment; therefore, a topological graph is generated according to the connection relation among the P, the PE and the CE. Compared with the prior art that the generated topological graph can only show part of the connection relation of the network equipment, the topological graph generated in the embodiment of the invention contains all the connection relations of the network equipment in the network, so that a manager can realize comprehensive management on the MPLS VPN according to the topological graph generated in the embodiment of the invention.
Optionally, as shown in fig. 3, in a specific implementation manner of step 105, the step 105 specifically includes the following steps:
201. selecting one PE from all PEs, and checking the import attribute of the RT parameter in the VRF configuration information of the selected PE;
202. checking the export attribute of the RT parameter in the VRF configuration information of other PEs;
203. when the export attribute of the RT parameter of one PE in other PEs is the same as the import attribute of the RT parameter of the selected PE, determining that a connection relationship exists between the two PEs;
204. and repeating the steps 201 to 203 to traverse all the PEs and determine the connection relation among different PEs.
The connection relationship between different PEs can be determined through steps 201 to 204.
Network devices may be newly added to the network or network device failures may occur. These factors cause the topology of the network to change dynamically. The fixed topology does not faithfully reflect the topology of the current network. Therefore, the topological graph needs to be updated regularly, so that a manager can manage the current network by using the updated topological graph. On the basis of the method shown in fig. 2, another method for discovering a topology of an MPLS VPN network is provided in the embodiment of the present invention. As shown in fig. 4, after step 106, the method further comprises:
107. and acquiring the configuration information of all the network devices at regular time.
In the specific implementation process, the time interval for acquiring the configuration information at regular time is set by default of the system or actively set by a manager. It should be noted that the time interval should be set in consideration of the actual situation of the network, and is not set too long or too short. When the time interval is set to be too short, the configuration information of the network equipment is frequently acquired, so that burden is caused to the network; when the time interval is set too long, the administrator cannot effectively manage the current network because the topological structure of the network is not updated in time.
108. And judging whether the configuration information acquired this time is the same as the configuration information acquired last time.
109. And when the configuration information acquired twice is different, regenerating the topological graph according to the configuration information acquired this time.
The configuration information obtained twice is different, and the method specifically includes the following conditions: the configuration information obtained by the same network equipment twice is different; the configuration information of the newly added network equipment exists in the configuration information obtained this time; the configuration information acquired this time lacks the configuration information of the network device acquired last time.
In a specific implementation process, when the configuration information obtained twice is different, step 102 and step 106 may be repeated according to the configuration information obtained this time, so as to regenerate the topology map.
The method for discovering the topology of the MPLS VPN network provided by the embodiment of the invention acquires the configuration information of the network equipment at regular time, and regenerates a new topology map when the configuration information acquired twice is different. By the method, the topological structure of the current network can be timely reflected by the topological graph generated by the embodiment of the invention, so that a manager can manage the current network according to the topological graph generated by the embodiment of the invention.
As shown in fig. 5, an embodiment of the present invention provides an apparatus for discovering a topology of an MPLS VPN network, configured to perform the foregoing method for discovering a topology of an MPLS VPN network. The device comprises:
an obtaining module 21, configured to obtain configuration information of each network device; the configuration information includes: LDP configuration information and VRF configuration information; the VRF configuration information includes: interface information and RT parameters.
The identifying module 22 is configured to determine the type of the network device according to the configuration information of the network device acquired by the acquiring module 21, where the type of the network device includes a backbone core router P and a backbone edge router PE.
A determining module 23, configured to determine, according to the type of each network device and LDP configuration information of each network device, a connection relationship between P and PE in the network and between different ps; when the network equipment is a PE, determining a customer edge router (CE) connected with the PE according to interface information in VRF configuration information of the PE; and determining the connection relation between different PEs according to the RT parameters in the VRF configuration information of the PEs.
And a generating module 24, configured to generate a topological graph according to a connection relationship among P, PE, and CE in the network.
In a specific implementation procedure, the identifying module 22 is further configured to determine that the type of the network device is PE when the configuration information of the network device includes VRF configuration information and LDP configuration information; and when the configuration information of the network equipment contains LDP configuration information and does not contain VRF configuration information, determining that the type of the network equipment is P.
In one specific implementation, the RT parameters include: exporting an export attribute and importing an import attribute; the determining module 23 is further configured to view an export attribute and an import attribute of the RT parameter of the PE; and when the export attribute of one PE is the same as the import attribute of the other PE, determining that a connection relationship exists between the two PEs.
In a specific implementation process, the LDP configuration information includes a routing table; the routing table comprises a next hop address; the determining module 23 is further configured to determine an adjacent network device according to a next hop address in a routing table of the network device; the network equipment and the adjacent network equipment have a connection relation; and determining whether the connection relationship is the connection relationship between the P and the PE or the connection relationship between different P according to the types of the network equipment and the adjacent network equipment.
The embodiment of the invention provides a device for discovering the topology of an MPLS VPN network, which determines the type of network equipment by acquiring the configuration information of the network equipment and according to the configuration information of the network equipment; determining the connection relation between P and PE and different P according to the type of the network equipment and the LDP configuration information of the network equipment; determining the connection relationship between the PE and the CE according to the interface information of the VRF configuration information of the network equipment; determining the connection relation between different PEs according to the RT parameters in the VRF configuration information of the network equipment; therefore, a topological graph is generated according to the connection relation among the P, the PE and the CE. Compared with the prior art that the generated topological graph can only show part of the connection relation of the network equipment, the topological graph generated in the embodiment of the invention contains all the connection relations of the network equipment in the network, so that a manager can realize comprehensive management on the MPLS VPN according to the topological graph generated in the embodiment of the invention.
On the basis of the apparatus shown in fig. 5, the embodiment of the present invention provides another apparatus for discovering a topology of an MPLS VPN network. As shown in fig. 6, the apparatus further includes: and a judging module 25.
The obtaining module 21 is further configured to obtain configuration information of all network devices at regular time;
the judging module 25 is configured to judge whether the configuration information obtained this time is the same as the configuration information obtained last time;
the generating module 24 is further configured to, when the configuration information obtained twice is different, regenerate the topological graph according to the configuration information obtained this time.
The device for discovering the topology of the MPLS VPN network provided by the embodiment of the invention acquires the configuration information of the network equipment at regular time, and regenerates a new topology map when the configuration information acquired twice is different. By the method, the topological structure of the current network can be timely reflected by the topological graph generated by the embodiment of the invention, so that a manager can manage the current network according to the topological graph generated by the embodiment of the invention.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus embodiment, since it is substantially similar to the method embodiment, it is relatively simple to describe, and reference may be made to some descriptions of the method embodiment for relevant points.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above description is only for the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.