LinuxFedora14 (kernel 2.6.35.6) PF_RING + libpcap fast capture of gigabit network packets without packet loss

Source: Internet
Author: User
Previously, we talked about libpcap packet capture, especially in the case of a gigabit network, which results in a large number of packet loss and a long time of searching on the Internet. This is probably a method like PF_PACKET + MMAP, NAPI, and PF_RING, I tested PF_RING + libpcap and found that the packet capture performance was good under gigabit network conditions, with almost no packet loss. The following figure shows how to configure the LinuxFedora14 experiment environment: 1) download PF_RING: svncohttps: // svn.ntop.org/sv

Previously, we talked about libpcap packet capture, especially in the case of a gigabit network, which results in a large number of packet loss and a long time of searching on the Internet. This is probably a method like PF_PACKET + MMAP, NAPI, and PF_RING, I tested PF_RING + libpcap and found that the packet capture performance was good under gigabit network conditions, with almost no packet loss. The configuration process of the Linux Fedora 14 experiment environment was as follows:

1) download PF_RING: svn co https://svn.ntop.org/svn/ntop/trunk/PF_RING/

2) After the download, compile PF_RING in pf_ring/kernel to generate pf_ring.ko.

3) insmod pf_ring.ko thansparent_mode = 1

4) Run cd in the lib directory, modify the MakeFile, and direct the installation directory to usr/. If no modification is made, it will point to/usr/local.

5) in the lib directory, make and then make install

6) cd into the libpcap-1.1.1-ring directory, modify the source code, the pf_ring kernel ring buffer is set to 2 M, the default 0.5 M, and then modify the MakeFile, the installation directory pointing to usr /, the default value is usr/local. Compile make, and then make install;

7) in this way, the libpfring. so, pfring_e1000e_dna .h, pfring. h, libpfring. a copied to usr/include or usr/lib, and replaced the original libpcap library file with the library file of the libpcap-1.1.1-ring;

8) after the environment is set up, add # define HAVE_PF_RING to the header file of the application;

9) you will find that the performance has been greatly improved by more than 60%. However, the cpu usage will also increase accordingly. You can view the cpu usage on the terminal using top.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.