Centos6.8 64-bit compilation and installation of PF_RING
1) Check whether PF_RING is installed
If you have installed pf_ring, you may need to execute:
Rmmod pf_ring
If you are not sure whether to install pf_ring, run the following command:
Modinfo pf_ring
2) Compile and install the PF_RING kernel module
Go to make and make install in the kernel folder.
# Tar-zxf PF_RING.4.7.0.tar.gz # cd PF_RING.4.7.0/# make // make directly under the directory, complete the compilation # cd PF_RING.4.7.0/kernel # make # sudo make install // the root user permission is required for kernel installation.
3) load the PF_RING kernel module
Switch to the/lib/modules // kernel/net directory. You can see the pf_ring directory and go to the pf_ring directory.
Run sudo insmod pf_ring.ko transparent_mode = 1 // it is best to set it. The official explanation is that 2 has the best performance, but the difference is not great after the test.
When PF_RING is activated, the/proc/net/pf_ring directory is created and the cat command is used to view the attributes of pf_ring:
# cat /proc/net/pf_ring/info
Note: To compile the PF_RING kernel module, you need to install the Linux kernel header file (or the kernel source code ). I have tested the 2.6.X kernel and can compile it.
4) Compile and install the dependent libraries required by PF_RING.Go to the user space library userland/lib to compile and install it.
# cd ../userland/lib# ./configure# make# sodu make install
To use libpcap for packet capture analysis, uninstall the previously installed libpcap and configure, compile, and install the driver in the/userland/libpcap-xxx-ring/directory.
Uninstall the original libpcap:
# Rpm-qa libpcap // check the installed libpcap. If libpcap exists, force uninstall it. # rpm -- nodeps-e libpcap // The original error is returned. The -- nodefs option is not available, -- nodeps is used, package dependency is not verified,-e Option, meaning erase is erased
Install libpcap for pf_ring:
# cd ../libpcap# ./configure# make# sudo make install
Note: To use the advantages of PF_RING, use libpcap. a enabled by PF_RING to re-compile the application.
5) Compile the NIC Driver and load the NIC DriverGo to the drivers directory and run the ethtool-I ethx command to view the NIC type and driver to enter the specified directory for compilation and installation.
# cd /root/soft/PF_RING/PF_RING-5.6.2/drivers/PF_RING_aware/intel/e1000e/e1000e-2.0.0.1/src# make# sodu make install
Install the NIC Driver. Go to the lib/modules // kernel/drivers/net directory to install the NIC Driver.
# Sodu insmod e1000e. ko // install the pf_ring NIC Driver # sodu modprobe e1000e // only modules in/lib/modules/<kernel ver>/can be loaded
6. Test the number of packets received by the network.Go to the userland/examples directory to compile the example program.
# Cd <PF_RING PATH>/userland/examples # make #./pfcount-I eth0 // capture the data packets of the eth0 network port
Note: drivers under drivers/intel/ixgbe (ixgbe drives supporting DNA) + DNA drives can achieve line rate acquisition. The PF_RING module must be loaded before the DNA drive.
7. Common Errors and Solutions1. pf_ring.ko module loading error message: insmod: error inserting 'pf _ ring. ko ':-1 Unknown symbol in module solution: if the current NIC driver is not uninstalled and the new one cannot be loaded, you need to uninstall the NIC Driver. 2. compile Nic module driver error driver Directory:/root/soft/PF_RING/PF_RING-5.6.2/drivers/PF_RING_aware/intel/e1000e/e1000e-2.0.0.1/src error message: /root/soft/PF_RING/PF_RING-5.6.2/drivers/PF_RING_aware/intel/e1000e/e1000e-2.0.0.1/src/kcompat. h: 3039: error: conflicting types for 'netdev _ features_t 'solution: vim kcompat. h + 3039 // comment out 3,039th rows 3. NIC Driver Module Directory:/root/soft/PF_RING/PF_RING-5.6.2/drivers/PF_RING_aware/intel/e1000e/e1000e-2.0.0.1/src loaded NIC Driver Module: insmod e1000e. ko