Installing and Running libpcap Applications

libpcap Installation

Platform
Intel® PAC
Napatech SmartNIC
Content Type
Software Installation Guide
Capture Software Version
Link™ Capture Software 12.11

About this task

You can install most libpcap-based application 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 will be 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 will run without further configuration. The package name will depend 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, you might be able to add a repository that offer the package. The application homepage will often offer detailed instructions about how to add the repository and install the package.

Package downloads for popular applications

For other applications you may have to download the package and install locally.

For more information about installing and running supported open-source libraries and applications with Napatech SmartNICs, see DN-1319.

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 will depend on the configure 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 you will often find configure script options that allow you to select Napatech libpcap headers and libraries. You will usually have to 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 may 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 configure scripts does 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 ...
$ ...