May 26, 2026
10 min read
A Step-by-Step Technical Guide to Configuring an IPS on Kali Linux
Network Fortress: A Step-by-Step Technical Guide to Configuring an Intrusion Prevention System (IPS) on Kali Linux. In the offensive security ecosystem, Kali Linux is universally recognized as the premier toolkit for penetration testing, vulnerability assessment, and adversarial simulation. However, a deep understanding of cybersecurity requires mastering both sides of the coin. Configuring defensive security controls directly within an offensive operating system provides invaluable insights into how automated platforms detect, block, and log malicious traffic in real time.An Intrusion Prevention System (IPS) sits inline on a network interface, actively inspecting transit packets against a comprehensive database of known attack signatures or behavioral anomalies. Unlike an Intrusion Detection System (IDS), which merely generates an alert when a threat is identified, an IPS actively intervenes by dropping malicious packets, resetting TCP connections, and dynamically updating firewall rules to block the attacking IP address.This technical guide delivers an end-to-end operational procedure to deploy, configure, test, and maintain Suricataโan enterprise-grade, high-performance open-source IPS engineโon a Kali Linux environment using automated packet filtering hooks (NFQUEUE).๐งญ Architecture Overview: How an IPS Works InlineBefore deploying software, it is vital to understand how network packets flow through a Linux host configured as an IPS. In a standard setup, the operating system kernel handles packets automatically. To convert the system into an IPS, we must intercept this flow.Incoming Packet โโโบ [ Linux Netfilter (iptables/nftables) ] โ (Forward via NFQUEUE Hook) โผ [ Suricata IPS Engine ] (Signature Verification/Rules) โ โโโโโโโโดโโโโโโ โผ โผ [ Packet Matches Rule ] [ Packet is Clean ] Action: DROP/REJECT Action: ACCEPT โ โ โผ โผ (Traffic Terminated) (Sent to Destination)By leveraging Linux Netfilter architecture (iptables), we instruct the firewall kernel to divert specified network traffic into a user-space queue (NFQUEUE). Suricata continuously polls this queue, processes each packet against its enabled ruleset, and passes a verdict (ACCEPT or DROP) back to the firewall.๐ ๏ธ Step 1: System Preparation and PrerequisitesBefore installation, update the underlying system packages to avoid dependency conflicts, verify active interface configurations, and ensure the necessary network libraries are available.1. Update Core Repository IndexesOpen a terminal shell as root or utilize sudo privileges to refresh the system package indices and upgrade existing modules:bashsudo apt update && sudo apt upgrade -yUse code with caution.2. Identify Target Network InterfacesDetermine the explicit naming convention of your network interfaces using the IP tracking utility:baship link showUse code with caution.Take note of the target interface names (e.g., eth0 for wired networks or wlan0 for wireless deployments).3. Install Required Netfilter DependenciesSuricata requires underlying core libraries to communicate efficiently with the Linux kernel firewall queue structures:bashsudo apt install build-essential libpcap-dev libnetfilter-queue-dev libcap-ng-dev -yUse code with caution.๐ฅ Step 2: Installing SuricataWhile Suricata can be compiled directly from source code for advanced optimizations, installing it via official Debian packaging maintains system stability and simplifies routine security updates.1. Execute the Installation CommandRun the following package manager command to download and set up Suricata along with its built-in signature management utility:bashsudo apt install suricata suricata-update -yUse code with caution.2. Verify Successful InstallationConfirm the package installed successfully by checking the compiled application binary version and verifying built-in support for NFQUEUE:bashsuricata -V
Use code with caution.Ensure the output indicates a stable build release and lists NFQUEUE within its enabled operational features.โ๏ธ Step 3: Global Configuration File Tuning (suricata.yaml)The primary configuration of the Suricata runtime daemon is managed within the unified YAML text file located at /etc/suricata/suricata.yaml. You will need to use a terminal text editor like nano or mousepad to update this file.bashsudo nano /etc/suricata/suricata.yamlUse code with caution.Modify the following critical structural variables to suit your local network landscape:1. Define Network Variable BlocksLocate the vars block near the top of the file. Update the HOME_NET variable to represent the internal network layout you intend to protect, and set EXTERNAL_NET to isolate external untrusted traffic.yamlvars: address-groups: HOME_NET: "[192.168.1.0/24]" # Replace with your local subnet range EXTERNAL_NET: "!$HOME_NET" # Any network that is NOT your home networkUse code with caution.2. Configure the Active Logging DirectoryEnsure the default output location matches standard system logging practices:yamldefault-log-dir: /var/log/suricata/Use code with caution.3. Enable Advanced IPS Mode StructuresScroll down to the outputs configuration block and verify that the Eve log entry engine is fully activated. The eve.json output produces structured telemetry optimized for ingestion into log forwarders and SIEM systems.yamloutputs: - eve-log: enabled: yes filetype: regular filename: eve.jsonUse code with caution.4. Set Up the nfq Engine ConfigurationFind the nfq sub-key block inside the configuration file. This instructs Suricata how to communicate with Netfilter packet queues. Ensure it is mapped correctly:yamlnfq: mode: accept # Default fallback option if a rule doesn't match repeat-mark: 1 repeat-mask: 1Use code with caution.Save your changes and exit the text editor (in nano, press Ctrl+O, Enter, then Ctrl+X).๐ Step 4: Loading and Updating Threat SignaturesAn IPS engine is only as effective as its signature intelligence database. Suricata uses a built-in updating application to pull down open-source threat rules compiled by the security community.1. Pull the Emerging Threats (ET) Open RulesetExecute the integrated updater tool to fetch the newest attack signatures, malware profiles, and exploit patterns:bashsudo suricata-update
Use code with caution.This utility automatically compiles your download rules into a single comprehensive file located at /var/lib/suricata /rules/ suricata.rules.2. Inspecting Available Rule SourcesIf you wish to discover additional specialized threat categories (e.g., abuse tracking, botnet indicators, ransomware trackers), view the available source repositories:bashsudo suricata-update list-sourcesUse code with caution.โ๏ธ Step 5: Creating Custom IPS Prevention RulesBy default, the majority of public signatures pulled via suricata-update are structured as standard alert rules (IDS behavior). To actively block threats, we can create custom drop rules that drop malicious packets instantly.1. Create a Dedicated Custom Rule FileOpen a new blank rules file to append your custom testing scripts:bashsudo nano /etc/suricata/rules/local.rulesUse code with caution.2. Write a Custom Drop Rule for ICMP Ping TrafficAdd a strict rule that drops any incoming ICMP echo requests (pings) coming from the outside world into your protected local machine:textdrop icmp $EXTERNAL_NET any -> $HOME_NET any (msg:"IPS BLOCK: Unauthorized ICMP Ping Detected"; icode:0; itype:8; sid:1000001; rev:1;)Use code with caution.Understanding Rule Components:drop: The action parameter. Instead of alerting, the IPS discards the matching packet completely.icmp: Protocol parameter applying explicitly to network control messages.$EXTERNAL_NET any -> $HOME_NET any: The directional path mapping traffic from external sources to your specified home network on any port assignment.msg: The descriptive string that will appear in logs when this rule triggers.sid:1000001: Signature ID. Custom rules must use a unique identifier above 1,000,000 to avoid conflicting with default systemic rules.Save and close the file.3. Link Local Rules to Main ConfigurationOpen /etc/suricata/suricata.yaml again, navigate to the rule-files: block, and ensure your new custom rule file is listed along with the main ruleset:yamlrule-files: - /var/lib/suricata/rules/suricata.rules - /etc/suricata/rules/local.rulesUse code with caution.โ๏ธ Step 6: Configuring Firewall Netfilter Hooks (iptables)Now we must configure the Linux system to pass network packets through the Suricata engine rather than processing them normally. We achieve this by adding iptables entries that forward traffic to NFQUEUE.bash# Redirect all incoming packets to Netfilter queue 0sudo iptables -I INPUT -j NFQUEUE --queue-num 0# Redirect all transit routing traffic to Netfilter queue 0sudo iptables -I FORWARD -j NFQUEUE --queue-num 0Use code with caution.Review Active RulesTo verify that your firewall traffic redirect hooks are properly layered at the top of your network stack, run:bashsudo iptables -L -v -n
Use code with caution.You should see NFQUEUE num 0 listed as the first target action for both the INPUT and FORWARD chains.๐ Step 7: Starting and Testing the IPS Execution EngineWith configuration paths set and firewall routing active, it is time to boot up Suricata in explicit IPS mode.1. Launch Suricata in Inline ModeExecute the operational service binary, directing it to read your main configuration file and process traffic from queue 0:bashsudo suricata -c /etc/suricata/suricata.yaml -q 0Use code with caution.Note: The -q 0 flag binds the engine process to the specific Netfilter queue matching our iptables commands.2. Verify Logging Output Real-TimeOpen a secondary terminal window to track the primary human-readable system events log output file:bashsudo tail -f /var/log/suricata/suricata.logUse code with caution.Look for lines stating Engine started and verifying that the NFQUEUE thread instances are successfully processing packets.๐งช Step 8: Executing a Penetration Attack SimulationTo confirm that the IPS configuration is working, we can simulate an attack from a separate target system or device located on your external network.1. Execute an Initial Attack (ICMP Ping Challenge)From an external computer on your network, attempt to perform a standard network ping sweep against your Kali Linux IPS host:bashping <KALI_IP_ADDRESS>
Use code with caution.Observed Result:The external attacking device will experience a total timeout, receiving no replies. If you stop the ping command, it will report 100% packet loss.2. Verify IPS Enforcement in LogsReturn to your Kali Linux terminal and read the structured JSON log output engine (eve.json) to confirm that Suricata successfully identified and dropped the attack signature:bashsudo tail -n 20 /var/log/suricata/eve.json | grep "drop"Use code with caution.Alternatively, you can query the human-readable alerts output log directly:bashsudo cat /var/log/suricata/fast.logUse code with caution.You should see clear entries proving the IPS actively intercepted and neutralized the incoming connection:text05/26/2026-07:15:32.411082 [Drop] [**] [1:1000001:1] IPS BLOCK: Unauthorized ICMP Ping Detected [**] [Classification: (null)] [Priority: 3] {ICMP} 192.168.1.50 -> 192.168.1.15Use code with caution.๐งน Step 9: Reverting Changes and Post-Testing CleanupWhen you complete your testing, it is important to reset the Linux Netfilter tables. If you stop the Suricata service without flushing your firewall rules, your system will continue trying to push packets into a non-existent queue, completely blocking all internet access.1. Terminate the Suricata Engine ProcessIn the main window where Suricata is running, press Ctrl+C to cleanly shut down the detection engine threads.2. Flush Firewall QueuesRemove the forwarding entries from your firewall tables to restore standard kernel networking behavior:bashsudo iptables -F
Use code with caution.๐ Summary Configuration ChecklistAction StepOperational CommandsKey Focus Area1. Install Core Servicessudo apt install suricata suricata-updateInstalls base dependencies.2. Update Signaturessudo suricata-updateDownloads the newest threat rules.3. Configure Enginesudo nano /etc/suricata /suricata.yamlSets up network variables (HOME_NET).4. Map RulesAdd drop syntax inside local.rulesDefines explicit blocking logic.5. Activate Firewallsudo iptables -I INPUT -j NFQUEUE --queue-num 0Intercepts packet flow at the kernel level.6. Run Applicationsudo suricata -c /etc/suricata /suricata.yaml -q 0Boots engine in active IPS enforcement mode.๐ ConclusionConfiguring an Intrusion Prevention System like Suricata on Kali Linux provides valuable hands-on experience with defensive network security engineering. Transitioning an engine from a passive detection monitor (IDS) into an active inline prevention enforcement platform (IPS) requires precision at both the packet-filtering layer and the signature definition stage.By analyzing telemetry logs generated within eve.json and understanding how custom drop rules change packet routing, you can design highly resilient modern network perimeter defenses capable of mitigating advanced real-world attacks.