A method for collecting, judging and correcting NetFlow data in routers

Through the combination of NetFlow and SNMP protocols, the NetFlow data collection configuration of the router is automatically collected and determined, which solves the problem of difficult manual maintenance, realizes the configuration consistency of the router equipment and the accuracy of data statistics, judgment and error correction, and reduces maintenance work. quantity.

CN115941423BActive Publication Date: 2024-08-23BEIJING RUNSTONE TECH
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202211463275.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-22
Publication Date
2024-08-23
Estimated Expiration
2042-11-22

AI Technical Summary

Technical Problem

In the existing NetFlow data collection and analysis system, when there are a large number of router devices, it is difficult to manually maintain configuration information, which makes it difficult to judge and correct the reliability of data statistics results. In particular, configuration inconsistencies are prone to occur when network devices change frequently.

Method used

The combination of NetFlow protocol and SNMP protocol is used to automatically collect the traffic statistics log and interface description information of the router, determine the NetFlow data collection configuration in real time, determine the accuracy of the data statistics results and correct errors to ensure the configuration consistency between the system and the router equipment.

Benefits of technology

There is no need for manual maintenance by administrators. Automated maintenance reduces the workload and complexity of system maintenance, improves the accuracy and reliability of data statistics, and ensures the accuracy of traffic analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115941423B
    Figure CN115941423B
Patent Text Reader

Abstract

The present invention discloses a method for collecting, judging and correcting NetFlow data of a router, comprising: step 1) a NetFlow and SNMP interface data collection step: using the NetFlow protocol to collect the flow statistics log of the router, and using the SNMP protocol to collect the interface description information and flow information of the router as the benchmark data for the subsequent steps; step 2) a router NetFlow collection interface and direction judgment step; step 3) a data statistical result accuracy judgment and error correction step: based on the NetFlow data collection configuration of the router device, judging whether the data statistical analysis result is correct, and judging which erroneous results can be corrected, and performing error correction processing on the correctable results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a method for determining and correcting NetFlow data collection of a router, in particular to a method for automatically discovering NetFlow data collection configuration information of a router and determining and correcting the accuracy of traffic summary statistics results. Background Art

[0002] As a traffic statistics technology, NetFlow is widely used in traffic analysis scenarios such as IP network traffic flow analysis, abnormal traffic detection, and traffic metering and billing. The basic structure of the system for traffic analysis based on NetFlow technology is as follows: Figure 1 shown.

[0003] The overall structure of the NetFlow traffic collection and analysis system includes an IP network composed of routers and a NetFlow data collection and analysis system. The overall workflow of the system is as follows:

[0004] 1. According to the configuration of the system administrator, the network interface of the router in the IP network can sample the inflow or outflow direction of the traffic;

[0005] 2. The router collects statistics on the sampled traffic according to the fields required by the NetFlow protocol to form a traffic log, and sends the statistical results to the NetFlow data analysis and collection system through the network according to the NetFlow protocol;

[0006] 3. The NetFlow analysis and collection system parses the received data and completes subsequent data analysis.

[0007] In the above process, the network administrator needs to manually configure the network interface of the router, decide which network interface of the router to collect traffic statistics, and decide the direction of the corresponding network interface traffic collection. The collection direction includes three situations:

[0008] Only the inbound traffic of the network interface is sampled and counted.

[0009] Only the outbound traffic of the network interface is sampled and counted

[0010] Sampling and counting of bidirectional traffic flowing into and out of the network interface

[0011] To ensure the accuracy of traffic analysis, the NetFlow data collection and analysis system must accurately know the above configuration information and perform traffic deduplication operations to avoid repeated statistics of network traffic that may lead to errors in the analysis results.

[0012] by Figure 2Taking the scenario shown as an example, the router in the figure has three interfaces, namely interface 1, interface 2, and interface 3. The router forwards IP packets between the three interfaces according to the routing table query results. Each interface has inflow and outflow IP packet traffic.

[0013] The system administrator configures the NetFlow data collection for each interface of the router as follows:

[0014] Interface 1: Sampling and counting the inbound traffic;

[0015] Interface 2: Sampling and counting traffic in both the outbound and inbound directions;

[0016] Interface 3: No traffic sampling statistics are performed;

[0017] Under the above NetFlow data collection configuration, the traffic forwarded by the router between interfaces generates NetFlow logs as follows:

[0018] For each flow of traffic flowing in and out of interface 1: only one NetFlow traffic statistics log is generated on interface 1;

[0019] For each flow of traffic that flows in from interface 1 and out from interface 2: a NetFlow traffic statistics log is generated on interface 1, and an identical NetFlow traffic statistics log is generated on interface 2, resulting in a total of two NetFlow traffic statistics logs.

[0020] For each flow of traffic that flows in from interface 1 and out from interface 3: only one NetFlow traffic statistics log is generated on interface 1;

[0021] For each flow of traffic that flows in from interface 2 and out from interface 1: only one NetFlow traffic statistics log is generated on interface 2;

[0022] For each flow of traffic flowing in and out of interface 2: a NetFlow traffic statistics log is generated in the inflow direction of interface 2, and the same NetFlow traffic statistics log is generated in the outflow direction of interface 2, for a total of two NetFlow traffic statistics logs;

[0023] For each flow of traffic that flows in from interface 2 and out from interface 3: only one NetFlow traffic statistics log is generated on interface 2;

[0024] For each flow of traffic flowing in from interface 3 and out from interface 1: no NetFlow traffic statistics log will be generated;

[0025] For each flow of traffic that flows in from interface 3 and out from interface 2: only one NetFlow traffic statistics log is generated on interface 2;

[0026] For each flow of traffic flowing in and out of interface 3: no NetFlow traffic statistics log will be generated;

