Home / use case

A local Ollama firewall analyst for a MikroTik router

At a glance
Hardware
Ollama on an RTX 3060 Ti (8 GB)
Models & engines
Models tried: qwen3.5:9b, ministral-3:8b and Cisco's Foundation-Sec-8B-Instruct (Q4_K_M)
Key gotcha
At first everything came back "block 0.95"; requiring an evidence field before the verdict in the JSON schema, plus an explicit confidence scale in the prompt, fixed it

What they built

u/emphyr10 spent a weekend testing whether a small local LLM can make sense of firewall logs and suggest what to block. Their MikroTik hAP ax³ still does all of the real filtering; the model only sits beside it as an analyst.

Firewall drops and login failures arrive over syslog, Technitium DNS query logs are polled, and simple rules pick out anomalies such as port scans, drop floods, subnet-wide scans and never-seen domains. Only those anomalies go to Ollama in batches. The project is a work in progress and not released yet; for now it runs in advisory mode and sends an ntfy notification instead of blocking.

Setup

  • MikroTik hAP ax³ router doing all filtering
  • Technitium DNS query logs
  • Ollama on an RTX 3060 Ti (8 GB)
  • Flask + SQLite web UI in a Proxmox LXC showing every prompt and raw model response
  • Models tried: qwen3.5:9b, ministral-3:8b and Cisco's Foundation-Sec-8B-Instruct (Q4_K_M)

How it works

  1. Deterministic rules pre-filter anomalies, including an entropy score for DGA-like domain names
  2. Anomalies go to Ollama in batches; the model returns allow / suspicious / block plus confidence and evidence as structured JSON
  3. In auto mode it could add IPs to a MikroTik address-list with a timeout; currently it only suggests and notifies
  4. The model is unloaded after each batch (keep_alive=0) and the job runs every 20 minutes to keep GPU idle power down

Results & numbers

  • On day one, about 60% of inbound drops went to port 51413 from old BitTorrent peers, so an ignored-ports list was added
  • One /24 was scanning the network 23 out of 23 hours, which per-IP thresholds missed until subnet aggregation was added
  • In a test, qwen flagged an injection attempt in an SSH username as malicious on its own
  • Very small sample so far: qwen3.5:9b blocked everything, ministral-3:8b reasoned most richly but misread the author's own WAN IP, and Foundation-Sec-8B was fastest and the only one to call a slow 10-port scan suspicious rather than block

Gotchas

  • At first everything came back "block 0.95"; requiring an evidence field before the verdict in the JSON schema, plus an explicit confidence scale in the prompt, fixed it
  • The model can't do time math (it called an 8-second scan "8 minutes"), so the app now computes duration and rate itself
  • Log lines are attacker-controlled: strip control and bidi characters, pass logs only as JSON, validate returned IDs, and always take the block IP from the anomaly record, never the model's text
  • Keep a hard whitelist, no blocks larger than a /24, and never block your own WAN range
  • Blocking already-dropped traffic adds little; the author now also logs new DSTNAT connections to forwarded ports
“Key design choice: the LLM is NOT in the packet path.”— u/emphyr10

Do it yourself

  1. Send your router's firewall drops and login failures to a collector over syslog, and poll your DNS server's query log
  2. Write plain rules that flag anomalies (port scans, floods, subnet scans, unusual domains) and aggregate by /24
  3. Send only flagged anomalies to a small Ollama model with a JSON schema that asks for evidence first, then verdict and confidence
  4. Compute times and rates in code and tell the model not to calculate
  5. Run in advisory mode with notifications, keep a whitelist and size limits, and log every prompt and response for review
Source: Reddit r/ollama (u/emphyr10) · Published 2026-11-29 · Added 2026-11-29. This write-up summarizes the original source; see it for full details.

Similar setups

Guardrails for letting local Qwen models reorganize terabytes of files

For about a year a Reddit user has had Qwen models on Ollama sort media, clean up repos and reorganize a few terabytes of files without losing anything important, because the workflow, not the model, limits what can happen.

Reddit r/ollama (u/Sussybaka800869) · 2026-11-29

A local second brain for Markdown notes with Ollama, Whisper and SQLite

WeekendAiProjects built a phone-to-computer note capture system that tidies, links, searches and answers questions over a Markdown vault with local Qwen models, and graded every answer by hand.

DEV Community · 2026-11-08

A €200 mini PC as an offline AI box: a week with Gemma and Qwen

Diogo Soares ran Gemma 4 E4B and Qwen2.5-Coder 7B on a cheap NiPoGi P1 mini PC firewalled off the internet, used it from his Mac for a week, and measured what was fast and what wasn't.

Diogo Soares (DEV Community) · 2026-10-30

Siesta: a local overnight agent that reads fridge photos and receipts, then sleeps

Md Faijal Eaqbal built Siesta, a folder-watching agent on 3B open-weight models in Ollama that turns fridge photos, receipts and chat exports into one morning page, and spends zero tokens when nothing has changed.

Md Faijal Eaqbal (DEV Community) · 2026-10-21