in front of the Libpcap capture packet, especially in the gigabit network conditions, a large number of drops, online search for a long time, probably all Pf_packet +mmap,napi,pf_ring and other methods, I pf_ring+libpcap experiment, The detection of gigabit network conditions, capturing the performance of the packet is very good, almost no packet loss, the experimental environment with the following process:
1) Download PF_RING:SVN Co https://svn.ntop.org/svn/ntop/trunk/PF_RING/
2) After downloading, make compile pf_ring under Pf_ring/kernel, generate Pf_ring.ko
3) insmod Pf_ring.ko Thansparent_mode =1
4) CD into the Lib directory, modify the makefile, the installation directory point to usr/, if not modified, will point to/usr/local
5) In the Lib directory, make, then make install
6) CD into the libpcap-1.1.1-ring directory, modify the source code, the pf_ring core ring buffer set to 2M, the default 0.5M, and then modify the makefile, the installation directory to usr/, the default point to Usr/local. Then compile make and make install;
7) In this way, the libpfring.so, pfring_e1000e_dna.h,pfring.h,libpfring.a copied to the Usr/include or usr/lib, at the same time with The libpcap-1.1.1-ring library file replaces the original Libpcap library file;
8) The environment is finished, the application remembers to add # define have_pf_ring to the application's header file;
9) You will find that performance has been greatly improved and improved by more than 60%. But CPU usage also increases correspondingly, CPU utilization is used in the terminal to use Top view.
Above excerpt from: http://blog.csdn.net/smilestone_322/article/details/6281395
Linux Fedora 14 (kernel 2.6.35.6) Pf_ring+libpcap Fast capture Gigabit network packet, no packet loss