A data packet analysis method, device, computer equipment and storage medium
By establishing a signal connection at the core egress network equipment port, processing and analyzing data packets, and obtaining IP related information, the problem of difficulty in monitoring IP terminals in the existing technology is solved, achieving precise monitoring of IP terminals and improving operation and maintenance efficiency. .
Patent Information
- Application Number
- CN202211084436.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-06
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2042-09-06
AI Technical Summary
The existing technology cannot effectively monitor IP terminals, making operation and maintenance difficult. It cannot effectively link abnormal network traffic and IT infrastructure, which increases the cost and difficulty of operation and maintenance.
By establishing a signal connection at the port of the core egress network device, obtaining and processing data packets, archiving, unpacking, consumption and aggregation analysis, obtaining IP related information and operation related information, performing event visualization and abnormal event linkage processing, and realizing IP Precise monitoring of terminals and handling of abnormal situations.
It achieves effective monitoring of IP terminals, reduces the difficulty of operation and maintenance, improves operation and maintenance efficiency, can accurately perform target operations according to abnormal conditions, and improves the ability to monitor and manage network conditions.
Smart Images

Figure CN115473948B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data transmission, and in particular to a data packet analysis method, apparatus, computer equipment and storage medium. Background Art
[0002] With the popularization of cloud computing technology, more and more companies have begun to use cloud hosts. It took a long time from the initial doubts about the security and stability of cloud hosts to their later recognition. With the popularization of cloud hosts and the development of IT Internet and e-commerce, the user base of each cloud vendor has become larger and larger. The complexity of the business, DDOS attacks, and abnormal network traffic have brought great challenges to the data center.
[0003] For example, it is impossible to effectively monitor network delays, network traffic, abnormal packet loss, TCP reset network connections, TCP retransmissions, etc. between two IP terminals, making it impossible to effectively link abnormal network traffic with existing IT infrastructure, greatly increasing the difficulty of operation and maintenance.
[0004] There is currently no better solution to the above problems. Summary of the invention
[0005] The embodiments of the present invention provide a data packet analysis method, apparatus, computer equipment and storage medium to at least solve the problem of difficulty in operation and maintenance caused by the inability to effectively monitor IP terminals in the related art.
[0006] According to an embodiment of the present invention, a data packet analysis method is provided, comprising:
[0007] When it is determined that a signal connection is established with a first port of a core egress network device, a first data packet is obtained through the first port, wherein the first data packet is obtained after the core egress network device processes an initial data packet entering and exiting an external data center;
[0008] Based on a preset target function, archiving the first data packet to obtain a second data packet in a target format;
[0009] Based on a preset unpacking program, unpacking the second data packet to obtain structured data;
[0010] Performing consumption processing on the structured data to obtain first structured data, and storing the first structured data in a target database;
[0011] Performing aggregation analysis on the first structure data in the target library to obtain a data analysis result, wherein the data analysis result includes IP-related information and / or operation-related information;
[0012] Based on the IP association information and / or operation association information, a target operation is performed, wherein the target operation at least includes event visualization processing and / or abnormal event linkage processing.
[0013] In an optional embodiment, the method further includes:
[0014] After the second data packet is unpacked based on the preset unpacking program to obtain structured data, the method further includes: transmitting the structured data to a target message queue in multiple threads based on a timestamp included in the structured data;
[0015] The consumption processing of the structured data to obtain the first structured data includes: acquiring the structured data from the target message queue in sequence based on the timestamp; and processing the structured data to obtain the first structured data.
[0016] In an optional embodiment, the processing the structured data to obtain the first structured data includes:
[0017] Obtaining IP attribution information contained in the structured data;
[0018] Based on the IP attribution information, identification processing is performed on the structured data to obtain the first structured data.
[0019] In an optional embodiment, before obtaining the first data packet through the first port, the method further includes:
[0020] When the second port receives an initial data packet, the initial data packet is copied and processed by the target program to obtain the first data packet, and the first data packet is transmitted to the first port, wherein the second port is communicatively connected to the external data center, and the initial data packet includes data packets entering and leaving the external data center.
[0021] In an optional embodiment, when it is determined that a signal connection is established with a first port of a core egress network device, obtaining a first data packet through the first port includes:
[0022] When it is determined that a signal connection is established with the first port, a network card scanning operation is performed on a target network card through a first program to determine network card information of the target network card, wherein the target network card is connected to the first port;
[0023] The first program obtains the first data packet from the first port according to the network card information, and sends
[0024] The second program sends a start instruction to instruct the second program to perform archiving processing on the first data packet based on a preset target function to obtain a second data packet in a target format.
[0025] In an optional embodiment, based on the IP association information and / or the operation association information, executing the target operation includes at least one of the following:
[0026] Performing information visualization operations based on the IP-related information and / or the operation-related information;
[0027] Determine the network quality between the regions where the target object is located based on the IP association information and / or the operation association information;
[0028] Based on the IP association information and / or the operation association information, sending a configuration instruction to the target server to instruct the target server to generate a first list;
[0029] When it is determined that the IP association information and / or operation association information is in an abnormal state, a work order operation command is sent to the target object to instruct the target object to generate a target work order and send the target work order.
[0030] According to another embodiment of the present invention, there is provided a data packet device, comprising:
[0031] A data capture module, configured to obtain a first data packet through a first port of a core egress network device when a signal connection is determined to be established with the first port, wherein the first data packet is obtained after the core egress network device processes an initial data packet entering and exiting an external data center;
[0032] A data archiving module, used for archiving the first data packet based on a preset target function to obtain a second data packet in a target format;
[0033] A data unpacking module, configured to unpack the second data packet based on a preset unpacking program to obtain structured data;
[0034] A data consumption module, used for performing consumption processing on the structured data to obtain first structured data, and storing the first structured data in a target database;
[0035] An aggregation analysis module, used for performing aggregation analysis on the first structure data in the target library to obtain a data analysis result, wherein the data analysis result includes IP-related information and / or operation-related information;
[0036] The target operation module is used to perform target operations based on the IP association information and / or operation association information, wherein the target operation at least includes event visualization processing and / or abnormal event linkage processing.
[0037] According to yet another embodiment of the present invention, a storage medium is provided, and when the computer program is executed, the steps of any of the aforementioned methods are implemented.
[0038] According to another embodiment of the present invention, there is also provided a computer device, comprising a memory and a processor, wherein the processor is coupled to the memory, and wherein at least one program instruction or code is stored in the memory, and the at least one program instruction or code is loaded and executed by the processor so that the computer device implements the aforementioned data packet analysis method.
[0039] Through the present invention, since the second data packet comes from the external data center and the second data packet is unpacked and consumed and aggregated for analysis, the actual situation of the IP terminal accessing the external data center can be determined based on the data analysis results, so that it is possible to accurately determine whether the object accessing the external data is abnormal, and then execute the target operation based on the abnormal situation. Therefore, the problem of difficulty in operation and maintenance caused by the inability to effectively monitor the IP terminal can be solved, thereby achieving the effect of improving operation and maintenance efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0041] Figure 1 A system architecture diagram of the prior art provided for the embodiments of the present application;
[0042] Figure 2 A system architecture diagram of the present application provided for an embodiment of the present application;
[0043] Figure 3 A schematic diagram of an application environment provided for an embodiment of the present application;
[0044] Figure 4 A schematic diagram of a flow chart of a data packet analysis method in one embodiment;
[0045] Figure 5 A schematic diagram of a data packet capture process in one embodiment;
[0046] Figure 6 is a schematic structural block diagram of a data packet analysis device in an embodiment;
[0047] Figure 7FIG. 4 is a schematic structural block diagram of a computer device in an embodiment. DETAILED DESCRIPTION
[0048] The embodiment of the present application provides a data packet analysis method, which can effectively monitor data packets and solve the problem of difficult operation and maintenance caused by the inability to effectively monitor IP terminals.
[0049] The following will describe the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0050] In order to facilitate understanding of a data packet analysis system architecture provided in an embodiment of the present application, the present application first explains the data packet analysis system architecture in the prior art, and the specific description is as follows.
[0051] See also Figure 1 , which is a diagram of the prior art data packet analysis architecture provided in an embodiment of the present application.
[0052] In the prior art, an external data center transmits data to a core egress network device, which then transmits the data to a user end or an operator through the core egress network device. Usually, the core egress network device is configured as an intermediate device such as a gateway or a router. In this process, since the core egress network device is only responsible for data transmission conversion, its own computing resources are usually limited in order to reduce costs. Therefore, it is impossible to effectively monitor the network status between the external data center and the core egress network device using the prior art alone. Only when a problem occurs in the external data center or the user end will the network be checked section by section, making operation and maintenance difficult.
[0053] See also Figure 2 and Figure 3 , is an architecture diagram of a data packet analysis system provided in an embodiment of the present application, including an operator (corresponding to Figure 2 Client 202 in), core egress network device (corresponding to Figure 2 Network in), external data center (corresponding to Figure 2 204 in the core egress network device), and an external server (corresponding to Figure 2 The external server constitutes another branch of the core egress network device.
[0054] It should be noted that in actual application, the data packet analysis system may include more devices. For example, it may also include user equipment. When the data packet analysis system needs to be used, the user equipment will connect to the core egress network equipment, send or receive relevant data information forwarded by the core egress network equipment to the core egress network equipment, or replace the operator port with the user equipment port, thereby realizing data interaction between the user equipment port and the external data center.
[0055] Based on the above Figure 2 The data packet analysis system architecture is shown, and the method in the embodiment of the present application is described in detail below.
[0056] The data packet analysis method provided in the present application can be executed entirely on the server side, can be executed entirely on the client side, or can be executed jointly by the server 204 and the client 202. When the data packet analysis method is executed jointly by the server and the client, it can be applied to Figure 2 In the application environment shown, the client 202 communicates with the server 204 via a network.
[0057] The server 204 may obtain the operation or operation instruction forwarded by the terminal 202 through the core egress network device, and the server 204 may execute the operation or operation instruction from the user or operator of the terminal 202 .
[0058] The client 202 receives user instructions and identifies and classifies the user instructions.
[0059] The client 202 may be, but is not limited to, various user devices, such as computers, laptops, smart phones, tablet computers, and portable smart devices, and the server 204 may be implemented as an independent server or a server cluster consisting of multiple servers.
[0060] Example 1
[0061] See also Figure 4 , is a flow chart of a data packet analysis method provided in an embodiment of the present application, wherein the data packet analysis method comprises:
[0062] Step S401, when it is determined that a signal connection is established with a first port of a core egress network device, a first data packet is obtained through the first port, wherein the first data packet is obtained after the core egress network device processes an initial data packet transmitted from an external data center;
[0063] In this embodiment, a branch is established in the core export network device, and the analysis of the data packet is completed in the branch in order to avoid occupying the computing resources of the core export network device, so that the core export network device has sufficient computing resources to exchange data with other devices (such as external data centers, operators or user terminals, etc.). Compared with the existing technology, it can better ensure the timeliness of data exchange between the core export network device and other devices, and also can achieve further expansion of functions, that is, by adding other functional devices to the branch, the function of the entire system architecture is further expanded, thereby expanding the scope of application; at the same time, the first data packet is archived by the preset objective function function in order to unify the identification of data packets of different formats, so as to facilitate the subsequent process to identify and process these data packets.
[0064] For example, Figure 3 As shown, since all network data packets entering and leaving the data center need to be forwarded through the network device at the core exit, we can connect a server to the first port at position 2 (the server is running the aforementioned packet capture program that can obtain the first data packet according to the packet capture instruction).
[0065] It can be imagined that the number of first ports can be at least 2, and thus the corresponding number of external physical servers can also be at least two, so that multiple ports can be used to process different types of data packets captured according to different needs such as different time periods and different sizes. Similarly, the number of servers corresponding to the same port can also be at least two to improve the archiving efficiency of the first data packet.
[0066] Step S402, based on a preset target function, archiving the first data packet to obtain a second data packet in a target format;
[0067] In this embodiment, the preset target function may be (but not limited to) a function of libpcap, or other function that can realize a unified format archiving function. Similarly, the target format may be (but not limited to) a file format with a suffix of .pcap; and the instruction feedback is performed after the first port receives the first data packet in order to ensure that the first port can accurately receive the first data packet and avoid feedback of erroneous instructions, thereby ensuring the continuity and accuracy of subsequent operations.
[0068] For example, Figure 3 As shown, after the external server is connected to the network device at the core export, the first data packet is archived as a second data packet with a suffix of *.pcap file through the function of libpcap, and the archived second data packet is transmitted to the message queue to wait for further processing.
[0069] Step S403, based on a preset unpacking program, unpacking the second data packet to obtain structured data;
[0070] In this embodiment, the purpose of acquiring structured data is to acquire information such as IP contained in the target protocol layer, and then determine the transmission efficiency between different IPs, network conditions, whether the IP is an abnormal IP, and other information through subsequent processing. The target protocol layer includes (but is not limited to) data link layer, network layer, transport layer, and application layer. Correspondingly, the structured data includes (but is not limited to) ARP (Address Resolution Protocol) and RARP (Reverse Address Resolution Protocol) information of the data link layer protocol, IP protocol (Internet Protocol) and ICMP protocol (Internet Control Message Protocol) of the network layer protocol, TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) of the transport layer protocol, HTTP (Hyper Text Transfer Protocol), SSH (Secure Shell), DNS (Domain Name System) of the application layer protocol, and can be adjusted and changed according to the actual operating environment and actual needs.
[0071] It can be imagined that the unpacking program in this application can (but is not limited to) parse the data packet protocol of each layer based on the four-layer structure of TCP / IP (i.e., data link layer, network layer, transport layer, and application layer). When the actual needs and operating environment change, it can also be the data packet protocol parsed for a certain layer of protocol or other protocols, which will not be repeated here.
[0072] Step S404, performing consumption processing on the structured data to obtain first structured data, and storing the first structured data in a target database;
[0073] In this embodiment, the consumption processing of structured data is to determine the ownership of the IP in the structured data, so as to determine different processing strategies according to different IP ownership. Among them, the consumption processing of protocol information refers to further processing of the protocol, such as adding tags, data screening and classification, confidence calculation, etc.; the first structure data includes (but is not limited to) structured data after adding the ownership tag to the structured data, for example, determining whether it is an internal IP or an external IP, whether it is a whitelist or blacklist IP, for example, if the identification result is an internal IP, then determine its ownership attribute, such as belonging to the business system, data center, etc. The specific identification method can be identified by fields such as area, etc. If the identification result is an external IP, its country, city, province, city, operator, user subject and other attributes can be determined.
[0074] The purpose of storing the target protocol information in the target database is to persist the obtained target protocol information, so that when other operations are performed later, the relevant target protocol information can be directly called.
[0075] The target database may be (but not limited to) clickhouse, elsticsearch, Mongodb, etc. In this application, clickhouse is preferably used because clickhouse, as a column-based database, can reduce disk IO compared to other row-based databases. It can adapt to batch insertion and thus can read related data in batches faster.
[0076] Step S405, performing aggregation analysis on the first structure data in the target library to obtain a data analysis result, wherein the data analysis result includes IP-related information and / or operation-related information;
[0077] In this embodiment, the aggregation analysis process is to further calculate and determine the changes between different IPs, so that timely adjustments can be made according to the changes, thereby achieving the purpose of accurately monitoring the IP terminals.
[0078] Among them, aggregation analysis analyzes and calculates data from different angles according to needs. For example, it calculates the average network processing delay between two IPs, calculates the average network rate between two IPs, counts the packet loss between two IPs, calculates and generates the ranking of IPs that occupy the largest network bandwidth per unit time, counts abnormal external IPs and other IP-related information, and the average response time of DNS resolution of domain names and other operational-related information involved in subsequent operational processing. Subsequently, the corresponding strategy can be matched according to actual needs, or the relevant data can be visualized for feedback to achieve accurate monitoring of the target IP terminal.
[0079] It is conceivable that, in addition to the above analysis and calculation, other contents can be calculated and analyzed according to actual needs, such as the access frequency of a specific IP in a unit of time, etc., so as to meet the analysis needs in various situations.
[0080] Step S406, performing a target operation based on the IP association information and / or operation association information, wherein the target operation at least includes event visualization processing and / or abnormal event linkage processing.
[0081] In this embodiment, the visualization processing and / or abnormal event linkage processing performed may (but is not limited to) generate an IP blacklist and send the blacklist to the firewall to instruct the firewall to block continued access of the relevant IP, or send the IP blacklist to the workspace to generate a work order for instructing staff to perform IP facility maintenance or manual review. The IP list may also be sent to a digital panel and displayed to achieve visualization monitoring of the IP list, thereby achieving linkage with other IT facilities and solving the problems of high operation and maintenance costs and difficulty in operation and maintenance caused by the inability to effectively link with other IT facilities in the prior art.
[0082] It should be noted that the first condition may also include the target IP's access frequency to the external data center per unit time, the number of visits, the network transmission efficiency between the two target IPs, the packet loss threshold between the two IPs, and other conditions that can reflect the IP monitoring needs. All of these conditions can be used as the first condition of this application and will not be repeated here.
[0083] In an alternative embodiment,
[0084] After unpacking the second data packet based on the preset unpacking program to obtain structured data, the method further includes:
[0085] Step S4031, based on the timestamp included in the structured data, transmitting the structured data to the target message queue in multiple threads;
[0086] The consuming process of the structured data to obtain the first structured data includes:
[0087] Step S4041: based on the timestamp, sequentially obtain the structure data from the target message queue; process the structure data to obtain the first structure data.
[0088] In this embodiment, since the parsed structured data also includes a timestamp, there is no need to design an additional thread to sort the protocol information during subsequent identification or processing. The protocol information can be identified and judged directly based on the timestamp, thereby further saving computing power and improving data processing efficiency.
[0089] In an optional embodiment, the structured data is processed to obtain the first structured data:
[0090] Step S4031, obtaining IP information contained in the structured data;
[0091] Step S4032: Based on the IP attribution information, the structured data is identified to obtain the first structured data.
[0092] In this embodiment, the purpose of obtaining IP information and performing identification processing on the IP information is to facilitate classification according to attributes such as the type of IP information, so that the corresponding IP attributes can be quickly identified in subsequent processing.
[0093] It should be noted that the resolved IP information may originally contain identification information, but in order to avoid the disguise of malicious or abnormal IPs to invade external data centers, it is necessary to re-identify through consumer aggregation analysis; it is conceivable that in this process, comparison steps or identification and judgment steps can be added to further strengthen this prevention function.
[0094] In an optional embodiment, before obtaining the first data packet through the first port, the method further includes:
[0095] Step S4011, when the initial data packet is received at the second port, the initial data packet is copied and processed by the target program to obtain the first data packet, and the first data packet is transmitted to the first port, wherein the second port is communicatively connected to the external data center, and the initial data packet includes data packets entering and leaving the external data center.
[0096] In this embodiment, the purpose of copying and transmitting the initial data packet through the target program is to expand the scope of use and adapt to the common server connection method. If the servers are connected through other network architectures, this step is not necessarily required. For example, if the servers are connected through the network architecture of the Kubernetes cluster, this is because there are many virtual network cards on the servers of the Kubernetes cluster, and all network traffic needs to communicate data with other servers in the cluster through the physical network card of the server, so this step is not required.
[0097] Among them, the target program can be (but not limited to) the SPAN function program on the core export network device. Among them, SPAN technology is mainly used to monitor the data flow on the switch, which is roughly divided into two types, local SPAN program (Local Switched Port Analyzer, SPAN) and remote SPAN program (Remote SPAN, RSPAN). Using SPAN technology, we can copy or mirror the data flow of some ports to be monitored (hereinafter referred to as controlled ports) on core export network devices such as switches, and send them to the traffic analyzer connected to the monitoring port, such as the IDS (intrusion detection system) of some routers. It should be noted that the port executing SPAN can be on the same switch (local SPAN) or on different switches (remote SPAN), for example, the controlled port and monitoring port of a PC equipped with the SNIFFER tool are located on different switches.
[0098] In an optional embodiment, when it is determined that a signal connection is established with a first port of a core egress network device, obtaining a first data packet through the first port includes:
[0099] Step S4012, when it is determined that a signal connection is established with the first port, performing a network card scanning operation on a target network card through a first program to determine network card information of the target network card, wherein the target network card is connected to the first port;
[0100] Step S4013, the first program obtains the first data packet from the first port according to the network card information, and sends a startup instruction to the second program to instruct the second program to archive the first data packet based on a preset target function to obtain a second data packet in a target format.
[0101] In this embodiment, the network card of the first port is scanned in order to determine the situation of the network card performing data transmission on the first port, so that relevant data can be received and transmitted in an orderly manner according to the network card information, and one-to-one correspondence can be achieved, thereby ensuring that the network card of the first port can accurately transmit the data; and after determining the network card information, instructing the first port to perform a packet capture operation in order to avoid erroneous packet capture caused by direct stimulation of network card information that does not meet the requirements, such as causing the first data packet to be incomplete, or low packet capture efficiency due to the network card transmission efficiency not meeting the requirements.
[0102] The network card scanning of the first port may be a dynamic scan or other scanning methods; the corresponding network card information includes (but is not limited to) the serial number, transmission efficiency, IP path, transmission time, transmission protocol and other information of the network card.
[0103] For example, Figure 3 and Figure 5 As shown, the packet capture program (corresponding to the aforementioned first program) first dynamically scans the network card name of the physical server A1. In order to improve the packet capture efficiency, a capture program A2 (corresponding to the aforementioned second program) can be started for each network card of A1, and then the capture program A2 performs packet capture operations on the first port.
[0104] In an optional embodiment, the performing of the target operation based on the IP association information and / or the operation association information includes at least one of the following:
[0105] Performing information visualization operations based on the IP-related information and / or the operation-related information;
[0106] Determine the network quality between the regions where the target object is located based on the IP association information and / or the operation association information;
[0107] Based on the IP association information and / or the operation association information, sending a configuration instruction to the target server to instruct the target server to generate a first list;
[0108] Based on the IP association information and / or operation association information, a work order operation command is sent to the target object to instruct the target object to generate a target work order and send the target work order.
[0109] In this embodiment, the network quality between the regions where the target objects are located is determined in order to facilitate the optimization of related networks when the network quality does not meet the requirements. It is conceivable that after the network quality is determined, the network quality can be transmitted to the visualization platform for intuitive observation; similarly, the first list is generated to facilitate call queries, thereby improving the processing efficiency of data packets, wherein the generated first list can be (but not limited to) a blacklist or a list that requires manual processing; generating a target work order can directly enable the target object to perform manual operations or other processing according to the target work order, thereby realizing linkage with other IT facilities. For example, the staff can optimize the network according to the target work order, manually check abnormal IPs, or perform other forms of maintenance.
[0110] The target objects may be, but are not limited to, servers, operation and maintenance personnel, etc.
[0111] According to another embodiment of the present invention, Figure 6As shown, a data packet analysis device is provided, comprising:
[0112] A data capture module 61 is used to obtain a first data packet through a first port of a core egress network device when it is determined that a signal connection is established with the first port of the core egress network device, wherein the first data packet is obtained after the core egress network device processes an initial data packet entering and exiting an external data center;
[0113] A data archiving module 62, based on a preset target function, performs archiving processing on the first data packet to obtain a second data packet in a target format;
[0114] A data unpacking module 63, configured to unpack the second data packet based on a preset unpacking program to obtain protocol information of a target protocol layer contained in the second data packet;
[0115] A data consumption module 64 is used to consume the structured data to obtain first structured data, and store the first structured data in a target database;
[0116] Aggregation analysis module 65, used for performing aggregation analysis on the first structure data in the target library to obtain data analysis results, wherein the data analysis results include IP related information and / or operation related information;
[0117] The target operation module 66 is used to perform a target operation based on the IP association information and / or operation association information, wherein the target operation at least includes event visualization processing and / or abnormal event linkage processing.
[0118] In an alternative embodiment,
[0119] The data unpacking module 63 further includes: a data transmission unit 631, configured to, after unpacking the second data packet based on the preset unpacking program to obtain structured data, transmit the structured data to a target message queue in a multi-threaded manner based on a timestamp included in the structured data;
[0120] The data consumption module 64 also includes: a data processing unit 641, which is used to obtain the structure data from the target message queue in sequence based on the timestamp; and process the structured data to obtain the first structure data.
[0121] In an optional embodiment, the data processing unit 641 includes:
[0122] The IP attribution subunit 6411 is used to obtain the IP attribution information contained in the structured data;
[0123] The identification subunit 6412 is used to perform identification processing on the structured data based on the IP attribution information to obtain the first structure data.
[0124] In an optional embodiment, the device further comprises:
[0125] The instruction receiving module 601 is used to receive a packet capture instruction before obtaining the first data packet through the first port, wherein the packet capture instruction is sent by the first port when the first data packet is received, and the first data packet is copied and transmitted by the target program to the initial data packet received by the second port of the core export network device, and the second port is communicatively connected to an external data center, and the initial data packet is transmitted from the external data center to the second port.
[0126] In an optional embodiment, the data capture module 61 includes:
[0127] A network card scanning unit 611 is used to perform a network card scanning operation on a target network card through a first program to determine network card information of the target network card when it is determined that a signal connection is established with the first port, wherein the target network card is connected to the first port;
[0128] The data capture unit 612 is used to obtain the first data packet from the first port according to the network card information through the first program, and send a startup instruction to the second program to instruct the second program to archive the first data packet based on a preset target function to obtain a second data packet in a target format.
[0129] In an optional embodiment, the performing of the target operation based on the IP association information and / or the operation association information includes at least one of the following:
[0130] Performing information visualization operations based on the IP-related information and / or the operation-related information;
[0131] Determine the network quality between the regions where the target object is located based on the IP association information and / or the operation association information;
[0132] Based on the IP association information and / or the operation association information, sending a configuration instruction to the target server to instruct the target server to generate a first list;
[0133] Based on the IP association information and / or operation association information, a work order operation command is sent to the target object to instruct the target object to generate a target work order and send the target work order.
[0134] The present invention is described below by means of specific embodiments.
[0135] This application provides a data packet analysis method, such as Figure 3 and Figure 5 As shown, in a specific embodiment, the following steps are mainly included:
[0136] S31: Connect a physical server to a port on the switch and enable the SPAN function (if the application scenario is network packet analysis of a Kubernetes cluster, please skip S1 and start from S2);
[0137] S32: Packet capture program: Generates *.pcap file by capturing the physical network card of the server;
[0138] S33: Upload program: grab the *.pcap file and upload it to the message queue;
[0139] S34: Consumer program: consume, process, and output the parsed data to the database clickhouse or elasticsearch;
[0140] S35: Aggregation analysis program: Analyze data through the aggregation function of clickhouse and elasticsearch;
[0141] S36: Visualization and event linkage: Based on the results of aggregate analysis, a digital panel is implemented. At the same time, based on abnormal events, it is linked with firewall rules, nginx blacklist, and IT work order center.
[0142] In the above steps, the detailed steps of S31 are as follows:
[0143] like Figure 3 and Figure 5 As shown in the figure, all network packets entering and leaving the data center need to be forwarded through the network devices at the core exit. Therefore, we need to enable the SPAN function on the network devices at the core exit. Figure 2 The network data packet of the source port at position 1 is copied to the target port at position 2, and at the same time, a server is connected to the target port (the packet capture program of the present invention is running on this server). The function of the SPAN technology to copy the data packet is running in bypass mode and will not affect the performance of the network device.
[0144] For another application scenario: the application scenario of network packet analysis of kubernetes cluster, this step can be skipped, because there are many virtual network cards on the servers of kubernetes cluster, and all network traffic needs to communicate with other servers in the cluster through the physical network cards of the servers, so there is no need to use SPAN technology intervention. For this scenario, step S31 can be skipped and execution can be started directly from step S32.
[0145] In the above steps, the detailed steps of S32 are as follows:
[0146] The physical network card of the packet capture server Figure 3 When the packet capture program A2 is running, it can capture all the data packets entering and leaving the network devices at the core exit.
[0147] The following crawling details need to be combined Figure 5 The details of the packet capture program A2 are described in detail:
[0148] First, the packet capture program can dynamically scan the network card name of the physical server A1. A capture program A2 can be started for each network card of A1. Next, A2 archives the network data packet into a data packet file with the suffix .pcap every minute through the function based on libpcap. After the capture is completed, the .pcap data file path is notified to the A4 unpacking program in the form of message passing A3.
[0149] Then, the A4 unpacking program, based on the four-layer structure of TCP / IP: data link layer, network layer, transport layer, and application layer, parses out the data packet protocol of each layer, such as data link layer protocol ARP, RARP, network layer protocol: IP protocol, ICMP protocol, transport layer protocol: TCP, UDP, application layer protocol: http, ssh, dns, etc., and parses each data packet into a line of json data.
[0150] In the above steps, the detailed steps of S33 are as follows:
[0151] The parsed data above has a timestamp and does not need to be in order. It is uploaded to the message queue in a multi-threaded manner.
[0152] In the above steps, the detailed steps of S34 are as follows:
[0153] The consumer program is responsible for consuming data, processing data, and outputting data. There are three layers of pipelines in the consumption data, which are executed in sequence:
[0154] Input: responsible for consumption data (required);
[0155] Filter: responsible for processing data (optional);
[0156] It can be processed optionally. If it is an IP in a data center, you can add field identifiers such as the business system, data center, and available zone to which it belongs. If it is an external IP, you can identify the country, province, city, operator, user entity, etc.
[0157] Output: responsible for outputting data (required);
[0158] The processed data needs to be persisted. You can choose to use the following databases:
[0159] 1. clickhouse;
[0160] 2. elsticsearch;
[0161] 3. Mongodb;
[0162] In actual use, clickhouse is preferred. As a column-based database, it reduces disk IO and is faster for batch insertion and batch reading than row-based databases.
[0163] In the above steps, the detailed steps of S35 are as follows:
[0164] After S34 completes the writing of network analysis data to ClickHouse, the aggregate analysis based on this data includes the following:
[0165] 1. Average network processing delay between two IPs;
[0166] 2. Average network rate between two IPs;
[0167] 3. Packet loss statistics between two IPs;
[0168] 4. The top 10 IPs that occupy the most network bandwidth per unit time;
[0169] 5. Statistics of abnormal external IP addresses;
[0170] 6. Average response time of DNS domain name resolution;
[0171] In the above steps, the detailed steps of S36 are as follows:
[0172] Based on the data analysis results of the above step S35, the following problems can be solved:
[0173] 1. Display the network status in the form of a digital panel to facilitate data center operation and maintenance personnel to be on duty and troubleshoot.
[0174] 2. Network traffic data statistics can provide data basis for network billing of data centers.
[0175] 3. Distributed network quality detection: In different regional cities, the network delay of this data center can be detected by ping detection. After packet capture and analysis, the network quality from IPs in different regions to this data center can be analyzed.
[0176] 4. Security incidents, such as DNS hijacking, can be recorded in detail and reported to provide data basis for review.
[0177] 5. Abnormal IP can trigger the firewall or internal web server and configure the blacklist.
[0178] 6. Abnormal IP can trigger the IT work order center to send work orders to data center operation and maintenance personnel in a timely manner.
[0179] It should be noted that, in this embodiment, the software deployment method includes:
[0180] 1. Data center egress and core network equipment packet analysis application scenarios need to be deployed on the server connected to the switch.
[0181] 2. The application scenario of kubernetes cluster data packet analysis needs to be run on the kubernetes computing node in a daemonset containerized manner.
[0182] For the specific definition of the data packet analysis device, please refer to the definition of the data packet analysis method above, which will not be repeated here. Each module in the above-mentioned data packet analysis device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0183] In one embodiment, a computer device is provided. The computer device provided in the embodiment of the present application may be a server or a client: Figure 7 , which is a schematic diagram of the structure of a computer device provided in an embodiment of the present application.
[0184] Processor 1701, memory 1702, bus 1705, interface 1704, processor 1701 is connected to memory 1702 and interface 1704, bus 1705 is respectively connected to processor 1701, memory 1702 and interface 1704, interface 1704 is used to receive or send data, processor 1701 is a single-core or multi-core central processing unit, or a specific integrated circuit, or one or more integrated circuits configured to implement an embodiment of the present invention. Memory 1702 can be a random access memory (RAM) or a non-volatile memory (non-volatile memory), such as at least one hard disk memory. Memory 1702 is used to store computer execution instructions. Specifically, the computer execution instructions may include program 1703.
[0185] In this embodiment, when the processor 1701 calls the program 1703, it can use Figure 7 The management server in performs the data packet analysis method operation, and the details are not repeated here.
[0186] It should be understood that the processor provided in the above embodiments of the present application may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0187] It should also be understood that the number of processors in the computer device in the above embodiments of the present application can be one or more, and can be adjusted according to the actual application scenario. This is only an exemplary description and is not limited. The number of memories in the embodiments of the present application can be one or more, and can be adjusted according to the actual application scenario. This is only an exemplary description and is not limited.
[0188] It should also be noted that when a computer device includes a processor (or processing unit) and a memory, the processor in this application can be integrated with the memory, or the processor and the memory can be connected through an interface. It can be adjusted according to the actual application scenario and is not limited.
[0189] The present application provides a chip system, which includes a processor for supporting a computer device (client or server) to implement the functions of the controller involved in the above method, such as processing the data and / or information involved in the above method. In one possible design, the chip system also includes a memory, which is used to store necessary program instructions and data. The chip system can be composed of a chip or a chip and other discrete devices.
[0190] In another possible design, when the chip system is a chip in a user device or access network, the chip includes: a processing unit and a communication unit. The processing unit may be, for example, a processor, and the communication unit may be, for example, an input / output interface, a pin or a circuit. The processing unit may execute computer-executable instructions stored in the storage unit so that the chip in the client or management server may execute steps S401-S404. Optionally, the storage unit is a storage unit in the chip, such as a register, a cache, etc. The storage unit may also be a storage unit located outside the chip in the client or management server, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), etc.
[0191] The present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a computer, the method flow executed by the controller of the client or management server in any of the above method embodiments is implemented. Correspondingly, the computer can be the above computer device (client or server).
[0192] It should be understood that the controller or processor mentioned in the above embodiments of the present application may be a central processing unit (CPU), or may be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
[0193] It should also be understood that the number of processors or controllers in the computer device (client or server) or chip system in the above embodiments of the present application can be one or more, and can be adjusted according to the actual application scenario. This is only an exemplary description and is not limited. The number of memories in the embodiments of the present application can be one or more, and can be adjusted according to the actual application scenario. This is only an exemplary description and is not limited.
[0194] It should also be understood that the memory or readable storage medium mentioned in the computer device (client or server) in the above embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DR RAM).
[0195] Those of ordinary skill in the art will appreciate that the steps of implementing all or part of the above-mentioned embodiments by a computer device (client or server) or a processor can be completed by hardware or a program to instruct the relevant hardware. The program can be stored in a computer-readable storage medium, and the storage medium mentioned above can be a read-only memory, a random access memory, etc. Specifically, for example: the above-mentioned processing unit or processor can be a central processing unit, a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. Whether the above-mentioned functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0196] When software is used for implementation, the method steps described in the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, a computer, a server, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server, or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, a data center, etc. that contains one or more available media integration. Available media can be magnetic media, (e.g., floppy disk, hard disk, tape), optical media (e.g., DVD), or semiconductor media, etc.
[0197] The terms "first", "second", etc. in the specification, claims and drawings of this application are used to distinguish
[0198] Similar objects, rather than being used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable in appropriate circumstances, which is merely a way of distinguishing the objects of the same attributes when describing them in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0199] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The singular forms of "a", "" and "the" used in the embodiments of the present application are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that in the description of the present application, unless otherwise specified, " / " indicates that the objects associated before and after are in an "or" relationship, for example, A / B can represent A or B; "and / or" in the present application is only a description of the association relationship of associated objects, indicating that three relationships can exist, for example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural.
[0200] As used herein, the words “if” or “if” may be interpreted as “at the time of” or “when” or “in response to determining” or “in response to detecting”, depending on the context. Similarly, the phrases “if it is determined” or “if (stated condition or event) is detected” may be interpreted as “when it is determined” or “in response to determining” or “when detecting (stated condition or event)” or “in response to detecting (stated condition or event)”, depending on the context.
[0201] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A data packet analysis method, characterized in that: The method comprises: When it is determined that a signal connection is established with a first port of a core egress network device, a first data packet is obtained through the first port, wherein the first data packet is obtained after the core egress network device processes an initial data packet entering and exiting an external data center; Based on a preset target function, archiving the first data packet to obtain a second data packet in a target format; Based on a preset unpacking program, unpacking the second data packet to obtain structured data; Performing consumption processing on the structured data to obtain first structured data, and storing the first structured data in a target database; Performing aggregation analysis on the first structure data in the target library to obtain a data analysis result, wherein the data analysis result includes IP-related information and / or operation-related information; Based on the IP association information and / or operation association information, executing a target operation, wherein the target operation at least includes event visualization processing and / or abnormal event linkage processing; After the second data packet is unpacked based on the preset unpacking program to obtain structured data, the method further includes: transmitting the structured data to a target message queue by multithreading based on a timestamp included in the structured data; The consuming process of the structured data to obtain the first structured data includes: acquiring the structured data from the target message queue in sequence based on the timestamp; processing the structured data to obtain the first structured data; Before obtaining the first data packet through the first port, the method further includes: When the second port receives the initial data packet, the initial data packet is copied and processed by the target program to obtain the first data packet, and the first data packet is transmitted to the first port, wherein the second port is communicatively connected to the external data center, and the initial data packet includes data packets entering and leaving the external data center.
2. The method according to claim 1, characterized in that The processing of the structured data to obtain the first structured data includes: Obtaining IP attribution information contained in the structured data; Based on the IP attribution information, identification processing is performed on the structured data to obtain the first structured data.
3. The method according to claim 1, characterized in that: In the case of determining that a signal connection is established with a first port of the core egress network device, acquiring a first data packet through the first port includes: When it is determined that a signal connection is established with the first port, a network card scanning operation is performed on a target network card through a first program to determine network card information of the target network card, wherein the target network card is connected to the first port; The first program obtains the first data packet from the first port according to the network card information, and sends The second program sends a start instruction to instruct the second program to perform archiving processing on the first data packet based on a preset target function to obtain a second data packet in a target format.
4. The method according to claim 1, characterized in that: The performing of the target operation based on the IP association information and / or the operation association information includes at least one of the following: Performing information visualization operations based on the IP-related information and / or the operation-related information; Determine the network quality between the regions where the target object is located based on the IP association information and / or the operation association information; Based on the IP association information and / or the operation association information, sending a configuration instruction to the target server to instruct the target server to generate a first list; When it is determined that the IP association information and / or operation association information is in an abnormal state, a work order operation command is sent to the target object to instruct the target object to generate a target work order and send the target work order.
5. A data packet analysis device, characterized in that: The device comprises: A data capture module, configured to obtain a first data packet through a first port of a core egress network device when a signal connection is determined to be established with the first port, wherein the first data packet is obtained after the core egress network device processes an initial data packet entering and exiting an external data center; A data archiving module, used for archiving the first data packet based on a preset target function to obtain a second data packet in a target format; A data unpacking module, configured to unpack the second data packet based on a preset unpacking program to obtain structured data; A data consumption module, used for performing consumption processing on the structured data to obtain first structured data, and storing the first structured data in a target database; An aggregation analysis module, used for performing aggregation analysis on the first structure data in the target library to obtain a data analysis result, wherein the data analysis result includes IP-related information and / or operation-related information; A target operation module, used to perform a target operation based on the IP association information and / or operation association information, wherein the target operation at least includes event visualization processing and / or abnormal event linkage processing; An instruction receiving module is used to receive a packet capture instruction before obtaining a first data packet through the first port, wherein the packet capture instruction is sent by the first port when the first data packet is received, the first data packet is copied and transmitted by the target program to the initial data packet received by the second port of the core export network device, the second port is communicatively connected to an external data center, and the initial data packet is transmitted from the external data center to the second port.
6. A computer device comprising a memory and a processor, wherein the processor is coupled to the memory, wherein: The memory stores at least one program instruction or code, and the at least one program instruction or code is loaded and executed by the processor so that the computer device implements the data packet analysis method described in any one of claims 1-4.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed, the steps of the method according to any one of claims 1 to 4 are implemented.
