Getting started with PF_RING can be a bit tricky as it requires the creation of a few configuration files in order to setup the service, especially when ZC drivers need to be used.
First of all it requires packages installation: PF_RING comes with a set of packages for installing the userspace libraries (pfring), the kernel module (pfring-dkms), and the ZC drivers (<driver model>-zc-dkms). Installing the main package, pfring, is quite intuitive and straightforward following the instructions available at http://packages.ntop.org , however installing and configuring the proper package when it comes to install the ZC driver for the actual NIC model available on the target machine can lead to some headache.
In fact, doing the driver configuration manually means (in this example we consider the ixgbe driver):
- Creating a configuration file for PF_RING (/etc/pf_ring/pf_ring.conf).
- Checking the model of the installed NIC.
- Installing the proper dkms driver from the repository (ixgbe-zc-dkms)
- Creating a configuration file for the NIC model (/etc/pf_ring/zc/ixgbe/ixgbe.conf), to indicate the number of RSS queues and other driver settings.
- Creating a .start file for the NIC model (/etc/pf_ring/zc/ixgbe/ixgbe.start) to indicate that we actually want to load the driver.
- Creating a configuration file for the hugepages (/etc/pf_ring/hugepages.conf)
- Restarting the service.
In order to simplify all of this, since PF_RING 7.5, the pfring package includes the pf_ringcfg script that can be used to automatically install the required driver package and create the full configuration for the PF_RING kernel module and ZC drivers. With this method, configuring and loading the ZC driver for an interface is straightforward, it can be done in a few steps:
1. Configure the repository as explained at http://packages.ntop.org and install the pfring package which includes the pf_ringcfg script (example for Ubuntu):
apt-get install pfring
Note: it is not required to install any additional package like pfring-dkms or <driver model>-zc-dkms, pf_ringcfg will take care of that, installing selected packages according to what is actually required by the configuration.
2. List the interfaces and check the driver model:
pf_ringcfg --list-interfaces Name: em1 Driver: igb [Supported by ZC] Name: p1p2 Driver: ixgbe [Supported by ZC] Name: p1p1 Driver: ixgbe [Supported by ZC] Name: em2 Driver: e1000e [Supported by ZC]
3. Configure and load the driver specifying the driver model and (optionally) the number of RSS queues per interface:
pf_ringcfg --configure-driver ixgbe --rss-queues 1
Note: this also installs the required packages, including pfring-dkms and <driver model>-zc-dkms for the selected driver, before configuring and loading the driver.
4. Check that the driver has been successfully loaded by looking for ‘Running ZC’:
pf_ringcfg --list-interfaces Name: em1 Driver: igb [Supported by ZC] Name: p1p2 Driver: ixgbe [Running ZC] Name: p1p1 Driver: ixgbe [Running ZC] Name: em2 Driver: e1000e [Supported by ZC]
Note: there are corner cases that require particular attention and that you handle with custom configuration. For example if you’re configuring a ZC driver for an adapter that you’re currently using as management, pf_ring does not reload the driver by default as it may break network connectivity. In this case you need to add the –force option when running the pf_ringcfg script, or follow the Manual Configuration section in the PF_RING User’s Guide.