Libpcap packet loss principle analysis and detailed process of PF-RING installation under 2.6.ora9 kernel 2.6.25.14

Source: Internet
Author: User
See someone on the Internet to explain the Fedora9 installation of PF-RING process, are a few years ago, relatively old, I install PF-RING is to use libpcap library, the principle of libpcap is to capture data packets from the network adapter through socket and then submit them to the application. The difference is that libpcap uses two buffers, the kernel is similar to a Ping-Pong operation. Winpcap uses a ring buffer. In winpcap, when the NIC has data, npf. sys

See someone on the Internet to explain the Fedora 9 installation of PF-RING process, are a few years ago, relatively old, I install PF-RING is to use libpcap library, the principle of libpcap is to capture data packets from the network adapter through socket and then submit them to the application. The difference is that libpcap uses two buffers, the kernel is similar to a Ping-Pong operation. Winpcap uses a ring buffer. In winpcap, when the NIC has data, npf. sys will copy the data to the kernel buffer, and the kernel driver is actually an Ndis protocol driver. When the data packet size in the kernel buffer reaches the mintocopysize threshold, it will copy the data packet to the application buffer. kernelbuffer, userbuffer, and mintocopysize both provide functions for setting. Why are there few packet loss in the case of gigabit network during packet capture on the windows platform? Why is packet capture packet loss rate high in the linux environment, this requires careful analysis of the source code, winpcap npf. sys is an Ndis protocol driver. It is at the same layer as the TCP/IP protocol, that is, packet capture using winpcap does not need to pass through the TCP/IP layer, while libpcap is a capture package in linux, which is on the application layer and on the TCP/IP protocol, can be captured through socket, libpcap only encapsulates the socket and provides an interface on the socket for user calls. The libpcap capture package process is as follows:

Linux libpcap detailed process: Nic hard interrupt-> Soft Interrupt-> kernel protocol stack-> System Call-> socket interface-> libpcap interface-> User application, in this process, we can see that there are many copies of data. Therefore, libpcap does not need to be surprised when packet loss is serious. To reduce packet loss rate, libpcap-pfring is used.

The following describes how to install the PF-RING under Fedora 9, the installation process is as follows:

1) cd/home and create a directory mkdir rfring-libpcap.

2) cd rfring-libpcap

3) svn co https://svn.ntop.org/svn/ntop/trunk/PF_RING/ download PF-RING

4) after the PF-RING download, under cd/PF-RING/legacy, vi mkpatch. sh modify kernel version = {SUBLEVEL:-25.14}

5)./mkpatch. sh download the kernel to workspace to generate the directory linux-2.6.25-14-686-smp-PF_RING and patch file linux-2.6.25-14-686-smp-PF_RING.patch.gz.

6) follow these steps:

Music linux-2.6.25-14-686-smp-PF_RING/linux-2.6.25-14-686-smp-PF_RING.bak/

Zcat linux-2.6.25-14-686-smp-PF_RING.patch.gz | patch-p0

7) cd linux-2.6.25 to compile the kernel

# Add a custom suffix EXTRAVERSION =-PF_RING to vi Makefile. This will be displayed when the interface is started.

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.