# Exploiting Hardware Filtering in PF_RING-aware apps, Snort… | ntop

> Introduction PF_RING filters have been designed to be efficient and versatile. PF_RING-based applications can use them for both reducing the amount of packets

[Blog](https://www.ntop.org/blog/)[PF\_RING](https://www.ntop.org/category/pf_ring/)[TNAPI](https://www.ntop.org/category/tnapi/)

# Exploiting Hardware Filtering in PF\_RING-aware apps, Snort…

November 15, 20113 min read

Introduction

PF\_RING filters have been designed to be efficient and versatile. PF\_RING-based applications can use them for both reducing the amount of packets they need to process, and passing incoming packets to kernel plugins for further processing.

Years ago, hardware packet filtering was limited to costly FPGA-based NICs, whereas today it is available also on commodity adapters such as [Silicom 1/10 Gbit Director card](https://web.archive.org/web/20160808172146/http://www.silicom-usa.com:80/ProductsList.aspx?Category=54&Section=740&ln=en&ln=en), and [Intel 82599](http://www.intel.com/products/ethernet/resource.htm)\-based 10 Gbit network adapters.

## Filtering in PF\_RING 5.2

Although past PF\_RING versions supported limited hardware filtering, in PF\_RING 5.2 we have completely redesigned packet filtering so that applications can use a single and consistent packet filtering API, letting PF\_RING do the magic based on the hardware NIC being used. This means that you need to code the application once, regardless of the type of NIC being used, and let PF\_RING set the native filter type. As you can see from the figure below there are many combinations we support in PF\_RING, and using a single API is pre-requisite for avoid wasting time supporting all of them.

[![](/images/2011/11/PF_RING-Filters.webp)](https://www.ntop.org/images/2011/11/PF_RING-Filters.webp)When you set a filter, you can either specify it as NIC native filter (e.g. silicom\_redirector\_hw\_rule) or as PF\_RING generic filter (e.g. filtering\_rule/hash\_filtering\_rule). In the former case you have full control over the filter at the cost of being unable to seamlessly run the code over various adapter types. In the latter case, you code once and let PF\_RING convert the filter format into native, hardware filter, based on the NIC type you use.

Although all hardware filter types are very efficient being them executed in hardware, they are not all alike. As of today we support:

-   82599-based NICs (see the Intel 82599 datasheet for more details)
    
-   Up to 32k FlowDirector filters (IPv4/v6 hash\_filtering\_rule in PF\_RING parlance)
    
-   Up to 128 5-tuple filters (IPv4/v6 filtering\_rule in PF\_RING parlance)
    
-   Silicom Director
    
-   Up to 1’000 filters per port (IPv4-only flexible filters)
    

In the case of Silicom Director, it is also possible to execute in hardware actions across ports (e.g. mirror packets matching a given filters across ports); on non-Director NICs you can do that  too at the cost of doing it in the CPU.

## Using Hardware Filters

In order to demonstrate the power and usefulness of PF\_RING filters, we have enhanced the pfcount demo application so that it adds a filter (-u command line option) for dropping incoming packets. The pfcount\_82599 demo application shows how to set native filters.

## Hardware Filtering in Snort

For all snort users, we have enhanced our PF\_RING DAQ module, so that snort can transparently set “drop filters” whenever bad packets are detected. This is a fantastic way to address DDoS attacks and drop in hardware nasty packets that would waste too many CPU cycles.As snort PF\_RING DAQ can work in both IDS (Intrusion Detection System) and IPS (Intrusion Prevention System) mode, so hardware filtering in IPS mode is a very nice thing to have.

## If You Don’t Own a Hardware-Filtering NIC…

Software PF\_RING filters are still enabled when hardware filtering is used. This because it is not always possible to filter all the traffic you would like in hardware. So you can use PF\_RING filtering as you have done so far, although you have to be aware that switching to a hardware filtering NIC allows your CPU to offload filters to the NIC and thus preserve precious CPU cycles for packet processing.

## Notes on 82599 filters

-   In order to enable hardware filters you need to load the ixgbe module with specific parameters. Example: insmod ixgbe.ko  RSS=0,0,0,0 FdirMode=2,2,2,2 FdirPballoc=3,3,3,3
-   Filters are not used just for pass/drop actions, but also for steering packets to specific cores/RX queues. For instance you can say: all incoming TCP packets on port 80 must be diverted to RX queue 3. So you can bind you HTTP analysis application to queue ethX@3 and forget all other queues.
-   You can simultaneously set both 5-tuple and FlowDirector filters. However there are some limitations in the silicon, so please refer to the [82599 datasheet](http://download.intel.com/design/network/datashts/82599_datasheet.pdf) for more information about this subject.

## Keep reading

centoJan 25, 2026

### [nProbe Cento at Scale: Flow Offload Acceleration on Napatech](https://www.ntop.org/nprobe-cento-at-scale-flow-offload-acceleration-on-napatech/)

High-speed networks continue to push the limits of software-based monitoring and security applications. As link speeds grow and traffic patterns become more complex, efficiently analyzing packets while maintaining per-flow state, for updating…

AnnounceApr 28, 2025

### [Released PF\_RING 9.0.0: Fully Fledged Hardware Flow Tracking](https://www.ntop.org/released-pf_ring-9-0-0-fully-fledged-hardware-flow-tracking/)

This is to announce a new PF\_RING release 9.0.0! This release brings significant improvements for a deeper flow tracking integrations, making PF\_RING even more powerful for building high-performance flow processing networking applications…

PF\_RINGAug 6, 2024

### [Released PF\_RING 8.8.0: Flow Table Offload and nVidia BlueField Support](https://www.ntop.org/released-pf_ring-8-8-flow-table-offload-and-nvidia-bluefield-support/)

This is to announce a new PF\_RING release 8.8.0! This release adds generic support for flow table offload, which is currently supported on Napatech adapters with Flow Manager enabled. This new technology…

## Try it on your own network

Download the free Community edition and see your first flows in five minutes.

[Download ntopng free](https://www.ntop.org/support/documentation/software-installation/)[Talk to an engineer](https://www.ntop.org/support/need-help/contacts/)
Source: https://www.ntop.org/exploiting-hardware-filtering-in-pf_ring-aware-apps-snort/