Font Size: a A A

Design And Implementation Of Network Packet Capture And Analysis System Based On EBPF

Posted on:2021-08-25Degree:MasterType:Thesis
Country:ChinaCandidate:O N JiangFull Text:PDF
GTID:2518306104994259Subject:Software engineering
Abstract/Summary:PDF Full Text Request
Network packet capture and analysis technology is the cornerstone of many network security tools.In the high-speed network environment,the traditional technical scheme has the problems of incomplete packet capture and excessive system resources occupied by network traffic analysis.In recent years,eBPF(extended Berkeley Packet Filter)technology has been widely used because it has the characteristics of dynamically changing the behavior of the system by inserting the hook function composed of eBPF bytecode program into the running Linux system.Taking the eBPF hook function inserted into the network card driver as the core and other network subsystem auxiliary function blocks,a technical framework called XDP(e Xpress Data Path)is formed in the Linux kernel.It provides a mechanism to complete the network packet analysis processing in the hardware driver layer.Based on this mechanism,this paper constructs a network packet capture and analysis system:(1)Based on the analysis of the shortcomings of the existing mainstream network packet capture and analysis technology and the advantages of using XDP to capture and analyze network packets,a lockless ring queue used in XDP is designed and implemented.At the same time,on the Realtek rtl81 xx series network card,which are widely used,XDP characteristics supported by the hardware driver are implemented.The combination of the two can achieve the purpose of efficient packet transmission from the kernel to the application.(2)In order to improve the efficiency of eBPF program development,py2 bpf open source software is introduced,but it lacks the function of generating eBPF programs for XDP.Therefore,the interface and implementation of XDP related technologies are added in its framework.(3)A set of packet analysis rules are designed and implemented in py2 bpf framework.According to the rules,packet filtering and redirection,packet protocol header content statistics,content-based traffic analysis and other policies can be implemented.These policies are converted into eBPF programs and injected into the running system.Based on the above foundation,the system completed in this paper can fully capture the data packets,and carry out various analysis and statistics on the data packets in the network hardware driver layer.The kernel space only needs to copy the analysis results to the user space,without copying the data packets themselves.The data transmission volume is greatly reduced and the system performance is greatly improved.The test results show that under the same hardware condition,with the increase of the packet length,the time required for the system to obtain the five tuple information of a single packet is reduced to 90%,62%,33%,17% and 6%of the traditional method,respectively.The longer the packet,the more obvious the performance advantage of the system.At the same time,the system supports that the rules of packet analysis are customized by user program using Python language,and can change the policy when the system is running,and take effect immediately,which improves the flexibility of the system.
Keywords/Search Tags:Network packet, Linux, Python, eBPF, XDP
PDF Full Text Request
Related items