[0027] NetFlow data collection and analysis systems often collect statistics on the following two basic types of traffic based on the interface information carried in the above NetFlow logs:

[0028] Statistics type 1: Summarizes the forwarding traffic between any two interfaces. Figure 2 The traffic flowing in from interface 1 and out from interface 2 is summarized and counted; "Any two interfaces" can also try the same interface, for example Figure 2 The traffic flowing in from interface 1 and out from interface 1 is summarized and counted;

[0029] Statistics type 2: Summarizes the traffic in the inbound or outbound direction of any interface. Figure 2 The traffic in the inbound direction of interface 1 is summarized and counted, or the traffic outbound direction of interface 1 is summarized and counted;

[0030] If the NetFlow data collection and analysis system directly aggregates and counts the above two types of traffic based on the interface information carried in the above NetFlow logs, the following two types of statistical errors cannot be avoided:

[0031] Type 1.1: The aggregated traffic that flows in from interface 1 and out from interface 2 is counted twice;

[0032] Type 1.2: The aggregated traffic that flows in from interface 2 and flows out from interface 2 is counted twice;

[0033] At the same time, the NetFlow data collection and analysis system cannot determine whether the summary statistics of the following types of traffic are correct or whether the summary statistics can be obtained;

[0034] Type 2.1: The aggregated traffic that flows in from interface 3 and out from interface 1, and the aggregated traffic that flows in from interface 3 and out from interface 3 cannot be counted.

[0035] Type 2.2: The statistics of the inbound traffic of interface 1, the inbound traffic of interface 2, and the outbound traffic of interface 2 are larger than the actual traffic.

[0036] Type 2.3: The statistics of the outbound traffic of interface 1 and the inbound traffic of interface 3 are smaller than the actual traffic.

[0037] Type 2.4: The aggregated outbound traffic of interface 3 is consistent with the actual traffic.

[0038] In order to determine whether the statistical analysis results of the two types of data "Statistical Type 1" and "Statistical Type 2" in the NetFlow traffic collection and analysis system are correct, whether the erroneous results can be corrected, and to correct the erroneous results, it is necessary to ensure that the NetFlow traffic collection and analysis system and the router device synchronize information about the NetFlow data collection configuration. In traditional NetFlow traffic collection and analysis systems, this information synchronization often relies on manual maintenance by system administrators, or automated maintenance through a third-party configuration management system. However, in actual application environments, the number of routers in an IP network ranges from several to thousands, and the number of interfaces configured for NetFlow data collection ranges from tens to tens of thousands. Therefore, the workload of manually maintaining the NetFlow data collection configuration information of router devices is extremely large. Especially in the case of frequent changes in network equipment, it is easy to have inconsistent information about the NetFlow data collection configuration between the NetFlow traffic collection and analysis system and the router device, and it is difficult to find it, resulting in the NetFlow traffic collection and analysis system being unable to determine the reliability of the statistical analysis results of the two types of data "Statistical Type 1" and "Statistical Type 2", and unable to perform error correction. Summary of the invention

[0039] The technical problem to be solved by the present invention is to provide a method for collecting, judging and correcting NetFlow data of a router.

[0040] The technical solution adopted by the present invention to solve the above technical problems is as follows:

[0041] A method for collecting, judging and correcting NetFlow data of a router, comprising:

[0042] Step 1) NetFlow and SNMP interface data collection steps:

[0043] Use NetFlow protocol to collect traffic statistics logs of routers, and use SNMP protocol to collect interface description information and traffic information of routers as benchmark data for subsequent steps;

[0044] Step 2) Router NetFlow collection interface and direction determination steps:

[0045] Real-time determination of NetFlow data collection configuration of all router devices in the IP network based on NetFlow logs and SNMP logs;

[0046] Step 3) Data statistical results accuracy judgment and error correction steps:

[0047] Based on the NetFlow data collection configuration of the router device, determine whether the data statistical analysis results are correct, determine which erroneous results can be corrected, and perform error correction on the correctable results.

[0048] Using this method, the NetFlow data collection and analysis system directly and automatically obtains the NetFlow data collection configuration information of the router device based on the received NetFlow log, and automatically maintains the consistency of the NetFlow data collection configuration information between the NetFlow traffic collection and analysis system and the router device when the router configuration changes, and automatically determines the accuracy of the NetFlow data analysis based on this information and automatically corrects the correctable error statistical results. There is no need for manual maintenance by the administrator or maintenance through a third-party system, which greatly reduces the maintenance workload and system complexity of similar systems.

[0049] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] The present invention is described in detail below in conjunction with the accompanying drawings to make the above advantages of the present invention more clear.

[0051] Figure 1 This is the overall system structure diagram of NetFlow traffic collection and analysis;

[0052] Figure 2 This is a scenario diagram of the overall system for NetFlow traffic collection and analysis;

[0053] Figure 3 The present invention is a flowchart of a method for collecting, judging and correcting NetFlow data of a router. DETAILED DESCRIPTION

[0054] The following will describe the implementation methods of the present invention in detail with reference to the accompanying drawings and embodiments, so that the implementation process of how the present invention applies technical means to solve technical problems and achieve technical effects can be fully understood and implemented accordingly. It should be noted that as long as there is no conflict, the various embodiments of the present invention and the various features in the embodiments can be combined with each other, and the technical solutions formed are all within the protection scope of the present invention.

[0055] Specifically, in order to solve the above problems, this paper proposes a method based on NetFlow version 9 or above logs (Note: all "NetFlow" in this paper refers specifically to "NetFlow version 9 or above"), in which the NetFlow data collection and analysis system automatically discovers the initial configuration of NetFlow data collection of each interface of the router and automatically tracks the configuration changes, and uses the automatically discovered NetFlow data collection configuration information of each interface of the router to realize the automatic error correction and correctness judgment of the following statistical results. Among them, such as Figure 3 As shown, specifically including:

