Cara Install dan Konfigurasi softflowd

Install

apt install softflowd

Menjalankan Instance dengan CLI

Menjalankan beberapa instance interface sekaligus (memonitor beberapa interface sekaligus)

softflowd -i eno1 \
          -n 192.168.10.5:2055 \
          -v 9 \
          -L 1 \
          -c /var/run/softflowd.eno1.ctl \
          -p /var/run/softflowd.eno1.pid
softflowd -i eno1.201 \
          -n 192.168.10.5:2055 \
          -v 9 \
          -L 201 \
          -c /var/run/softflowd.eno1.201.ctl \
          -p /var/run/softflowd.eno1.201.pid

Melihat instance yang sedang berjalan

ps aux | grep softflowd

Stop insnace yang sedang berjalan

softflowctl -c /var/run/softflowd.eno1.ctl shutdown
softflowctl -c /var/run/softflowd.eno1.201.ctl shutdown

Menjalankan Multiple Instance dengan Systemd

Berikut adalah panduan lengkap tutorial pembuatan, pengelolaan, dan penghapusan multiple instance softflowd di Linux (Debian/Ubuntu) menggunakan mekanisme systemd template unit.

Konsep dasar Systemd Template Unit ([email protected])

Paket softflowd di Linux memanfaatkan fitur Template Unit systemd ([email protected]). Tanda @ memungkinkan Anda menjalankan banyak proses softflowd independen untuk interface atau VLAN yang berbeda.

Setiap instance bernama softflowd@<INTERFACE> akan secara otomatis membaca file konfigurasinya dari:

Plaintext

/etc/softflowd/<INTERFACE>.conf

Part 1: Tutorial Pembuatan Multiple Instance

Sebagai contoh, kita akan membuat 2 instance sekaligus:

  • Instance 1: Interface eno1.100 (VLAN 100)
  • Instance 2: Interface eno1.200 (VLAN 200)

Langkah 1: Buat Direktori Konfigurasi

Pastikan folder /etc/softflowd/ sudah ada di sistem:

mkdir -p /etc/softflowd

Langkah 2: Buat File Konfigurasi Masing-Masing Instance

⚠️ PENTING: Nama variabel di file konfigurasi wajib menggunakan huruf kecil (interface dan options).

1. Konfigurasi Instance 1 (eno1.100):

nano /etc/softflowd/eno1.100.conf

Isi dengan:

interface="eno1.100"
options="-n 10.120.108.1:2055 -v 9"

2. Konfigurasi Instance 2 (eno1.200):

nano /etc/softflowd/eno1.200.conf

Isi dengan:

interface="eno1.200"
options="-n 10.120.108.1:2055 -v 9"

Langkah 3: Load Daemon & Aktifkan Service

# 1. Reload systemd agar membaca konfigurasi baru
systemctl daemon-reload

# 2. Aktifkan autostart saat boot untuk kedua instance
systemctl enable softflowd@eno1.100
systemctl enable softflowd@eno1.200

# 3. Jalankan kedua service
systemctl start softflowd@eno1.100
systemctl start softflowd@eno1.200

Langkah 4: Verifikasi Hasil Pembuatan

Cek apakah kedua proses softflowd sudah berjalan:

# Cek status instance eno1.100
systemctl status softflowd@eno1.100

# Cek status instance eno1.200
systemctl status softflowd@eno1.200

# Cek seluruh proses softflowd yang aktif di sistem
ps aux | grep softflowd

Part 2: Tutorial Penghapusan Multiple Instance

Untuk menghapus multiple instance sampai bersih (menghentikan proses, menghapus file konfigurasi, dan membersihkan status failed/cache di systemd):

Sebagai contoh, kita akan menghapus instance softflowd@eno1.100 dan softflowd@eno1.200.

Langkah 1: Stop & Disable Service

systemctl stop softflowd@eno1.100 softflowd@eno1.200
systemctl disable softflowd@eno1.100 softflowd@eno1.200

Langkah 2: Hapus File Konfigurasi Fisik & Override

# 1. Hapus file .conf fisiknya
rm -f /etc/softflowd/eno1.100.conf /etc/softflowd/eno1.200.conf

# 2. Hapus symlink atau folder override jika ada
rm -rf /etc/systemd/system/softflowd@eno1.100.service* /etc/systemd/system/softflowd@eno1.200.service*

Langkah 3: Bersihkan Cache Memori & Reset Systemd

Bash

# 1. Bersihkan status failed/history dari memori systemd
systemctl reset-failed softflowd@eno1.100 softflowd@eno1.200

# 2. Reload daemon systemd
systemctl daemon-reload

Langkah 4: Verifikasi Penghapusan

Cek kembali statusnya. Status kini akan kembali menjadi inactive (dead) tanpa memuat file .conf apa pun:

systemctl status softflowd@eno1.100

systemctl status softflowd@eno1.200

Cheat Sheet Perintah Monitoring (softflowctl)

Karena setiap instance membuat Control Socket unik di /run/softflowd/, Anda bisa memantau atau mengontrol tiap instance secara spesifik menggunakan softflowctl -c:

TujuanPerintah
Statistik Flow eno1.100softflowctl -c /run/softflowd/eno1.100.ctl statistics
Dump Active Flows eno1.200softflowctl -c /run/softflowd/eno1.200.ctl dump-flows
Resend Template NetFlow v9softflowctl -c /run/softflowd/eno1.100.ctl send-template
Force Expire Flowssoftflowctl -c /run/softflowd/eno1.100.ctl expire-all