Hyper text transport protocol (http) flow collection method applied to gateway equipment

By using the Linux kernel Netfilter module and application layer module on the gateway device to intercept and filter HTTP traffic characteristics, it solves the problems of increased cost and occupied bandwidth in the existing technology, achieves efficient and accurate HTTP traffic collection, and ensures network speed and Proper operation of hardware forwarding functionality.

CN118659987APending Publication Date: 2024-09-17WUXI YANQIN INFORMATION TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410809803.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-21
Publication Date
2024-09-17

AI Technical Summary

Technical Problem

Existing HTTP traffic collection methods require the establishment of additional servers, which increases costs and network bandwidth usage, and cannot finely filter specific traffic data.

Method used

On the gateway device of the Linux system, through the kernel Netfilter module and the application layer module, data collection rules are issued according to the operator's needs, intercepting and filtering HTTP traffic characteristics, and sending them to the application layer data analysis module to realize traffic collection without affecting the hardware. Forwarding capabilities and network speed.

Benefits of technology

It achieves efficient and accurate collection of HTTP traffic data without adding hardware equipment or occupying network bandwidth, reduces collection costs, and supports adjusting the number of collected messages according to needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118659987A
    Figure CN118659987A
Patent Text Reader

Abstract

The invention relates to an http (Hyper Text Transport Protocol) flow collection method applied to gateway equipment. The system comprises a kernel acquisition module, an application layer acquisition management module and an application layer data analysis module, and the method comprises the following steps: issuing a data acquisition rule to a kernel Netfilter module of the Linux system through the application layer acquisition management module according to the requirements of an operator; after data of a driving layer is processed through a Linux network protocol stack, the kernel Netfilter module intercepts traffic characteristics needing to be collected according to the data collection rule and sends the traffic characteristics to the kernel collection module; and the kernel acquisition module filters out an http message needing to be acquired according to the received traffic characteristics, and sends the http message to the application layer data analysis module. According to the method and the device, the flow collection function can be realized on the premise of not adding collection equipment, not influencing the hardware forwarding function of the gateway and not influencing the network rate of a user.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of network traffic collection, and in particular to an HTTP traffic collection method applied to a gateway device. Background Art

[0002] In order to optimize the user network experience, network operators collect HTTP traffic data on gateway devices to analyze user access habits and collect information such as network load and latency.

[0003] The existing collection solutions mirror the http data traffic to the collection server by setting up port mirroring on the gateway; or set up an additional proxy server and complete data collection by setting the proxy server address as the next forwarding address on the gateway. However, these methods have the following disadvantages: It requires additional servers, which is costly and takes up extra network bandwidth, affecting the user's network speed. It is not possible to perform fine-grained filtering and collection on specific traffic during collection, such as collecting only the http destination address, destination port, MAC address of the user device sending the traffic, http request method GET or POST, http response code, http header content and other information. Summary of the invention

[0004] To this end, the present invention provides an http traffic collection method applied to a gateway device, which can realize the function of traffic collection without adding new collection equipment, affecting the hardware forwarding function of the gateway, and affecting the user's network rate.

[0005] In order to solve the above technical problems, the present invention provides an http traffic collection method applied to a gateway device, which is applied to a gateway device of a Linux system, including a kernel collection module, an application layer collection management module and an application layer data analysis module. The method includes: According to the needs of the operator, the data collection rules are sent to the kernel Netfilter module of the Linux system through the application layer collection management module; After the data of the driver layer is processed by the Linux network protocol stack, the kernel Netfilter module intercepts the traffic features to be collected according to the data collection rules and sends them to the kernel collection module; The core collection module filters out the http messages that need to be collected according to the received traffic characteristics, and sends the http messages to the application layer data analysis module.

[0006] In one embodiment of the present invention, the traffic characteristics include http destination address, destination port, MAC address of the user device sending the traffic, http request method GET or POST, http response code and http header content.