[0056] Step 1) NetFlow and SNMP interface data collection steps:

[0057] Use NetFlow protocol to collect traffic statistics logs of routers, and use SNMP protocol to collect interface description information and traffic information of routers as benchmark data for subsequent steps;

[0058] Step 2) Router NetFlow collection interface and direction determination steps:

[0059] Real-time determination of NetFlow data collection configuration of all router devices in the IP network based on NetFlow logs and SNMP logs;

[0060] Step 3) Data statistical results accuracy judgment and error correction steps:

[0061] Based on the NetFlow data collection configuration of the router device, determine whether the data statistical analysis results are correct, determine which erroneous results can be corrected, and perform error correction on the correctable results.

[0062] In one embodiment, it mainly includes:

[0063] 1. NetFlow and SNMP interface data collection: Use NetFlow protocol to collect the traffic statistics log of the router, and use SNMP protocol to collect the interface description information and traffic information of the router as the benchmark data for subsequent steps;

[0064] 2. Router NetFlow collection interface and direction determination: Based on NetFlow logs and SNMP logs, real-time determination of NetFlow data collection configuration of all router devices in the IP network;

[0065] 3. Data statistical results accuracy judgment and error correction (Statistical Type 1): Based on the NetFlow data collection configuration of the router device, automatically judge whether the statistical analysis results of "Statistical Type 1" are correct, determine which erroneous results can be corrected, and correct the results that can be corrected;

[0066] 4. Data statistical results accuracy judgment and error correction (Statistical Type 2): Based on the NetFlow data collection configuration of the router device, automatically judge whether the "Statistical Type 2" data statistical analysis results are correct, determine which erroneous results can be corrected, and correct the correctable results.

[0067] The specific implementation of each step is as follows:

[0068] 2.1 NetFlow and SNMP interface data collection

[0069] The NetFlow protocol is used to collect the traffic forwarded between interfaces of the router to generate NetFlow logs. The log content includes but is not limited to the following fields:

[0070] IPV4_SRC_ADDR: This field stores the source IPv4 address of the flow;

[0071] INPUT_SNMP: This field stores the incoming interface snmp_ifindex of the flow;

[0072] IPV4_DST_ADDR: This field stores the destination IPv4 address of the flow;

[0073] OUTPUT_SNMP: This field stores the outgoing interface snmp_ifindex of the flow;

[0074] DIRECTION: This field stores the interface direction where the log is generated. The value is ingress or egress.

[0075] IN_BYTES: This field stores the total number of bytes flowing in the inbound direction of the interface;

[0076] IN_PKTS: This field stores the total number of packets flowing in the inbound direction of the interface;

[0077] OUT_BYTES: This field stores the total number of bytes flowing in the outbound direction of the interface;

[0078] OUT_PKTS: This field stores the total number of packets flowing in the outbound direction of the interface;

[0079] Still Figure 2 Take the scenario shown in the figure as an example, assuming that the interface information of the router is as follows:

[0080] The snmp_ifindex of interface 1 is 1, and the interface description is GE1;

[0081] The snmp_ifindex of interface 2 is 2, and the interface description is GE2.

[0082] The snmp_ifindex of interface 3 is 3, and the interface description is GE3.

[0083] Assuming that there is forwarding traffic between any two interfaces of the router, the logs generated by forwarding traffic between any interfaces of the router are as follows:

[0084] 1. For each flow of traffic flowing in and out of interface 1, a NetFlow traffic statistics log is generated only in the direction of inflow from interface 1. The following fields of the log generated by each flow have the same values:

[0085] DIRECTION = ingress;

[0086] INPUT_SNMP=1;

[0087] OUTPUT_SNMP=1;

[0088] The total number of bytes of each stream is recorded in the IN_BYTES field;

[0089] The total number of packets for each flow is recorded in the IN_PKTS field;

[0090] 2. For each flow of traffic that flows in from interface 1 and out from interface 2, a NetFlow traffic statistics log is generated in the inflow direction of interface 1 and the outflow direction of interface 2, respectively, and a total of two NetFlow traffic statistics logs are generated. Among them:

[0091] The following fields in the log generated by each flow in the inbound direction of interface 1 have the same values:

[0092] DIRECTION = ingress;

[0093] INPUT_SNMP=1;

[0094] OUTPUT_SNMP=2;

[0095] The total number of bytes of each stream is recorded in the IN_BYTES field;

[0096] The total number of packets for each flow is recorded in the IN_PKTS field;

[0097] The following fields in the log generated by each flow in the outbound direction of interface 2 have the same values:

[0098] DIRECTION = egress;

[0099] INPUT_SNMP=1;

[0100] OUTPUT_SNMP=2;

[0101] The total number of bytes of each stream is recorded in the OUT_BYTES field;

[0102] The total number of packets for each flow is recorded in the OUT_PKTS field;

[0103] 3. For each flow that flows in from interface 1 and out from interface 3, a NetFlow traffic statistics log is generated only in the direction of inflow from interface 1. The following fields of the log generated by each flow have the same values:

[0104] DIRECTION = ingress;

[0105] INPUT_SNMP=1;

[0106] OUTPUT_SNMP=3;

[0107] The total number of bytes of each stream is recorded in the IN_BYTES field;

[0108] The total number of packets for each flow is recorded in the IN_PKTS field;

[0109] 4. For each flow that flows in from interface 2 and out from interface 1, a NetFlow traffic statistics log is generated only in the direction of inflow from interface 2. The following fields of the log generated by each flow have the same values:

[0110] DIRECTION = ingress;

[0111] INPUT_SNMP=2;

[0112] OUTPUT_SNMP=1;

[0113] The total number of bytes of each stream is recorded in the IN_BYTES field;

