# How to Dump, Index, and Layer-7 Filter Network Traffic at High Speed | ntop

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

# How to Dump, Index, and Layer-7 Filter Network Traffic at High Speed

September 17, 20202 min read

n2disk is an application that many of the ntop community uses to [dump traffic up to 100 Gbit](https://www.ntop.org/howto-build-a-100-gbit-drop-free-continuous-packet-recorder-using-n2disk-part-3/). What few people know is that n2disk can index data not just using packet header information (i.e. IP, port. VLAN, MAC…) but also using [nDPI](https://www.ntop.org/products/deep-packet-inspection/ndpi/) to produce an index that contains application protocol information.

This filtering can happen:

-   During packet capture (i.e. instruct n2disk to avoid dumping specific protocols such as Netflix or YouTube that take up a lot of disk space and that are usually harmless).
-   While extracting packets from stored pcap files.
-   With any PF\_RING-based application, including those using libpcap such as tcpdump or Suricata.

## L7 Capture Filters

Thanks to the integration with [PF\_RING FT](https://www.ntop.org/introducing-pf_ring-ft-ndpi-based-flow-classification-and-filtering-for-pf_ring-and-dpdk/) (no additional PF\_RING FT license is necessary with n2disk 10/40/100 Gbit), n2disk supports *–l7-filter-conf <file>* to specify a configuration file where it is possible to define which protocols can be forwarded tot the n2disk engine and which one should be discarded and hence not dumped on pcaps. Example for dropping streaming and dumping the rest, you can specify a filter file name ft.conf as the one below

\[global\]
default = forward

\[filter\]
YouTube = discard
Netflix = discard

**L7 Extraction Filters**

During pcap extraction, it is possible to extract selected packets from pcaps using L7 filtering only if an extended (add *\-I -E 2* to n2disk) index has been created during packet capture. This way the n2disk companion utility named *npcapextract* can filter packets usign L7 protocol in addition to usual packet header-based filters. For instance for filtering all Instagram traffic made by host 192.168.1.1 do

npcapextract -t /storage -b "2020-09-16 12:05:32" -e "2020-09-16 12:10:32" -o output.pcap -f "ip host 192.168.1.1 and l7proto Instagram"

This technique supports all the nDPI detected protocols, that is continuously updated as new protocol/versions are supported.

**Using L7 Filtering with PF\_RING-based tools (including tcpdump)**

In addition to n2disk, PF\_RING supports L7 filtering natively. You simply have to compile your application on top of PF\_RING or of [libpcap-PF\_RING.](https://github.com/ntop/PF_RING/tree/dev/userland) For instance if you use tcpdump compiled on top of PF\_RING (that you can find [here](https://github.com/ntop/PF_RING/tree/dev/userland)) you can do

\# PF\_RING\_FT\_CONF=ft.conf tcpdump -ni pcap:file.pcap

or

# PF\_RING\_FT\_CONF=ft.conf tcpdump -i eth0

Note that with live traffic, nDPI needs a few packets to detect the application protocol, hence for TCP-based protocols for instance the initial 3WH is not filtered whereas the following packets will be filtered according to L7 rules.

If you want to know more about this technique you can read more in the [n2disk user’s guide](https://www.ntop.org/guides/n2disk/filters.html#l7-filtering).

### Summary

Thanks for nDPI, via PF\_RING, you can now complement existing packet header-based filtering techniques such as BPF, with layer-7 filtering both during packet capture, indexing and extraction. This allows you to save disk space dumping unwanted protocols, and extract only the traffic you care about, that can be complicated to do with the plethora of application protocols present in modern network traffic.

## Keep reading

ntopngNov 23, 2026

### [Modeling Your Network: Part I](https://www.ntop.org/network-model-intro/)

ntopng is introducing continuous network learning to help administrators close visibility gaps in dynamic networks, starting with a new Server Model feature. Using DPI and historical flow data, the system passively discovers and baselines core servers—alerting operators to unauthorized services, unresponsive hosts, or traffic anomalies while automatically updating network configurations to reduce false-positive security alerts.

AINov 7, 2026

### [Sharkfest 26EU: HowTo Detect Stealth VPN and AI Inference Traffic](https://www.ntop.org/sharkfest-26eu-howto-detect-stealth-vpn-and-ai-inference-traffic/)

Earlier this week we have presented at Sharkfest Europe 2026 a presentation of our work about traffic detection of Stealth VPNs and AI Inference. The presentation addresses the challenges of detecting modern obfuscated network traffic, specifically from stealth VPNs and custom/local artificial intel

nDPINov 7, 2026

### [Detecting CVE-2026-98432 using nDPI/ntopng](https://www.ntop.org/detecting-cve-2026-98432-using-ndpi-ntopng/)

CVE-2026-98432 is a critical, 9.8-severity use-after-free (UAF) vulnerability in the Linux kernel’s IPv4 TCP networking stack. It allows an unauthenticated remote attacker to potentially cause system crashes, memory corruption, or execute arbitrary commands with root privileges. From a network stand

## 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/how-dump-index-and-layer-7-filter-network-traffic-at-high-speed/