[0007] In one embodiment of the present invention, the data of the driver layer includes user access data entering from the Ethernet driver of the gateway and http response data entering from the PON driver.

[0008] In one embodiment of the present invention, the kernel collection module filters out the http messages to be collected according to the received traffic characteristics, including: By parsing the TCP message, identifying the HTTP message header content, filtering out the HTTP messages that need to be collected according to the HTTP request method, HTTP response code, and HTTP message header content.

[0009] In one embodiment of the present invention, sending the http message to the application layer data analysis module includes: The http message is sent via socket to the 127.0.0.1 port monitored by the application layer data analysis module.

[0010] In one embodiment of the present invention, the core acquisition module includes a control interface for implementing acquisition function switching.

[0011] In one implementation of the present invention, after data collection, the access traffic continues to be forwarded to the upstream device along the original route.

[0012] In one embodiment of the present invention, the application layer collection management module sends data collection rules to the kernel Netfilter module of the Linux system through iptables instructions.

[0013] The above technical solution of the present invention has the following advantages compared with the prior art: The HTTP traffic collection method applied to a gateway device described in the present invention is based on the Netfilter framework of the Linux kernel, configures data collection rules through iptables, intercepts HTTP traffic using a kernel module, and then sends the intercepted traffic to the application layer for further analysis. Data collection is completed by adding a new software module in the gateway device, and no additional hardware equipment is needed, thereby reducing the low cost of data collection.

[0014] The acquisition process of the present invention is performed in the stage before the gateway hardware acceleration, ensuring that the normal hardware forwarding function of the gateway is not affected and the user's network bandwidth is not occupied, ensuring that the user's network rate is not affected.

[0015] The present invention identifies and filters data features before data collection, removes redundant data directly at the data source, and supports adjusting the number of collected messages as needed, thereby improving the efficiency and accuracy of data collection. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to make the contents of the present invention more clearly understood, the present invention is further described in detail below based on specific embodiments of the present invention in conjunction with the accompanying drawings.

[0017] Figure 1 It is a logical framework diagram of the http traffic collection method applied to a gateway device according to the present invention. DETAILED DESCRIPTION

[0018] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.

[0019] Reference Figure 1 As shown, a method for collecting HTTP traffic on a gateway device is applied to a gateway device of a Linux system. In order to efficiently and accurately collect and analyze HTTP traffic on a gateway device of a Linux system, the method includes a kernel collection module, an application layer collection management module and an application layer data analysis module. The method includes: S1. According to the needs of the operator, the data collection rules are sent to the kernel Netfilter module of the Linux system through the application layer collection management module.

[0020] Netfilter is a framework in the Linux kernel that processes and filters network packets. iptables is a user space tool that allows you to configure Netfilter rules.

[0021] The application layer collection management module issues data collection rules through the following iptables instructions: iptables -t mangle -I PREROUTING -p tcp --dport x -m mac --mac-sourcexx-xx-xx-xx-xx-xx -j CAIJI.

[0022] This iptables command is used to insert a rule in the PREROUTING chain of the mangle table (the PREROUTING chain is used to process packets before they reach the routing decision) to match packets with a specific TCP destination port and MAC address, and mark these packets as CAIJI for collection. Among them: -t mangle: Specifies to use the mangle table, which is mainly used to modify data packets.

[0023] -I PREROUTING: Insert a rule into the PREROUTING chain, which is used to process packets before they reach a routing decision.

[0024] -p tcp: Specifies packets matching the TCP protocol.

[0025] --dport x: Matches packets with destination port x.

[0026] -m mac --mac-source xx-xx-xx-xx-xx-xx: matches packets with source MAC address xx-xx-xx-xx-xx-xx.

[0027] -j CAIJI: Mark matching packets as CAIJI for collection.

[0028] S2. After the data of the driver layer is processed by the Linux network protocol stack, the kernel Netfilter module intercepts the traffic features to be collected according to the data collection rules and sends them to the kernel collection module.