[0114] The total number of packets for each flow is recorded in the IN_PKTS field;

[0115] 5. Each flow of traffic flowing in and out of interface 2 generates a NetFlow traffic statistics log in the inflow and outflow directions of interface 2, and a total of two NetFlow traffic statistics logs are generated. Among them:

[0116] The following fields of the log generated by each flow in the inbound direction of interface 2 have the same values:

[0117] DIRECTION = ingress;

[0118] INPUT_SNMP=2;

[0119] OUTPUT_SNMP=2;

[0120] The total number of bytes of each stream is recorded in the IN_BYTES field;

[0121] The total number of packets for each flow is recorded in the IN_PKTS field;

[0122] The following fields in the log generated by each flow outgoing from interface 2 have the same values:

[0123] DIRECTION = egress;

[0124] INPUT_SNMP=2;

[0125] OUTPUT_SNMP=2;

[0126] The total number of bytes of each stream is recorded in the OUT_BYTES field;

[0127] The total number of packets for each flow is recorded in the OUT_PKTS field;

[0128] 6. For each flow that flows in from interface 2 and out from interface 3, a NetFlow traffic statistics log is generated only in the direction of inflow from interface 2. The following fields of the log generated by each flow have the same values:

[0129] DIRECTION = ingress;

[0130] INPUT_SNMP=2;

[0131] OUTPUT_SNMP=3;

[0132] The total number of bytes of each stream is recorded in the IN_BYTES field;

[0133] The total number of packets for each flow is recorded in the IN_PKTS field;

[0134] 7. For each flow of traffic flowing in from interface 3 and out from interface 1: no NetFlow traffic statistics log will be generated;

[0135] 8. For each flow that flows in from interface 3 and out from interface 2, a NetFlow traffic statistics log is generated only in the outflow direction of interface 2. The following fields of the log generated by each flow have the same values:

[0136] DIRECTION = egress;

[0137] INPUT_SNMP=3;

[0138] OUTPUT_SNMP=2;

[0139] The total number of bytes of each stream is recorded in the OUT_BYTES field;

[0140] The total number of packets for each flow is recorded in the OUT_PKTS field;

[0141] 9. For each flow of traffic flowing in from interface 3 and out from interface 3: no NetFlow traffic statistics log will be generated;

[0142] Use SNMP protocol to collect the router interface description, interface snmp_ifindex, interface inflow direction flow count, interface outflow direction flow count at a time period T;

[0143] by Figure 1 As an example, at time T0, the SNMP collected data is as follows:

[0144] snmp_ifindex=1, ifDescr=GE1, IfInOctet=in11, IfOutOctet=out11;

[0145] snmp_ifindex=2, ifDescr=GE2, IfInOctet=in21, IfOutOctet=out21;

[0146] snmp_ifindex=3, ifDescr=GE3, IfInOctet=in31, IfOutOctet=out31;

[0147] At time T0+T, SNMP collects the following data:

[0148] snmp_ifindex=1, ifDescr=GE1, IfInOctet=in12, IfOutOctet=out12;

[0149] snmp_ifindex=2, ifDescr=GE2, IfInOctet=in22, IfOutOctet=out22;

[0150] snmp_ifindex=3, ifDescr=GE3, IfInOctet=in32, IfOutOctet=out32;

[0151] Assuming that the inflow and outflow traffic of each interface in period T is not zero, then:

[0152] in12>in11, in22>in21, in32>in31, out12>out11, out22>out21, out32>out31

[0153] 2.2 Router NetFlow collection interface and direction determination:

[0154] Based on the data collected in 2.1, the NetFlow data collection configuration information is automatically judged, that is, which interfaces and traffic collection directions are collected on each router. The specific judgment method is as follows:

[0155] 1. Using the SNMP collection time period T in 2.1 as the unit, summarize all NetFlow logs generated by the same router to Figure 2 Taking the router shown as an example, the NetFlow logs of all flows collected in step 2.1 within time period T are summarized;

[0156] 2. In all the NetFlow logs collected in step 1, search for all logs with DIRECTION = ingress, extract the values ​​in the INPUT_SNMP field in these logs and perform deduplication processing to obtain a router interface list If_In_List1 with snmp_ifindex as the index. Figure 2 Taking the router shown as an example, If_In_List1 = {1, 2};

[0157] 3. In all the NetFlow logs summarized in step 1, search for all logs with DIRECTION = egress, extract the values ​​in the OUTPUT_SNMP field in these logs and perform deduplication processing to obtain a router interface list If_Out_List1 with snmp_ifindex as the index. Figure 2 Take the router shown as an example If_Out_List1 = {2};

[0158] 4. Use the snmp data in step 1 to calculate whether the inbound and outbound traffic of each interface is 0 during time period T. Figure 2 Taking the router shown in the figure as an example, according to the SNMP data collected in 2.1, since in12>in11, in22>in21, in32>in31, out12>out11, out22>out21, out32>out31, the calculation results are as follows:

[0159] The inflow flow of interface 1 = in21-in11>0;

[0160] Outgoing flow rate of interface 1 = out21-out11>0;

[0161] The inflow flow of interface 2 = in22-in12>0;

[0162] Outgoing flow rate of interface 2 = out22-out12>0;

[0163] The inflow flow of interface 3 = in32-in31>0;

[0164] Outgoing traffic of interface 3 = out32-out31>0;

[0165] According to the calculation results, the interface list If_In_List2 with snmp_ifindex as the index and the inflow flow rate not being 0 is obtained = {1, 2, 3}; the interface list If_Out_List2 with snmp_ifindex as the index and the outflow flow rate not being 0 is obtained = {1, 2, 3};

