Installing and Running libpcap Applications

Installation and Use of Napatech Link™ Capture Software for Intel® PAC with Intel® Arria® 10 GX FPGA

product_line_custom
Intel® PAC
category
Quick Guide

You can install most libpcap-based applications for use with Napatech libpcap interfaces using your distributions package manager.

Before you begin

If the user group napatech exists, you must have root privileges or be a member of the napatech group in order to use Napatech libpcap interfaces.

Dynamically linked applications should work the same whether installed before or after the Napatech libpcap.

Applications that are statically linked to libpcap must be recompiled and linked to the Napatech libpcap.

Ensure the use of the Napatech libpcap library

If other libpcap libraries are installed on the target platform, it is uncertain which libpcap library is used. There are two ways to ensure that the Napatech libpcap library is used:
  • By removing all other libpcap libraries from the system
  • By forcing the application to use the Napatech libpcap library

To force an application to use the Napatech libpcap library, use one of these methods:

Set LD_PRELOAD in the environment for the application:

LD_PRELOAD=/opt/napatech3/lib/libpcap.so <app>

Set LD_LIBRARY_PATH in the environment for the application:

LD_LIBRARY_PATH=/opt/napatech3/lib/ <app>

Common applications are available from your distribution

Most common libpcap-based applications can be installed from your distributions default package repositories, and run without further configuration. The package name depends on the distribution.

For example, to install and run Wireshark on RHEL/CentOS:

sudo yum install wireshark-gnome
wireshark

On Ubuntu and derivatives of Ubuntu, for example, Mint, you must preload the Napatech libpcap shared library like this:

sudo apt-get install wireshark
LD_PRELOAD=/opt/napatech3/lib/libpcap.so wireshark

Extra repositories for popular applications

If a package is not available from your distributions default package repositories, add a repository that offers the package. The application homepage might offer detailed instructions about how to add the repository and install the package.

For example, for Bro, the following is suggested for CentOS 7 at https://www.bro.org/download/packages.html:

cd /etc/yum.repos.d/
sudo wget http://download.opensuse.org/repositories/network:bro/CentOS_7/network:bro.repo
sudo yum install bro

Package downloads for popular applications

For other applications you might have to download the package and install it locally. Snort is an example of this:

For more information about installing and running Snort with SmartNICs and Napatech Software Suite, see Snort and DN-0666.

Application must be recompiled from source

If you need to compile the application yourself from source because no package is available for your distribution, the process depends on the configuration options of the application.

Note:

You should preferably link to the Napatech libpcap library to ensure the best match to the version of the Napatech libpcap.

The following examples use the installation directory prefix (--prefix) /opt/napatech3.

Most applications rely on Autoconf for configuration, and configure script options allow you to select Napatech libpcap headers and libraries. You must usually specify linker flags.

libpcap configure script option

For example, for Tcpreplay there is a --with-libpcap option that helps the configure script find Napatech libpcap:

wget https://github.com/appneta/tcpreplay/releases/download/v4.1.0/tcpreplay-4.1.0.tar.gz
tar xzf tcpreplay-4.1.0.tar.gz
cd tcpreplay-4.1.0
./configure --prefix=/opt/napatech3 LDFLAGS="-L/opt/napatech3/lib -lntapi -lntos" --with-libpcap=/opt/napatech3 --enable-dynamic-link --enable-force-inject
make
sudo make install

Even if a --with-libpcap option is available, you might also need to set compiler flags for the configure script to find Napatech libpcap. This is the case for recent versions of Tcpreplay:

wget https://github.com/appneta/tcpreplay/releases/download/v4.2.4/tcpreplay-4.2.4.tar.gz
cd tcpreplay-4.2.4
./configure --prefix=/opt/napatech3 CFLAGS=-I/opt/napatech3/include LDFLAGS="-L/opt/napatech3/lib -lntapi -lntos" --with-libpcap=/opt/napatech3 --enable-dynamic-link --enable-force-inject
...

Compiler and linker flags

For Tcpdump, you have to specify the Napatech libpcap using compiler and linker flags:

wget http://www.tcpdump.org/release/tcpdump-4.9.0.tar.gz
tar xzf tcpdump-4.9.0.tar.gz
cd tcpdump-4.9.0
./configure --prefix=/opt/napatech3 CFLAGS=-I/opt/napatech3/include LDFLAGS="-L/opt/napatech3/lib -lntapi -lntos"
make
sudo make install

Some configuration scripts do not allow compiler and linker flags as options. In that case, set the flags in the environment:

export CFLAGS=-I/opt/napatech3/include
export LDFLAGS="-L/opt/napatech3/lib -lntapi -lntos"
./configure --prefix=/opt/napatech3 ...
...