ntopng Integration
==================
nFW is designed to work seamlessly with `ntopng `_, providing centralized monitoring, visualization, and policy management. This section explains how to set up and optimize the integration.
Overview
--------
The nFW-ntopng integration provides:
- **Real-Time Flow Monitoring**: View all flows inspected by nFW in ntopng's web interface
- **Protocol Analytics**: See detailed statistics on detected protocols and applications
- **Dynamic Policy Management**: Configure and update policies through ntopng's GUI
- **Historical Data**: Store and query flow data over time
- **Alerting**: Set up alerts for policy violations or suspicious traffic
- **Multi-Instance Support**: Multiple nFW instances can report to a single ntopng
Integration Architecture
------------------------
Communication Channels
~~~~~~~~~~~~~~~~~~~~~~
nFW and ntopng communicate via two ZeroMQ channels:
1. **Flow Export Channel**: nFW sends flow data to ntopng (ZMQ PUB/SUB)
2. **Policy Update Channel**: ntopng sends policy updates to nFW (ZMQ PUB/SUB)
.. code-block:: text
┌─────────┐ ┌─────────┐
│ nFW │──── Flows ────────>│ ntopng │
│ │<─── Policies ──────│ │
└─────────┘ └─────────┘
ZeroMQ Endpoints
~~~~~~~~~~~~~~~~
- **ntopng as Collector**: Endpoint URL must end with ``c`` (e.g., ``tcp://127.0.0.1:1234c``)
- **nFW as Publisher**: Endpoint URL without ``c`` (e.g., ``tcp://127.0.0.1:1234``)
Basic Setup
-----------
Same-Host Deployment
~~~~~~~~~~~~~~~~~~~~
When nFW and ntopng run on the same machine:
**Start ntopng:**
.. code-block:: console
sudo ntopng -i tcp://127.0.0.1:1234c
**Start nFW:**
.. code-block:: console
sudo nfw -q 0 -z tcp://127.0.0.1:1234
**Access ntopng Web Interface:**
Open http://localhost:3000 in your browser. You should see flows from nFW appearing in real-time.
Remote Deployment
~~~~~~~~~~~~~~~~~
When nFW and ntopng run on different machines:
**On ntopng host (192.168.1.10):**
.. code-block:: console
sudo ntopng -i tcp://0.0.0.0:1234c
**On nFW host:**
.. code-block:: console
sudo nfw -q 0 -z tcp://192.168.1.10:1234
**Firewall Configuration:**
Ensure TCP port 1234 is accessible from the nFW host to ntopng host.
Dynamic Policy Management
--------------------------
To enable bidirectional communication (flow export + policy updates):
Setup with Policy Updates
~~~~~~~~~~~~~~~~~~~~~~~~~~
**On ntopng host:**
.. code-block:: console
sudo ntopng -i tcp://0.0.0.0:5556c --zmq-publish-events tcp://0.0.0.0:5557
**On nFW host:**
.. code-block:: console
sudo nfw -q 0 -z tcp://ntopng-host:5556 -p tcp://ntopng-host:5557
**Configure Policies in ntopng:**
1. Open ntopng web interface
2. Navigate to **Settings** → **Policies**
3. Create or modify policies
4. Changes are automatically pushed to nFW
Managing Policies via ntopng
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**Creating a Pool:**
1. Go to **Pools** → **Host Pools**
2. Click **Add Pool**
3. Define IP ranges and/or MAC addresses
4. Assign a policy to the pool
**Creating a Policy:**
1. Go to **Policies** → **Traffic Policies**
2. Click **Add Policy**
3. Configure protocol/category filters
4. Set default action (Pass/Drop)
5. Click **Save**
**Viewing Applied Policies:**
1. Go to **Flows** → **All Flows**
2. Look for the **Policy** column
3. Flows show which policy was applied
Multiple nFW Instances
-----------------------
Single ntopng, Multiple nFW Deployments
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Deploy nFW on multiple hosts, all reporting to one ntopng:
**On ntopng host:**
.. code-block:: console
sudo ntopng -i tcp://0.0.0.0:5556c --zmq-publish-events tcp://0.0.0.0:5557
**On nFW host 1:**
.. code-block:: console
sudo nfw -q 0 -z tcp://ntopng-host:5556 -p tcp://ntopng-host:5557
**On nFW host 2:**
.. code-block:: console
sudo nfw -q 0 -z tcp://ntopng-host:5556 -p tcp://ntopng-host:5557
**On nFW host 3:**
.. code-block:: console
sudo nfw -q 0 -z tcp://ntopng-host:5556 -p tcp://ntopng-host:5557
All nFW instances will:
- Send flows to the same ntopng
- Receive policy updates from the same ntopng
- Appear as separate interfaces/collectors in ntopng
High Availability
~~~~~~~~~~~~~~~~~
For redundancy, send flows to multiple ntopng instances:
.. code-block:: console
sudo nfw -q 0 \
-z tcp://ntopng1:5556 \
-z tcp://ntopng2:5556 \
-p tcp://ntopng1:5557
Encrypted Communication
-----------------------
Secure flow export with ZeroMQ CURVE encryption.
Generate CURVE Keys
~~~~~~~~~~~~~~~~~~~~
On ntopng host, generate a key pair:
.. code-block:: console
# Generate keys using zmq tools
curve_keygen
This outputs:
.. code-block:: text
public-key: Yne@$w-vo