[0166] 5. Calculate the intersection of If_In_List1 and If_In_List2 to obtain the interface list If_In_List3 that is configured with all inflow direction NetFlow data collection and uses snmp_ifindex as the index. Figure 2 Taking the router shown as an example, If_In_List3 = {1, 2};

[0167] 6. Calculate the intersection of If_Out_List1 and If_Out_List2 to obtain the interface list If_Out_List3 that is configured with all outbound NetFlow data collection and uses snmp_ifindex as the index. Figure 2 Taking the router shown as an example, If_Out_List3 = {2};

[0168] 7. Calculate the intersection of the complement of If_In_List1 and If_In_List2 to obtain the interface list If_Non_In_List that is not configured with NetFlow data collection in the inflow direction and has snmp_ifindex as the index. Figure 2 Taking the router shown as an example, If_Non_In_List = empty set;

[0169] 8. Calculate the intersection of the complement of If_Out_List1 and If_Out_List2 to obtain the interface list IfNon_Out_List that is not configured with NetFlow data collection in the inflow direction and has snmp_ifindex as the index. Figure 2 Taking the router shown as an example, If_Non_Out_List = empty set;

[0170] 9. Calculate the complement of the union of If_In_List3 and If_Non_In_List to obtain the interface list If_Un_In_List with snmp_ifindex as the index and unknown collection configuration status. Figure 2 Taking the router shown as an example, If_UnIn_List = empty set;

[0171] 10. Calculate the complement of the union of If_Out_List3 and If_Non_Out_List to obtain the interface list If_Un_Out_List with snmp_ifindex as the index and unknown collection configuration status. Figure 2 Taking the router shown as an example, If_Un_Out_List == empty set;

[0172] In summary, after the above calculation steps, the information of the router NetFlow data collection configuration is as follows:

[0173] 1. Configure the interface set If_In_List3 for NetFlow data collection in the inbound direction. Figure 2 Taking the router shown as an example, the set is {1, 2};

[0174] 2. Configure the interface set If_Out_List3 for NetFlow data collection in the outbound direction. Figure 2 Taking the router shown as an example, the set is {2};

[0175] 3. If_Non_In_List is a collection of interfaces that are not configured for NetFlow data collection in the inbound direction. Figure 2 Taking the router shown as an example, the set is {3};

[0176] 4. If_Non_Out_List is a collection of interfaces that are not configured to collect NetFlow data in the outbound direction. Figure 2 Taking the router shown as an example, the set is {1, 3};

[0177] 5. The set of interfaces with unknown NetFlow data collection configuration status in the inbound direction, If_Un_In_List, is as follows: Figure 2 Taking the router shown as an example, the set is an empty set;

[0178] 6. The set of interfaces with unknown NetFlow data collection configuration status in the outbound direction, If_Un_Out_List, is as follows: Figure 2 Taking the router shown as an example, the set is an empty set;

[0179] 2.3 Accuracy judgment and error correction of data statistical results (statistical type 1):

[0180] According to the router NetFlow data collection configuration information obtained in step 2.2, the accuracy of the data statistical results of "Statistical Type 1" is judged, and it is determined which erroneous statistical results can be corrected and error correction processing is performed.

[0181] "Statistics type 1" refers to the summary statistics of the forwarding traffic between any two interfaces of the router, for example Figure 2 The traffic flowing in from interface 1 and out from interface 2 is summarized and counted. If this kind of statistics is directly performed based on the values ​​of the INPUT_SNMP and OUTPUT_SNMP fields based on the NetFlow logs collected in step 2.1, there will be three situations: correct traffic statistics, repeated traffic statistics, and missed traffic statistics. The repeated traffic statistics can be corrected according to the router NetFlow data collection configuration information calculated in step 2.2.

[0182] Taking the forwarding traffic from interface IF1 to interface IF2 as an example, the specific method for judging the accuracy of the traffic is as follows:

[0183] Determine to which interface set in step 2.2 the interface IF1 and the interface IF2 belong. According to various combinations of different sets in step 2.2 to which the interface IF1 and the interface IF2 belong, the determination method is as follows:

[0184] 1. Interface IF1 belongs to the set If_In_List3, and interface IF2 belongs to If_Out_List3, then the traffic is counted twice and can be corrected. The correction method is to directly divide the statistical result by 2;

[0185] 2. Interface IF1 belongs to the set If_In_List3, and interface IF2 belongs to If_Non_Out_List, then the statistical result is the correct statistical result;

[0186] 3. Interface IF1 belongs to the set If_Non_In_List, and interface IF2 belongs to If_Out_List3, then the statistical result is the correct statistical result;

[0187] 4. Interface IF1 belongs to the set If_Non_In_List, and interface IF2 belongs to If_Non_Out_List, then the statistical result is an error result. Since no forwarding traffic from interface IF1 to interface IF2 is collected in this case, error correction cannot be performed in this case.

[0188] Except for the above four cases, other combinations of the sets to which the interface IF1 and the interface IF2 belong will not occur under normal circumstances.

[0189] 2.4 Accuracy judgment and error correction of data statistical results (statistical type 2):

[0190] According to the router NetFlow data collection configuration information obtained in step 2.2, the accuracy of the data statistical results of "Statistical Type 2" is judged, and it is determined which erroneous statistical results can be corrected and error correction processing is performed.

[0191] "Statistical type 2" refers to the summary statistics of the traffic flowing in or out of any interface of the router. If this kind of statistics is directly performed based on the values ​​of the INPUT_SNMP and OUTPUT_SNMP fields based on the NetFlow log collected in step 2.1, there will be three situations: correct traffic statistics, repeated traffic statistics, and missed traffic statistics. Among them, repeated traffic statistics can be corrected according to the router NetFlow data collection configuration information calculated in step 2.2.

[0192] Taking interface IF1 as an example, the specific method for judging the accuracy of traffic summary statistics in the inbound direction is as follows:

