NDC & PKI

[Day 10] 3. NFQueue and the IPS mode of Suricata

D
DITISS Admin
••3 min read

NFQueue:

NFQueue is a feature of Linux's Netfilter framework that allows packets to move from the kernel to user space. This lets applications like Suricata inspect and modify packets. If NFQueue support is missing, Suricata can't interact with iptables to inspect and block packets, so you won’t be able to proceed further.


Lab Setup:

  • Debian 1: Suricata configured with iptables.
  • Debian 2: Used to ping Debian 1.

Pre-requisite:

  • Suricata must be configured on your system.

Steps to Set Up Suricata with NFQueue:

1. Check if Suricata has NFQueue support:

Run this command to verify:

bash
suricata --build-info | grep NFQueue

You should see:

plaintext
NFQueue support: yes

If it doesn’t show this, do not proceed.

2. Edit Suricata's
.yaml
configuration file
:

Open Suricata's configuration file:

bash
sudo nano /etc/suricata/suricata.yaml

Search for

nfq:
and make the following changes:

plaintext
mode: accept
repeat-mark: 1
repeat-mask: 1
route-queue: 2

Uncomment these lines.

3. Install iptables:

Check if iptables is installed:

bash
sudo which iptables

If not, install it:

bash
sudo apt-get install iptables -y

Then add the following rules:

bash
sudo iptables -I INPUT -p icmp -j NFQUEUE --queue-num 2
sudo iptables -I OUTPUT -p icmp -j NFQUEUE --queue-num 2
  • -I
    : Insert the rule.
  • -p
    : Specifies the protocol (ICMP in this case).
  • -j
    : Jumps to queue 2.

4. Add a rule in
local.rules
:

Edit Suricata’s local rules file:

bash
sudo nano /etc/suricata/rules/local.rules

Add the following rule to block ICMP:

plaintext
drop icmp any any -> any any (msg: "Kuch Bhi Block ICMP"; sid: 123; rev: 1;)

5. Stop Suricata:

Stop Suricata to apply changes:

bash
sudo systemctl stop suricata
sudo systemctl status suricata

6. Run Suricata in IPS Mode:

Run Suricata to listen on queue 2:

bash
sudo suricata -c /etc/suricata/suricata.yaml -q 2

7. Test with a Ping from the Second Machine:

On Debian 2, ping Debian 1:

bash
ping <deb1_ip>

8. Check Suricata Logs:

Check Suricata logs to see the blocked ICMP packet:

bash
sudo tail -f /var/log/suricata/fast.log

You should see the packet was sent to Debian 1 but was blocked, with the message "Kuch Bhi Block ICMP".


Read Next

8/26/2026

[Day 10] 4. Elasticsearch Logstash Kibana (ELK)

### **What is ELK?** ELK stands for **Elasticsearch, Logstash, and Kibana**. It is a set of tools used for searching, analyzing, and visualizing la...

8/26/2026

[Day 11] 1. Logstash

## **Logstash** Logstash is a **server-side data processing pipeline**. It is a tool used to collect, process, and forward data. Logstash helps to...