[0029] When a data packet passes through the Linux network protocol stack, the kernel Netfilter module intercepts traffic features that meet the conditions according to the configured collection rules. The traffic features include the http destination address, destination port, MAC address of the user device sending the traffic, http request method (GET or POST), http response code, and http header content.

[0030] The sources of data of the driver layer include: user access data entering from the Ethernet driver of the gateway, and http response data entering from the PON (passive optical network) driver.

[0031] S3. The kernel collection module filters out the http messages that need to be collected according to the received traffic characteristics, and sends the http messages to the application layer data analysis module.

[0032] After data collection, the access traffic continues to be forwarded to the upstream device along the original route, ensuring that the system does not affect the user's normal network use during the data collection process, while providing efficient and accurate data analysis functions.

[0033] Specifically, the kernel collection module parses the TCP message, identifies the HTTP message header content, filters out the HTTP message that needs to be collected according to the HTTP request method, HTTP response code, and HTTP message header content, and then sends the HTTP message through socket to the 127.0.0.1 port monitored by the application layer data analysis module.

[0034] The kernel collection module is a netfilter target module newly registered with CAIJI, including a control interface for implementing a collection function switch, which supports data collection according to the requirements of parameters such as the number of messages and message size.

[0035] By adding a new software module to the gateway device to complete data collection, there is no need to add any additional hardware equipment, thereby reducing the cost of data collection. The collection process is carried out before the gateway hardware acceleration stage to ensure that it does not affect the normal hardware forwarding function of the gateway and does not occupy the user's network bandwidth, ensuring that the user's network rate is not affected.

[0036] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0037] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0038] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1A function specified in one or more boxes.

[0039] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0040] Finally, it should be noted that the above specific implementation methods are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to examples, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention, which should be included in the scope of the claims of the present invention.

Claims

1. A method for collecting http traffic on a gateway device. It is characterized in that A gateway device applied to a Linux system includes a kernel acquisition module, an application layer acquisition management module and an application layer data analysis module, and the method includes: According to the needs of the operator, the data collection rules are sent to the kernel Netfilter module of the Linux system through the application layer collection management module; After the data of the driver layer is processed by the Linux network protocol stack, the kernel Netfilter module intercepts the traffic features to be collected according to the data collection rules and sends them to the kernel collection module; The core collection module filters out the http messages that need to be collected according to the received traffic characteristics, and sends the http messages to the application layer data analysis module.

2. According to claim 1, a method for collecting http traffic applied to a gateway device, It is characterized in that The traffic characteristics include http destination address, destination port, MAC address of the user device sending the traffic, http request method GET or POST, http response code and http header content.

3. According to claim 1, a method for collecting http traffic applied to a gateway device, It is characterized in that The data of the driver layer includes user access data entering from the Ethernet driver of the gateway and http response data entering from the PON driver.

4. According to claim 1, a method for collecting http traffic applied to a gateway device, It is characterized in that The core collection module filters out the http messages that need to be collected according to the received traffic characteristics, including: By parsing the TCP message, identifying the HTTP message header content, filtering out the HTTP messages that need to be collected according to the HTTP request method, HTTP response code, and HTTP message header content.

5. According to claim 1, a method for collecting http traffic applied to a gateway device, It is characterized in that Sending the http message to the application layer data analysis module includes: The http message is sent via socket to the 127.0.0.1 port monitored by the application layer data analysis module.

6. According to claim 1, a method for collecting http traffic applied to a gateway device, It is characterized in that The core acquisition module includes a control interface for implementing acquisition function switching.

7. The method for collecting http traffic on a gateway device according to claim 1, It is characterized in that After data collection, access traffic continues to be forwarded to the upstream device along the original route.

8. According to claim 1, a method for collecting http traffic applied to a gateway device, It is characterized in that The application layer collection management module sends data collection rules to the kernel Netfilter module of the Linux system through iptables instructions.

Citation Information

Cited By

  • Network quality acquisition method and system based on gateway side connection metadata

    CN122601510A