[0193] 1. If interface IF1 belongs to the set If_In_List3, and all other interfaces of the same router and interface IF1 itself do not belong to the set If_Out_List3, then the traffic statistics result in the inbound direction of interface IF1 is correct;

[0194] 2. If interface IF1 belongs to the set If_In_List3, and all other interfaces of the same router or interface IF1 itself have some interfaces that belong to the set If_Out_List3, then the traffic statistics result of interface IF1 in the inflow direction may be larger than the normal result, and this error can be corrected. The specific correction steps are as follows: Only use the logs with the field DIRECTION = ingress and the field INPUT_SNMP = interface IF1 in the NetFlow log for traffic summary statistics, and you can get the correct summary statistics result;

[0195] 3. If interface IF1 belongs to the set If_Non_In_List, and all other interfaces of the same router and interface IF1 itself belong to the set If_Out_List3, then the traffic statistics result in the inbound direction of interface IF1 is correct;

[0196] 4. If interface IF1 belongs to the set If_Non_In_List, and all other interfaces of the same router and interface IF1 itself have some interfaces that do not belong to the set If_Out_List3, then the traffic statistics result of the inbound direction of interface IF1 may be smaller than the normal result, and the error cannot be corrected;

[0197] 5. If the interface IF1 belongs to the set If_Un_In_List, the traffic statistics result in the inbound direction of the interface IF1 is correct (the result is 0).

[0198] Taking interface IF1 as an example, the specific method for judging the accuracy of outbound traffic statistics is as follows:

[0199] 1. If interface IF1 belongs to the set If_Out_List3, and all other interfaces of the same router and interface IF1 itself do not belong to the set If_In_List3, then the traffic statistics result in the outflow direction of interface IF1 is correct;

[0200] 2. If interface IF1 belongs to the set If_Out_List3, and all other interfaces of the same router or interface IF1 itself have some interfaces belonging to the set If_In_List3, then the traffic statistics result of interface IF1 outflow direction may be larger than the normal result, and this error can be corrected. The specific correction steps are as follows: Only use the logs with field DIRECTION = egress and field OUTPUT_SNMP = interface IF1 in the NetFlow log for traffic summary statistics, and you can get the correct summary statistics result;

[0201] 3. If interface IF1 belongs to the set If_Non_Out_List, and all other interfaces of the same router and interface IF1 itself belong to the set If_In_List3, then the traffic statistics result in the outflow direction of interface IF1 is correct;

[0202] 4. If interface IF1 belongs to the set If_Non_Out_List, and all other interfaces of the same router and interface IF1 itself have some interfaces that do not belong to the set If_In_List3, then the traffic statistics result of interface IF1 in the outflow direction may be smaller than the normal result, and the error cannot be corrected;

[0203] 5. If the interface IF1 belongs to the set If_Un_Out_List, the traffic statistics result in the outflow direction of the interface IF1 is a correct result (the result is 0).

[0204] Using this method, the NetFlow data collection and analysis system directly and automatically obtains the NetFlow data collection configuration information of the router device based on the received NetFlow log, and automatically maintains the consistency of the NetFlow data collection configuration information between the NetFlow traffic collection and analysis system and the router device when the router configuration changes, and automatically determines the accuracy of the NetFlow data analysis based on this information and automatically corrects the correctable error statistical results. There is no need for manual maintenance by the administrator or maintenance through a third-party system, which greatly reduces the maintenance workload and system complexity of similar systems.

[0205] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for collecting, judging and correcting NetFlow data of a router, characterized in that: include: Step 1) NetFlow and SNMP interface data collection steps: Use NetFlow protocol to collect traffic statistics logs of routers, and use SNMP protocol to collect interface description information and traffic information of routers as benchmark data for subsequent steps; Step 2) Router NetFlow collection interface and direction determination steps: Based on the NetFlow traffic statistics log, determine which interfaces and traffic collection directions are collected on each router based on the NetFlow data collection configuration information; Based on NetFlow traffic statistics logs and SNMP logs, real-time determination of NetFlow data collection configuration of all router devices in the IP network; Step 3) Data statistical results accuracy judgment and error correction steps: Based on the NetFlow data collection configuration of the router device, determine whether the data statistical analysis results are correct, determine which erroneous results can be corrected, and perform error correction on the correctable results; Step 2) specifically includes: Sub-step 21) Summarize all NetFlow logs generated by the same router in units of SNMP collection time period T; Sub-step 22) In all NetFlow logs summarized in sub-step 21, search for all logs with DIRECTION=ingress, extract the values ​​in the INPUT_SNMP field in these logs and perform deduplication processing to obtain a router interface list If_In_List1 with snmp_ifindex as the index: Sub-step 23) In all NetFlow logs summarized in sub-step 21, search for all logs with DIRECTION=egress, extract the values ​​in the OUTPUT_SNMP fields in these logs and perform deduplication processing to obtain a router interface list If_Out_List1 with snmp_ifindex as the index; Sub-step 24) using the snmp data in sub-step 21, calculate whether the flow in the inbound and outbound directions of each interface is 0 within the time period T; According to the calculation results, the interface list If_In_List2 with snmp_ifindex as the index and the inflow flow rate not being 0 is obtained = {1, 2, 3}; the interface list If_Out_List2 with snmp_ifindex as the index and the outflow flow rate not being 0 is obtained = {1, 2, 3}; Sub-step 25) Calculate the intersection of If_In_List1 and If_In_List2 to obtain a list of interfaces If_In_List3 configured with inflow direction NetFlow data collection and with snmp_ifindex as the index; Sub-step 26) Calculate the intersection of If_Out_List1 and If_Out_List2 to obtain a list of interfaces If_Out_List3 configured with outbound NetFlow data collection using snmp_ifindex as an index; Sub-step 27) Calculate the intersection of the complement of If_In_List1 and If_In_List2 to obtain a list of all interfaces If_Non_In_List that are not configured with inflow direction NetFlow data collection and have snmp_ifindex as an index; Sub-step 28) Calculate the intersection of the complement of If_Out_List1 and If_Out_List2 to obtain the interface list If_Non_Out_List of all interfaces that are not configured with inflow direction NetFlow data collection and have snmp_ifindex as the index; Sub-step 29) Calculate the complement of the union of If_In_List3 and If_Non_In_List to obtain a list of all interfaces If_Un_In_List with snmp_ifindex as the index and whose collection configuration status is unknown; Sub-step 210) Calculate the complement of the union of If_Out_List3 and If_Non_Out_List to obtain a list of all interfaces If_Un_Out_List with snmp_ifindex as the index and whose collection configuration status is unknown; Sub-step 211) The information obtained from the above-mentioned NetFlow data collection configuration of the router is as follows: If_In_List3 is a collection of interfaces for collecting NetFlow data in the inbound direction. If_Out_List3 is a collection of interfaces configured for collecting outbound NetFlow data. If_Non_In_List is a collection of interfaces that are not configured for NetFlow data collection in the inbound direction. If_Non_Out_List is a collection of interfaces that are not configured with outbound NetFlow data collection. If_Un_In_List, a collection of interfaces whose NetFlow data collection configuration status is unknown in the inbound direction; If_Un_Out_List is a collection of interfaces whose status of outbound NetFlow data collection configuration is unknown.

