A network traffic flow feature classification method based on improved GRU model
Through the improved GRU model and gated recurrent unit neural network, the timing characteristics are extracted using the stream packet length sequence, and the problems of model complexity and training time in the existing technology are solved, and the rapid and rapid development environment of the Internet is achieved. Accurate network traffic classification.
Patent Information
- Application Number
- CN202210450930.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-27
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2042-04-27
AI Technical Summary
The existing deep learning models have problems such as high model complexity, long training time and poor scalability in network traffic classification. Traditional methods fail when faced with changes in encryption protocols, making it difficult to meet the needs of rapid development of the Internet.
Using the improved GRU model, the flow packet length sequence is used as input, and the timing characteristics of traffic data are extracted through the gated recurrent unit neural network, reducing the model input scale, and improving classification speed and accuracy.
It realizes faster and more accurate network traffic classification in the environment of rapid development of the Internet, reduces the demand for computing resources, and is suitable for real-time traffic classification.
Smart Images

Figure CN114818928B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network traffic classification, and in particular to a network traffic flow feature classification method with an improved GRU model. Background Art
[0002] Network traffic classification (NTC) is one of the issues of great concern to Internet service providers and network operators. Network traffic classifiers identify traffic data flowing in the network and map them to the applications they belong to. Possible actions and countermeasures related to traffic class monitoring include filtering / blocking unwanted flows, initiating lawful intercept sessions, performing rerouting or resource reallocation when there are specific overload conditions, threats, or activities that violate the network operator's terms of service. The information provided by traffic classification is very valuable and sometimes essential for network operations. For example, operators need a detailed understanding of traffic composition and identify application usage trends to better design and provide networks. QoS solutions prioritize and treat traffic differently based on different criteria, and first need to classify traffic into different categories: when assigning packets to categories, it is crucial to identify the application to which the packets belong. In the same way, traffic classification supports differentiated class charging or service level agreement (SLA) verification. In addition, some national governments want ISPs to perform lawful interception of illegal or critical traffic, requiring them to understand exactly what type of content is transmitted through their networks. In fact, traffic classification represents the first step in traffic management and is a vital step in network management.
[0003] Deep learning has been well applied to image processing and natural language processing, and it has brought new research ideas to the field of encrypted traffic classification. In recent years, deep learning technologies that have performed well in natural language processing and image processing have been widely used in the field of traffic classification, such as convolutional neural networks, long short-term memory, etc. However, the most challenging trend in the development of the Internet is the huge growth of infrastructure in all aspects, such as the bandwidth capacity of links. Most practical applications of traffic classification require a trade-off between accuracy, performance, and cost to meet the needs of network monitors.
[0004] With the rapid development of Internet technology, the Internet plays an important role in public life and brings great convenience to network users. Therefore, accurate network traffic classification has become a basic task to more effectively improve the level of network management, improve service quality, and ensure network security. With the emergence of various new network applications, the scale of network traffic is also expanding, and network traffic classification has become more and more challenging. So far, researchers have proposed a lot of traffic classification methods. Due to the widespread use and upgrading of encryption protocols, the network traffic load characteristics and their statistical characteristics have changed significantly, and traditional traffic classification methods are no longer applicable. When machine learning is applied to the field of traffic classification, encrypted traffic identification has made some progress, but its good performance depends largely on excellent feature extraction and classification algorithm selection, which is very complex and time-consuming. In recent years, deep learning has been widely used in the field of traffic classification because it can automatically select underlying features from raw traffic. More importantly, methods based on deep learning have more powerful learning capabilities, so they can more easily handle heavy network tasks with multi-layer neural networks. In addition, they require less computing resources but can achieve higher accuracy than traditional methods. However, there are still some problems with deep learning traffic classification models, such as high model complexity, long training time, and low scalability.
[0005] In order to understand the development status of the prior art, the existing patents and documents were searched, compared and analyzed, and the following technical information with high relevance to the present invention was screened out:
[0006] Patent Solution 1: CN112770323A provides a mobile malicious application family classification method based on network traffic space-time characteristics, obtains the traffic of mobile terminal applications, extracts the complete TCP session flow; extracts the bytecode of the TCP data packet and the bytecode of the HTTP data packet in the TCP session; according to the obtained bytecode, uses the preset deep learning model to extract the traffic space characteristics and traffic time characteristics respectively, and obtains the classification result of the mobile malicious application family; the present disclosure extracts the bytecode of the TCP data packet and the bytecode of the HTTP data packet in the TCP session, uses the convolutional neural network to automatically extract the traffic space characteristics, and uses the long short-term memory network to automatically extract the traffic time characteristics, so as to achieve accurate classification of the mobile malicious application family. Disadvantages: Using convolutional neural networks and long short-term memory networks as deep learning models may cause the model to be too complex, the number of parameters is too large, and the model training time is too long, which is not suitable for real-time or early traffic classification. At the same time, the different splicing architectures of the convolutional neural network and the recurrent neural network may affect the experimental results.
[0007] Patent Solution 2: CN112598036A A network traffic classification method and system based on multi-scale feature attention, relating to a network traffic classification method and system. Among them, the network traffic classification method includes: obtaining network traffic data to be classified; obtaining a network traffic classification model; taking the network traffic data to be classified as input, and using the network traffic classification model to obtain the network traffic classification of the network traffic data to be classified. The network traffic classification method and system provided by the present invention, by using the optimized and trained support vector machine classification model (i.e., network traffic classification model) with network traffic data as input and network traffic classification as output to classify the network traffic data to be classified, can improve the classification speed while improving the accuracy of network traffic classification, thereby improving the overall classification efficiency. Disadvantages: Using a set of network byte stream sequences as the input of the neural network model may result in the data scale being too large, resulting in extremely high computing time and resource consumption. The length of the byte stream sequence will also affect the experimental results. If the length is too small, it will not be enough to express the characteristics of each application. Although a length that is too long can cover the byte streams generated by most applications, the lengths of the stream byte sequences generated by different applications vary greatly. Once all are converted into one-hot form, the data input to the neural network may be too sparse, making the training convergence time too long. Summary of the invention
[0008] In order to avoid the problems in the background technology, the present invention designs a network traffic flow feature classification method of an improved GRU model, takes the flow packet length sequence as input, uses the characteristics of small GRU network scale and fast fitting speed to analyze the traffic data, and extracts the time series characteristics of the traffic data. At the same time, the traditional bidirectional GRU recurrent neural network is improved, and a gating mechanism is added to improve the accuracy and speed of traffic classification.
[0009] The technical solution adopted by the present invention is:
[0010] A network traffic flow feature classification method for improving the GRU model includes the following steps:
[0011] S1: Capture the traffic data packets of the application in the link connection, convert the captured original traffic into a flow sequence, and split the original data packet flow according to the five-tuple. Then, based on the flow characteristics of the traffic data, convert the flow sequence into a flow packet length sequence. The processed traffic data constitutes a data set;
[0012] S2: Establish a deep learning traffic classification model based on gated recurrent unit neural network;
[0013] S3: Set the back propagation optimizer and loss function, use the data set to train the deep learning traffic classification model, use the trained deep learning traffic classification model to extract the time series features of the traffic data, connect the fully connected layer based on the extracted feature parameters, and then obtain the classification result through the softmax function.
[0014] Further, step S1 includes the following steps:
[0015] S11. Use network traffic monitoring software to capture a series of data packets generated during the use of the application in real time and continuously and store them in real time on an internal or external memory;
[0016] S12, divide the captured original traffic set P into a set of multiple subsets F = {f 1 , ..., f i , ..., f m}; m is the number of subsets divided by the original traffic, f i Indicates that the original traffic is divided into any sub-flow in multiple subsets; sub-flow f i =(x i , b i , d i , t i ) are arranged in time order, where x i Indicates a five-tuple consisting of source IP address, source port, destination IP address, destination port, and protocol number. i ∈[0,∞) is the subflow f i The size of all packets in the , in bytes, d i is substream f i The total transmission time, t i Then the sub-flow f i The time when the first packet in the packet stream starts to be transmitted;
[0017] S13, after converting the original traffic into a flow sequence, the flow packet length sequence is used as the flow feature sequence; assuming that there are N samples in the flow sequence training sample set, which always belong to C types of applications, then the pth flow sequence sample is expressed as:
[0018]
[0019] Where 0<p≤N,n p It is flow x p The number of packets, is the characteristic value of the data packet at time step i, indicating the length characteristic of the data packet, i = 1, 2, ... n p ;
[0020] S14, network flow x p n ppackets, each packet has a length t , then one-hot encode the data packet length sequence to obtain L' t =onehot(length t ), 0<t≤n p ,The preprocessed traffic data constitute the dataset.
[0021] Furthermore, the deep learning traffic classification model established in step S2 is specifically:
[0022] z t =σ(W z *[h t-1 , X t ]) (1)
[0023] r t =σ(W r *[h t-1 , X t ]) (2)
[0024]
[0025]
[0026] c t =σ(W c *[h t-1 , X t ]) (5)
[0027]
[0028] g t =σ(W g *[h t-1 , X t ]) (7)
[0029] h t =(1-g t )*X t +g t *h t (8)
[0030] In the formula, σ represents the activation function, usually the sigmoid function; z t represents the update gate, W z It represents the weight of the update gate; r t Represents the reset gate, W r It means resetting the weight of the gate, h t-1 represents the hidden state at the previous time step t-1, X t represents the input of the current neuron, represents the candidate hidden state of the current neuron; h t gru represents the output of the original GRU unit time step; c t and g t represents the parameters of another neural network; W g and W c is the weight parameter, and is the forward state output and backward state output of the bidirectional GRU network at the current time step t, and After connecting through formula (6), we can get is the output of a GRU neuron at a single time step.
[0031] Compared with the prior art, the present invention has the following advantages:
[0032] (1) The present invention extracts representative flow sequence features from the original flow sequence as the input of the neural network, rather than manually extracting the statistical features of the flow (i.e., the method commonly used in traditional machine learning methods, which is mainly based on rich experience, professional knowledge and a large amount of manpower). Through research and analysis, we use the flow packet length sequence as the representative feature input neural network model, which not only reduces the scale of the model input data, but also fully explores the time series characteristics of the traffic data.
[0033] (2) The present invention uses GRU and its derivative networks to learn flow features from the flow packet length sequence. The GRU network is a variant of LSTM. The performance of GRU is comparable to that of LSTM, but because of its relatively simple structure, it has higher computational efficiency and faster convergence speed, and better performance in parameter updating and generalization. At the same time, in order to improve the prediction accuracy of the GRU network, we have improved the basic bidirectional GRU network by adding a gating mechanism to train the deep network and selectively output according to the data characteristics, thus optimizing the disadvantage that the traditional neural network becomes more difficult to train as the depth increases. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 The figure is a flow chart of a method according to an embodiment of the present invention.
[0035] Figure 2 This is a GRU unit structure diagram of an embodiment of the present invention.
[0036] Figure 3 This is a diagram of the FGRU network structure of an embodiment of the present invention.
[0037] Figure 4 This is a schematic diagram of some traffic data of an embodiment of the present invention.
[0038] Figure 5The left figure shows the parameter status of each layer of the GRU network model of the present invention, and the right figure is a visualization display diagram of the model parameters of the present invention. DETAILED DESCRIPTION
[0039] The present invention will be further explained below in conjunction with the accompanying drawings.
[0040] The present invention provides a network traffic flow feature classification method for improving the GRU model, such as Figure 1 As shown, the specific analysis steps of the example are as follows:
[0041] S1: Capture the traffic packets of the application in the link connection. Convert the original traffic into a flow sequence. In this paper, we divide the original packet flow according to the traditional five-tuple, namely, source IP address, source port, destination IP address, destination port and protocol number; then, we further process the traffic data based on the flow characteristics of the traffic data, that is, convert the original flow sequence into a flow packet length sequence, and the processed traffic data constitutes the data set;
[0042] Wherein, step S1 specifically includes:
[0043] S11. Use network traffic monitoring software to capture a series of data packets generated during application use in real time and continuously and store them in real time to internal or external storage. Figure 4 shown.
[0044] S12. In the present invention, the traffic classification problem is to use the flow sequence as the only original traffic classification unit to classify the encrypted traffic into a specific application. The original flow can be represented as multiple sequences with the same flow length and different types (such as message type sequence and packet length sequence). In the present invention, the original traffic set P is divided into a set of multiple subsets F = {f 1 , …, f i , …, f m}, m is the number of subsets divided by the original traffic, f i Indicates that the original traffic is divided into any sub-flow in multiple subsets. i =(x i , b i , d i , t i ) are arranged in time order, where x i Represents a five-tuple consisting of source IP address, source port, destination IP address, destination port, and protocol number; b i ∈[0,∞) is the subflow f i The size of all packets in the , in bytes; d i is substream f i The total duration of the transmission; t i Then the sub-flow fi The time when the first packet in the packet stream starts to be transmitted.
[0045] S13. After converting the original traffic into a flow sequence, we extract appropriate features from the flow sequence for neural network input. Specifically, we use the flow packet length sequence (i.e., the number of bytes in each packet) as the flow feature, which is represented by mathematical methods. Assuming that there are N samples in the flow sequence training sample set, which always belong to C types of applications, the pth (0<p≤N) flow sequence sample can be expressed as
[0046]
[0047] n p It is flow x p The number of packets, is the characteristic value of the packet at time step i (here, Indicates the length characteristics of the data packet);
[0048] S14, convert the stream feature sequence into a fixed-length one-hot sequence in the form of one-hot encoding. p There are n p packets, each packet has a length t , we perform one-hot encoding on the packet length sequence to obtain L' t =onehot(length t ), (0<t≤n p ). The preprocessed traffic data will constitute the data set and serve as the training data for the subsequent neural network model.
[0049] S2: Establish a deep learning traffic classification model based on gated recurrent unit neural network; Figure 5 The parameter status of each layer of the neural network and the weight parameters of the network after training are displayed.
[0050] Wherein, step S2 specifically includes: in view of the fact that the extracted flow feature sequence has a certain temporal sequence, a gated recurrent neural network (Gated Recurrent Neural Network) is selected as a basic model to further analyze the extracted flow feature sequence. Gated recurrent unit (Gated Recurrent Unit, GRU) is a commonly used gated recurrent neural network, and GRU is an improved model of long short-term memory neural network (Long Short-Term Memory, LSTM). Long short-term memory neural network is a variation model of recursive neural network, which can solve the gradient explosion and gradient disappearance problems of recurrent neural network to a certain extent, and is therefore widely used in the prediction of time series data. However, there are still some problems with LSTM recurrent neural network. LSTM has a complex internal structure, and predicting time series data may require a long training time and prediction time. The present invention adopts a GRU neural network to make up for the shortcomings of the traditional LSTM network. The gated recurrent unit controls the information conversion between hidden states through gates, and tracks the state of the input sequence without using a separate storage unit. The advantage of GRU is the simplicity of its model and the small number of parameters, so it is more suitable for building a larger network. Compared to LSTM, it has only two gates, which makes it more efficient from a computational perspective, and its scalability is conducive to building larger models. GRU introduces the concepts of reset gate and update gate. The reset gate helps capture short-term dependencies in the time series, while the update gate helps capture long-term dependencies in the time series.
[0051] The present invention uses GRU and its derivative networks for traffic classification business scenarios. The calculation formula of the basic GRU network is shown in formula (1)(2)(3)(4):
[0052] z t =σ(W z *[h t-1 , X t ]) (1)
[0053] r t =σ(W r *[h t-1 , X t ]) (2)
[0054]
[0055]
[0056] Among them, σ represents the activation function, usually the sigmoid function; z t represents the update gate, W zIt represents the weight of the update gate; r t represents the update gate, W r It represents the weight of the update gate. The design of the update gate and reset gate is the same as that of the basic GRU. t-1 represents the hidden state of the previous neuron, X t represents the input of the current neuron, represents the candidate hidden state of the current neuron; h t gru Represents the output of the original GRU unit; Figure 2 The calculation process of the basic GRU network unit is shown.
[0057] In order to further improve the prediction ability of the neural network, we used a bidirectional GRU network in this invention. and Represents the forward state output and backward state output of time step t. The present invention improves the basic GRU algorithm. The improved GRU network is named FGRU, and the calculation formula of the gated neuron in the improved neural network is as follows:
[0058] c t =σ(W c *[h t-1 , X t ]) (5)
[0059]
[0060] g t =σ(W g *[h t-1 , X t ]) (7)
[0061] h t =(1-g t )*X t +g t *h t ′ (8)
[0062] Among them, c t and g t represents the parameters of another neural network; W g and W c is the weight parameter, and is the forward state output and backward state output of the bidirectional GRU network at the current time step t, and After connecting through formula (6), we can get is the output of a GRU neuron at a single time step.
[0063] Formulas (5), (6), (7), and (8) are newly added in the present invention, which show the improvement of the present invention on the bidirectional GRU, adding a gating mechanism to provide more accurate traffic classification results; we add c t and t , represents the parameters of another neural network; the connection between the forward state output and the backward state output is At this time, the output of the current neuron h t The calculation formula is expressed as h t =(1-g t )*x t +g t * h′ t ,h t The parameters of another neural network are connected. The overall model of the improved GRU network is as follows Figure 3 As shown, the stream packet length sequence is used as the input of the FGRU network unit. The FGRU network is used to capture the dependencies between time steps in the time series and output feature representations.
[0064] S3: Set the back propagation optimizer and loss function, use the data set to train the deep learning traffic classification model, use the trained deep learning traffic classification model to extract the time series features of the traffic data, connect the fully connected layer based on the extracted feature parameters, and then obtain the classification result through the softmax function.
[0065] Specifically, the output of the FGRU network is connected to the fully connected layer, and finally connected to the softmax function to output the classification result. Set the back propagation optimizer, loss function, etc. to fit the training data. The FGRU network structure is as follows Figure 3 Table 1 shows the classification results of some data.
[0066] Serial number IP1 PORT1 IP2 PORT2 PROTOCAL Classification results 1 10.8.8.138 45849 204.236.238.164 1781 TCP VPN-FTP 2 204.236.238.164 1544 10.8.8.138 59886 TCP VPN-FTP 3 10.8.8.138 43336 75.101.155.12 22 TCP VPN-FTP 4 75.101.155.12 47126 75.101.155.12 22 TCP VPN-SKYPE
[0067] Table 1: Classification results of some traffic data.
Claims
1. A network traffic flow feature classification method based on an improved GRU model, characterized in that: The following steps are involved: S1: Capture the traffic data packets of the application in the link connection, convert the captured original traffic into a flow sequence, and split the original data packet flow according to the five-tuple. Then, based on the flow characteristics of the traffic data, convert the flow sequence into a flow packet length sequence. The processed traffic data constitutes a data set; S2: Establish a deep learning traffic classification model based on gated recurrent unit neural network; S3: Set the back propagation optimizer and loss function, use the data set to train the deep learning traffic classification model, use the trained deep learning traffic classification model to extract the time series features of the traffic data, connect the fully connected layer based on the extracted feature parameters, and then use the softmax function to obtain the classification result; Wherein, step S1 comprises the following steps: S11. Use network traffic monitoring software to capture a series of data packets generated during the use of the application in real time and continuously and store them in real time on an internal or external memory; S12, divide the captured original traffic set P into a set of multiple subsets F = {f 1 ,…,f i ,…,f m }; m is the number of subsets divided by the original traffic, f i Indicates that the original traffic is divided into any sub-flow in multiple subsets; sub-flow f i =(x i ,b i ,d i ,t i ) are arranged in time order, where x i Indicates a five-tuple consisting of source IP address, source port, destination IP address, destination port, and protocol number. i ∈[0,∞) is the subflow f i The size of all packets in the , in bytes, d i is substream f i The total transmission time, t i Then the sub-flow f i The time when the first packet in the packet stream starts to be transmitted; S13, after converting the original traffic into a flow sequence, the flow packet length sequence is used as the flow feature sequence; assuming that there are N samples in the flow sequence training sample set, which always belong to C types of applications, then the pth flow sequence sample is expressed as: Among them, 0 <p≤N,n p It is flow x p The number of packets, is the characteristic value of the data packet at time step i, indicating the length characteristic of the data packet, i = 1, 2, ... n p ; S14, network flow x p n p packets, each packet has a length t , then one-hot encode the data packet length sequence to obtain L' t =onehot(length t ),0 <t≤n p ,The preprocessed traffic data constitute the data set; The deep learning traffic classification model established in step S2 is specifically: z t =σ(W z *[h t-1 ,X t ]) (1) r t =σ(W r *[h t-1 ,X t ]) (2) c t =σ(W c *[h t-1 ,X t ]) (5) g t =σ(W g *[h t-1 ,X t ]) (7) h t =(1-g t )*X t +g t *h t ’ (8) In the formula, σ represents the activation function, using the sigmoid function; z t represents the update gate, W z It represents the weight of the update gate; r t Represents the reset gate, W r It means resetting the weight of the gate, h t-1 represents the hidden state at the previous time step t-1, X t represents the input of the current neuron, represents the candidate hidden state of the current neuron; h t gru represents the output of the original GRU unit time step; c t and g t represents the parameters of another neural network; W g and W c is the weight parameter, and is the forward state output and backward state output of the bidirectional GRU network at the current time step t, and After connecting through formula (6), we get is the output of a GRU neuron at a single time step.
Citation Information
Patent Citations
Network traffic classification method and system
CN112598036A
Mobile malicious application family classification method based on network traffic space time characteristics
CN112770323A
A UUV cluster behavior recognition technology based on SGRU neural network
CN109409200A
Network traffic classification method and device based on neural network and attention mechanism
CN111209933A
GRU parallel network flow anomaly detection method based on GA optimization
CN111726349A
