← sources

Open-source DDoS detection and mitigation for Linux, with Prometheus metrics and Discord alerts

source: reddit (reddit:selfhosted)published 2026-10-23 09:13ingested 2026-10-24 02:37

retained text

[https://github.com/0vm/NetDeflect](https://github.com/0vm/NetDeflect) (Apache-2.0, active commit history, screenshots and a demo video in the README)

If you expose anything you self-host, a game server, a VPN, a web app, a Jellyfin server, you eventually get DDoS attacks, floods and reflection attacks hitting the server. Most answers are either a paid DDoS protection service (like Cloudflare (no Jellyfin or UDP) or OVH) or writing your own rules that you have to figure out yourself and those will happily block real users when they misfire.

It runs on a VPS or whatever server faces the internet, installs in one command and only if you want to, it sets up as a systemd service. It exposes Prometheus metrics (node\_exporter textfile or a built-in /metrics page) so it drops straight into Grafana, has a watch-only mode so you can test it against your normal traffic before it blocks anything, validates WireGuard and OpenVPN on your VPN ports and only filters the interfaces you pick so Docker networks are left alone. Honest limit: an attack bigger than your connection fills the line before it reaches you, and that has to be handled upstream. It handles everything that does reach the machine.

fail2ban works on logs, so it's too slow for packet floods and honestly useless against spoofed traffic. Plain nftables or a script can ratelimit, but it has no idea what the attack is and will ban forged source addresses which is exactly how you end up blocking your own users. NetDeflect samples the traffic, classifies the attack on real header fields (110 signatures, plus it fingerprints ones it doesn't know) and drops it in the kernel, while never banning spoofed sources. It also learns your regular users and lets them through first during an attack. I wanted something that does the detection and responds automatically and tells me what happened, rather than me writing rules mid attack.

I've been building this since 2021 and I designed and built it myself: the detection logic, the classifier, the mitigation, all of it. AI *helped* around the edges, generating novel DDoS variations to throw at it (basically trying to evade my own detection, until the model's safeguards kicked in and it refused to attack further), confirming whether detection was actually working during tests against my own services and helping track down bugs. I brought my own, somewhat outdated, knowledge of past DDoS attacks to the design. My bug-finding process is "push to prod and wait for someone to open an issue" (joke). More seriously, it's been audited by AI, by other network engineers and by the lovely people who open issues and PRs on GitHub.

document fetched 2026-10-24 00:30 · canonical https://reddit.com/r/selfhosted/comments/1xd934v/opensource_ddos_detection_and_mitigation_for