2. The method for collecting, judging and correcting NetFlow data of a router according to claim 1, characterized in that: Step 1) specifically includes: The NetFlow protocol is used to collect the traffic forwarded between interfaces of the router to generate NetFlow logs. The log content includes the following fields: IPV4_SRC_ADDR: This field stores the source IPv4 address of the flow; INPUT_SNMP: This field stores the incoming interface snmp_ifindex of the flow; IPV4_DST_ADDR: This field stores the destination IPv4 address of the flow; OUTPUT_SNMP: This field stores the outgoing interface snmp_ifindex of the flow; DIRECTION: This field stores the interface direction where the log is generated. The value is ingress or egress. IN_BYTES: This field stores the total number of bytes flowing in the inbound direction of the interface; IN_PKTS: This field stores the total number of packets flowing in the inbound direction of the interface; OUT_BYTES: This field stores the total number of bytes flowing in the outbound direction of the interface; OUT_PKTS: This field stores the total number of packets flowing in the outbound direction of the interface.

3. The method for collecting, judging and correcting NetFlow data of a router according to claim 2, characterized in that: Step 1) specifically includes: Set the interface information of the router as follows: The snmp_ifindex of interface 1 is 1, and the interface description is GE1. The snmp_ifindex of interface 2 is 2, and the interface description is GE2. The snmp_ifindex of interface 3 is 3, and the interface description is GE3. Use the SNMP protocol to collect NetFlow traffic statistics logs including the router interface description, interface snmp_ifindex, interface inflow direction traffic count, and interface outflow direction traffic count at a time period T.

4. The method for collecting, judging and correcting NetFlow data of a router according to claim 3 is characterized in that: In step 1), the traffic of each interface follows the following rules; 11) For each flow of traffic flowing in and out of interface 1, a NetFlow traffic statistics log is generated only in the direction of inflow from interface 1. The following fields of the log generated by each flow have the same values: DIRECTION=ingress INPUT_SNMP=1 OUTPUT_SNMP=1 The total number of bytes of each stream is recorded in the IN_BYTES field; The total number of packets for each flow is recorded in the IN_PKTS field; 12) For each flow of traffic that flows in from interface 1 and out from interface 2, a NetFlow traffic statistics log is generated in the inflow direction of interface 1 and the outflow direction of interface 2, respectively. A total of two NetFlow traffic statistics logs are generated, where: The following fields in the log generated by each flow in the inbound direction of interface 1 have the same values: DIRECTION=ingress INPUT_SNMP=1 OUTPUT_SNMP=2 The total number of bytes in each stream is recorded in the IN_BYTES field. The total number of packets for each flow is recorded in the IN_PKTS field The following fields in the log generated by each flow in the outbound direction of interface 2 have the same values: DIRECTION=egress INPUT_SNMP=1 OUTPUT_SNMP=2 The total number of bytes for each stream is recorded in the OUT_BYTES field. The total number of packets for each flow is recorded in the OUT_PKTS field 13) For each flow that flows in from interface 1 and out from interface 3, a NetFlow traffic statistics log is generated only in the direction of inflow from interface 1. The following fields of the log generated by each flow have the same values: DIRECTION=ingress INPUT_SNMP=1 OUTPUT_SNMP=3 The total number of bytes in each stream is recorded in the IN_BYTES field. The total number of packets for each flow is recorded in the IN_PKTS field 14) For each flow that flows in from interface 2 and out from interface 1, a NetFlow traffic statistics log is generated only in the direction of inflow from interface 2. The following fields of the log generated by each flow have the same values: DIRECTION=ingress INPUT_SNMP=2 OUTPUT_SNMP=1 The total number of bytes in each stream is recorded in the IN_BYTES field. The total number of packets for each flow is recorded in the IN_PKTS field 15) Each flow of traffic flowing in and out of interface 2 generates a NetFlow traffic statistics log in the inflow and outflow directions of interface 2, respectively, and a total of two NetFlow traffic statistics logs are generated, where: The following fields of the log generated by each flow in the inbound direction of interface 2 have the same values: DIRECTION=ingress INPUT_SNMP=2 OUTPUT_SNMP=2 The total number of bytes in each stream is recorded in the IN_BYTES field. The total number of packets for each flow is recorded in the IN_PKTS field The following fields in the log generated by each flow outgoing from interface 2 have the same values: DIRECTION=egress INPUT_SNMP=2 OUTPUT_SNMP=2 The total number of bytes for each stream is recorded in the OUT_BYTES field. The total number of packets for each flow is recorded in the OUT_PKTS field 16) For each flow that flows in from interface 2 and out from interface 3, a NetFlow traffic statistics log is generated only in the direction of inflow from interface 2. The following fields of the log generated by each flow have the same values: DIRECTION=ingress INPUT_SNMP=2 OUTPUT_SNMP=3 The total number of bytes in each stream is recorded in the IN_BYTES field. The total number of packets for each flow is recorded in the IN_PKTS field 17) For each flow of traffic that flows in from interface 3 and out from interface 1: no NetFlow traffic statistics log will be generated; 18) For each flow that flows in from interface 3 and out from interface 2, a NetFlow traffic statistics log is generated only in the outflow direction of interface 2. The following fields of the log generated by each flow have the same values: DIRECTION=egress INPUT_SNMP=3 OUTPUT_SNMP=2 The total number of bytes for each stream is recorded in the OUT_BYTES field. The total number of packets for each flow is recorded in the OUT_PKTS field 19) For each flow of traffic flowing in and out of interface 3: no NetFlow traffic statistics log will be generated.

5. The method for collecting, judging and correcting NetFlow data of a router according to claim 1, characterized in that: In step 3), the accuracy of the data statistical results is judged, and it is determined which erroneous statistical results can be corrected and error correction processing is performed, specifically including: Summarize and count the forwarding traffic between any two interfaces of the router; And correct the router NetFlow data collection configuration information in which traffic is repeatedly counted.

6. The method for collecting, judging and correcting NetFlow data of a router according to claim 5, characterized in that: Step 3) specifically includes: Determine to which interface set the interface IF1 and the interface IF2 belong in the step, according to various combinations of different sets in which the interface IF1 and the interface IF2 belong, the determination method is as follows: Interface IF1 belongs to the set If_In_List3, and interface IF2 belongs to If_Out_List3. Therefore, the traffic is counted twice and can be corrected by dividing the statistical result by 2. Interface IF1 belongs to the set If_In_List3, and interface IF2 belongs to If_Non_Out_List, then the statistical result is the correct statistical result; If interface IF1 belongs to the set If_Non_In_List, and interface IF2 belongs to If_Out_List3, the statistical result is correct; If interface IF1 belongs to the set If_Non_In_List, and interface IF2 belongs to If_Non_Out_List, the statistical result is an error result. Since no forwarding traffic from interface IF1 to interface IF2 is collected in this case, error correction cannot be performed in this case.

7. The method for collecting, judging and correcting NetFlow data of a router according to claim 5, characterized in that: Step 3) also includes: If interface IF1 belongs to the set If_In_List3, and all other interfaces of the same router and interface IF1 itself do not belong to the set If_Out_List3, the traffic statistics result in the inbound direction of interface IF1 is correct; If interface IF1 belongs to the set If_In_List3, and all other interfaces of the same router or interface IF1 itself have some interfaces that belong to the set If_Out_List3, the traffic statistics result in the inbound direction of interface IF1 may be larger than the normal result, and this error can be corrected; The specific correction steps are as follows: Only use the logs with the field DIRECTION = ingress and the field INPUT_SNMP = interface IF1 in the NetFlow log to perform traffic summary statistics, and you can get the correct summary statistics results; If interface IF1 belongs to the set If_Non_In_List, and all other interfaces on the same router and interface IF1 itself belong to the set If_Out_List3, then the traffic statistics result in the inbound direction of interface IF1 is correct; If interface IF1 belongs to the set If_Non_In_List, and some of the other interfaces of the same router and interface IF1 itself do not belong to the set If_Out_List3, the traffic statistics result in the inbound direction of interface IF1 may be smaller than the normal result, and the error cannot be corrected; If interface IF1 belongs to the set If_Un_In_List, the traffic statistics result in the inbound direction of interface IF1 is correct and the result is 0.

8. The method for collecting, judging and correcting NetFlow data of a router according to claim 5, characterized in that: Step 3) also includes: If interface IF1 belongs to the set If_Out_List3, and all other interfaces of the same router and interface IF1 itself do not belong to the set If_In_List3, the traffic statistics result in the outbound direction of interface IF1 is correct; If interface IF1 belongs to the set If_Out_List3, and all other interfaces of the same router or interface IF1 itself have some interfaces that belong to the set If_In_List3, then the traffic statistics result in the outbound direction of interface IF1 may be larger than the normal result, and this error can be corrected; The specific correction steps are as follows: Only use the logs with the field DIRECTION = egress and the field OUTPUT_SNMP = interface IF1 in the NetFlow log to perform traffic summary statistics, and you can get the correct summary statistics results; If interface IF1 belongs to the set If_Non_Out_List, and all other interfaces on the same router and interface IF1 itself belong to the set If_In_List3, then the traffic statistics result in the outbound direction of interface IF1 is correct; If interface IF1 belongs to the set If_Non_Out_List, and some of the other interfaces of the same router and interface IF1 itself do not belong to the set If_In_List3, the traffic statistics result in the outbound direction of interface IF1 may be smaller than the normal result, and the error cannot be corrected; If the interface IF1 belongs to the set If_Un_Out_LList, the traffic statistics result in the outbound direction of the interface IF1 is correct and the result is 0.

Citation Information

Patent Citations

  • Network anomaly traffic flow detection method based on combination of SNMP and NetFlow

    CN104092588A

  • Error correction method and error correction device for interface return data

    CN112732471A

  • Method and device for checking flow accuracy of NetFlow port

    CN114244732A

  • Sample netflow for network traffic data collection

    US7193968B1